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

This commit is contained in:
Isaac Connor 2022-03-04 12:07:32 -05:00
parent 0c31e35b4e
commit 920f5470a8
1 changed files with 17 additions and 13 deletions

View File

@ -88,8 +88,8 @@ function MonitorStream(monitorData) {
} else { } else {
newWidth = this.width * newscale / SCALE_BASE; newWidth = this.width * newscale / SCALE_BASE;
newHeight = this.height * newscale / SCALE_BASE; newHeight = this.height * newscale / SCALE_BASE;
img.width(newWidth); //img.width(newWidth);
img.height(newHeight); //img.height(newHeight);
if (newscale > 100) newscale = 100; if (newscale > 100) newscale = 100;
newSrc = oldSrc.replace(/scale=\d+/i, 'scale='+newscale); newSrc = oldSrc.replace(/scale=\d+/i, 'scale='+newscale);
} }
@ -367,6 +367,9 @@ function MonitorStream(monitorData) {
} // end if paused or delayed } // end if paused or delayed
$j('#zoomValue'+this.id).text(this.status.zoom); $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 ('zoomOutBtn' in this.buttons) {
if (this.status.zoom == '1.0') { if (this.status.zoom == '1.0') {
setButtonState('zoomOutBtn', 'unavail'); setButtonState('zoomOutBtn', 'unavail');
@ -381,25 +384,26 @@ function MonitorStream(monitorData) {
if (canEdit.Monitors) { if (canEdit.Monitors) {
if (streamStatus.enabled) { if (streamStatus.enabled) {
if ('enableAlarmButton' in this.buttons) { if ('enableAlarmButton' in this.buttons) {
this.buttons.enableAlarmButton.addClass('disabled'); if (!this.buttons.enableAlarmButton.hasClass('disabled')) {
this.buttons.enableAlarmButton.prop('title', disableAlarmsStr); this.buttons.enableAlarmButton.addClass('disabled');
} else { this.buttons.enableAlarmButton.prop('title', disableAlarmsStr);
console.log('enableAlarmButton not found in buttons'); }
} }
if ('forceAlarmButton' in this.buttons) { if ('forceAlarmButton' in this.buttons) {
if (streamStatus.forced) { if (streamStatus.forced) {
this.buttons.forceAlarmButton.addClass('disabled'); if (! this.buttons.forceAlarmButton.hasClass('disabled')) {
this.buttons.forceAlarmButton.prop('title', cancelForcedAlarmStr); this.buttons.forceAlarmButton.addClass('disabled');
this.buttons.forceAlarmButton.prop('title', cancelForcedAlarmStr);
}
} else { } else {
this.buttons.forceAlarmButton.removeClass('disabled'); if (this.buttons.forceAlarmButton.hasClass('disabled')) {
this.buttons.forceAlarmButton.prop('title', forceAlarmStr); this.buttons.forceAlarmButton.removeClass('disabled');
this.buttons.forceAlarmButton.prop('title', forceAlarmStr);
}
} }
this.buttons.forceAlarmButton.prop('disabled', false); this.buttons.forceAlarmButton.prop('disabled', false);
} else {
console.log('forceAlarmButton not found in buttons');
} }
} else { } else {
console.log("streamStatus not enabled");
if ('enableAlarmButton' in this.buttons) { if ('enableAlarmButton' in this.buttons) {
this.buttons.enableAlarmButton.removeClass('disabled'); this.buttons.enableAlarmButton.removeClass('disabled');
this.buttons.enableAlarmButton.prop('title', enableAlarmsStr); this.buttons.enableAlarmButton.prop('title', enableAlarmsStr);