Fix clicking in montage

This commit is contained in:
Isaac Connor
2019-03-21 17:00:51 -04:00
parent 65fab1b032
commit 16467595d4
2 changed files with 19 additions and 14 deletions

View File

@@ -25,26 +25,28 @@ function Monitor(monitorData) {
}
};
this.onclick = function() {
var el = this;
var url = '?view=watch&mid='+this.id;
var name = 'zmWatch'+this.id;
this.eventHandler = function( event ) {
console.log(event);
}
this.onclick = function(evt) {
var el = evt.currentTarget;
var tag = 'watch';
var width = el.getAttribute("data-window-width");
var height = el.getAttribute("data-window-height");
var id = el.getAttribute("data-monitor-id");
var width = el.getAttribute("data-width");
var height = el.getAttribute("data-height");
var url = '?view=watch&mid='+id;
var name = 'zmWatch'+id;
evt.preventDefault();
createPopup(url, name, tag, width, height);
};
this.setup_onclick = function() {
document.querySelectorAll('#imageFeed'+this.id).forEach(function(el) {
el.addEventListener('click', this.onclick);
});
var el = document.getElementById('imageFeed'+this.id);
if ( el ) el.addEventListener('click', this.onclick, false);
};
this.disable_onclick = function() {
document.querySelectorAll('#imageFeed'+this.id).forEach(function(el) {
el.removeEventListener('click', this.onclick);
});
document.getElementById('imageFeed'+this.id).removeEventListener('click', this.onclick );
};
this.setStateClass = function(element, stateClass) {
@@ -422,8 +424,10 @@ function cancel_layout(button) {
$j('#EditLayout').show();
for ( var i = 0, length = monitors.length; i < length; i++ ) {
var monitor = monitors[i];
monitor_feed = $j('#imageFeed'+monitor.id);
monitor_feed.click(monitor.onclick);
monitor.setup_onclick();
//monitor_feed = $j('#imageFeed'+monitor.id);
//monitor_feed.click(monitor.onclick);
};
selectLayout('#zmMontageLayout');
}

View File

@@ -200,6 +200,7 @@ foreach ( $monitors as $monitor ) {
<div
id="imageFeed<?php echo $monitor->Id() ?>"
class="imageFeed"
data-monitor-id="<?php echo $monitor->Id() ?>"
data-width="<?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>"
data-height="<?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?>">
<?php