From 920f5470a83efa7c0d621e2cf9557d3d4d25175d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 4 Mar 2022 12:07:32 -0500 Subject: [PATCH] Don't set width&height on img. img is always 100% of container. Don't show zoom unless it is != 1.0. Only update buttons if there is a change, to reduce redraws --- web/js/MonitorStream.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/web/js/MonitorStream.js b/web/js/MonitorStream.js index cd520034d..48de60db1 100644 --- a/web/js/MonitorStream.js +++ b/web/js/MonitorStream.js @@ -88,8 +88,8 @@ function MonitorStream(monitorData) { } else { newWidth = this.width * newscale / SCALE_BASE; newHeight = this.height * newscale / SCALE_BASE; - img.width(newWidth); - img.height(newHeight); + //img.width(newWidth); + //img.height(newHeight); if (newscale > 100) newscale = 100; newSrc = oldSrc.replace(/scale=\d+/i, 'scale='+newscale); } @@ -367,6 +367,9 @@ function MonitorStream(monitorData) { } // end if paused or delayed $j('#zoomValue'+this.id).text(this.status.zoom); + if (this.status.zoom == '1.0') { + $j('#zoom'+this.id).addClass('hidden'); + } if ('zoomOutBtn' in this.buttons) { if (this.status.zoom == '1.0') { setButtonState('zoomOutBtn', 'unavail'); @@ -381,25 +384,26 @@ function MonitorStream(monitorData) { if (canEdit.Monitors) { if (streamStatus.enabled) { if ('enableAlarmButton' in this.buttons) { - this.buttons.enableAlarmButton.addClass('disabled'); - this.buttons.enableAlarmButton.prop('title', disableAlarmsStr); - } else { - console.log('enableAlarmButton not found in buttons'); + if (!this.buttons.enableAlarmButton.hasClass('disabled')) { + this.buttons.enableAlarmButton.addClass('disabled'); + this.buttons.enableAlarmButton.prop('title', disableAlarmsStr); + } } if ('forceAlarmButton' in this.buttons) { if (streamStatus.forced) { - this.buttons.forceAlarmButton.addClass('disabled'); - this.buttons.forceAlarmButton.prop('title', cancelForcedAlarmStr); + if (! this.buttons.forceAlarmButton.hasClass('disabled')) { + this.buttons.forceAlarmButton.addClass('disabled'); + this.buttons.forceAlarmButton.prop('title', cancelForcedAlarmStr); + } } else { - this.buttons.forceAlarmButton.removeClass('disabled'); - this.buttons.forceAlarmButton.prop('title', forceAlarmStr); + if (this.buttons.forceAlarmButton.hasClass('disabled')) { + this.buttons.forceAlarmButton.removeClass('disabled'); + this.buttons.forceAlarmButton.prop('title', forceAlarmStr); + } } this.buttons.forceAlarmButton.prop('disabled', false); - } else { - console.log('forceAlarmButton not found in buttons'); } } else { - console.log("streamStatus not enabled"); if ('enableAlarmButton' in this.buttons) { this.buttons.enableAlarmButton.removeClass('disabled'); this.buttons.enableAlarmButton.prop('title', enableAlarmsStr);