Move onclick to the surrounding div instead of the img. Fixes clicking on montage

This commit is contained in:
Isaac Connor 2022-01-26 21:39:29 -05:00
parent fe8747e5e7
commit 8e62562afd
1 changed files with 9 additions and 1 deletions

View File

@ -38,6 +38,14 @@ function MonitorStream(monitorData) {
} }
return this.element; 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. */ /* if the img element didn't have a src, this would fill it in, causing it to show. */
this.show = function() { this.show = function() {
@ -161,7 +169,7 @@ function MonitorStream(monitorData) {
this.setup_onclick = function(func) { this.setup_onclick = function(func) {
this.onclick = func; this.onclick = func;
const el = this.getElement(); const el = this.getFrame();
if (!el) return; if (!el) return;
el.addEventListener('click', this.onclick, false); el.addEventListener('click', this.onclick, false);
}; };