Skip to content

Commit

Permalink
Version 282:
Browse files Browse the repository at this point in the history
* Fixed bug in camera coordinate processing when streaming camera groups in JPEG mode with dynamic layout disabled clientside but enabled serverside.
  • Loading branch information
bp2008 committed Jan 21, 2025
1 parent 09e5a1f commit bb45863
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ui3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
};
</script>
<script type="text/javascript">
var ui_version = "281";
var ui_version = "282";
var bi_version = "%%VERSION%%";
var appPath_raw = "%%VIRTDIR%%";
var local_bi_session = "%%SESSION%%";
Expand Down
56 changes: 46 additions & 10 deletions ui3/ui3.js
Original file line number Diff line number Diff line change
Expand Up @@ -16004,32 +16004,68 @@ function CameraListLoader()
}
function ScaledRectsWorkaround(image)
{
// Last noted in BI 5.5.6.2:
var condition;

// Noted in BI 5.5.6.2:
// H.264 group streams
// * Dynamic Layout: scaled reclist
// * Dynamic Layout: scaled reclist
// * Static Layout: scaled reclist
// JPEG group streams
// * Dynamic Layout: scaled reclist
// * Static Layout: unscaled reclist
// * Dynamic Layout: scaled reclist
// * Static Layout: unscaled reclist (if the Aspect Ratio of the group is fixed in the local console)
// To work around this inconsistency, this method will unscale the static layout reclist for static layout h264 group streams..

if (image.rects && videoPlayer.CurrentPlayerModuleName() === "h264" && !cameraListLoader.isDynamicLayoutEnabled(image.id))
//condition = image.rects && videoPlayer.CurrentPlayerModuleName() === "h264" && !cameraListLoader.isDynamicLayoutEnabled(image.id);

// In 2025-01-21 (BI 5.9.9.22) it was noted that jpeg group streams configured serverside to allow dynamic layout have incorrect click handling in UI3 when dynamic layout is disabled in UI3.
// Therefore I am changing the scaling condition.

condition = image.rects && !cameraListLoader.isDynamicLayoutEnabled(image.id)
&& (videoPlayer.CurrentPlayerModuleName() === "h264" ||
!self.IsRectsOutOfBounds(image));

console.log(condition, JSON.stringify(image.rects));
if (condition)
{
var rects = new Array(image.rects.length);
var nativeRes = image.getFullRect();
var actualRes = image.getActualRect();
var scaleX = nativeRes.w / actualRes.w;
var scaleY = nativeRes.h / actualRes.h;
var scale = (scaleX + scaleY) / 2;
for (var i = 0; i < rects.length; i++)
if (scale !== 1)
{
var r = image.rects[i];
rects[i] = [r[0] * scale, r[1] * scale, r[2] * scale, r[3] * scale];
var rects = new Array(image.rects.length);
for (var i = 0; i < rects.length; i++)
{
var r = image.rects[i];
rects[i] = [r[0] * scale, r[1] * scale, r[2] * scale, r[3] * scale];
}
return rects;
}
return rects;
}
return image.rects;
}
/**
* Returns true if the given image's rects array contains coordinates outside the image's actual dimensions.
* @param {BICameraData} image BICameraData instance
*/
this.IsRectsOutOfBounds = function (image)
{
if (image.rects)
{
var actualRes = image.getActualRect();
var roundingError = 2;
actualRes.w += roundingError;
actualRes.h += roundingError;
for (var i = 0; i < image.rects.length; i++)
{
var r = image.rects[i];
if (r[0] > actualRes.w || r[1] > actualRes.h || r[2] > actualRes.w || r[3] > actualRes.h)
return true;
}
}
return false;
}
this.GetGroupCams = function (groupId)
{
// Get from dynamic layout
Expand Down

0 comments on commit bb45863

Please sign in to comment.