Skip to content

Commit

Permalink
Don't allow a scale of 0. Default to 100. Call changeStreamQuality af…
Browse files Browse the repository at this point in the history
…ter changeScale so that we always pass the right value. Prevents Errors in logs about bogus scale value
  • Loading branch information
Isaac Connor committed Dec 10, 2024
1 parent 0d34e46 commit 223dc4b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions web/skins/classic/views/js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var coordinateMouse = {
};
var leftBtnStatus = {Down: false, UpAfterDown: false};
var updateScale = false; //Scale needs to be updated
var currentScale = 0; // Temporarily, because need to put things in order with the "scale" variable = "select" block
var currentScale = 100; // Temporarily, because need to put things in order with the "scale" variable = "select" block

$j(document).on("keydown", "", function(e) {
e = e || window.event;
Expand Down Expand Up @@ -309,13 +309,13 @@ function changeScale() {
newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, bottomEl, $j('#wrapperEventVideo'));
newWidth = newSize.width;
newHeight = newSize.height;
currentScale = newSize.autoScale;
currentScale = newSize.autoScale ? newSize.autoScale : 100;
} else if (scaleSel == 'fit_to_width') {
//Fit to screen width
newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, false, $j('#wrapperEventVideo'));
newWidth = newSize.width;
newHeight = newSize.height;
currentScale = newSize.autoScale;
currentScale = newSize.autoScale ? newSize.autoScale : 100;
} else if (scaleSel.indexOf("px") > -1) {
newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, false, $j('#wrapperEventVideo')); // Only for calculating the maximum width!
let w = 0;
Expand Down Expand Up @@ -1347,7 +1347,6 @@ function initPage() {
// Load the event stats
getStat();
zmPanZoom.init();
changeStreamQuality();

if (getEvtStatsCookie() != 'on') {
eventStats.toggle(false);
Expand All @@ -1356,6 +1355,12 @@ function initPage() {
onStatsResize(eventData.Width);
wrapperEventVideo.removeClass('col-sm-12').addClass('col-sm-8');
}
console.log('progress');
progressBarNav();
console.log('changescale');
changeScale();
console.log('changeStreamQality');
changeStreamQuality();

//FIXME prevent blocking...not sure what is happening or best way to unblock
if (document.getElementById('videoobj')) {
Expand Down Expand Up @@ -1411,16 +1416,12 @@ function initPage() {
}
}
} // end if videojs or mjpeg stream
progressBarNav();
//if (scale == '0') changeScale();
changeScale();
nearEventsQuery(eventData.Id);
initialAlarmCues(eventData.Id); //call ajax+renderAlarmCues
document.querySelectorAll('select[name="rate"]').forEach(function(el) {
el.onchange = window['changeRate'];
});


// enable or disable buttons based on current selection and user rights
renameBtn.prop('disabled', !canEdit.Events);
archiveBtn.prop('disabled', !(!eventData.Archived && canEdit.Events));
Expand Down

0 comments on commit 223dc4b

Please sign in to comment.