From 8e62562afdeb87be0ce2a241b5aa02cadc67bd3c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Jan 2022 21:39:29 -0500 Subject: [PATCH] Move onclick to the surrounding div instead of the img. Fixes clicking on montage --- web/js/MonitorStream.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/js/MonitorStream.js b/web/js/MonitorStream.js index b5f9d0b6a..86b9b97e0 100644 --- a/web/js/MonitorStream.js +++ b/web/js/MonitorStream.js @@ -38,6 +38,14 @@ function MonitorStream(monitorData) { } return this.element; }; + this.getFrame = function() { + if (this.frame) return this.frame; + this.frame = document.getElementById('imageFeed'+this.id); + if (!this.frame) { + console.error("No frame div for #imageFeed"+this.id); + } + return this.frame; + }; /* if the img element didn't have a src, this would fill it in, causing it to show. */ this.show = function() { @@ -161,7 +169,7 @@ function MonitorStream(monitorData) { this.setup_onclick = function(func) { this.onclick = func; - const el = this.getElement(); + const el = this.getFrame(); if (!el) return; el.addEventListener('click', this.onclick, false); };