Merge branch 'continuous' into cont_mast

This commit is contained in:
root 2021-04-16 11:27:48 -04:00
commit f3ea08c4a1
3 changed files with 42 additions and 2 deletions

View File

@ -122,7 +122,16 @@ function controlPanTilt($monitor, $cmds) {
$hasTilt = $control->CanTilt();
$hasDiag = $hasPan && $hasTilt && $control->CanMoveDiag();
?>
<button type="button" class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" data-on-click="controlCmd" value="<?php echo $cmds['MoveUpLeft'] ?>" data-xtell="-1" data-ytell="-1"></button>
<button type="button" class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>"
<?php
if ($control->CanMoveCon()) {
echo 'data-on-mousedown="controlCmd" ';
echo 'data-on-mouseup="controlCmd" ';
} else {
echo 'data-on-click="controlCmd" ';
}
?>
value="<?php echo $cmds['MoveUpLeft'] ?>" data-xtell="-1" data-ytell="-1"></button>
<button type="button" class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" data-on-click="controlCmd" value="<?php echo $cmds['MoveUp'] ?>" data-xtell="0" data-ytell="-1"></button>
<button type="button" class="arrowBtn upRightBtn<?php echo $hasDiag?'':' invisible' ?>" data-on-click="controlCmd" value="<?php echo $cmds['MoveUpRight'] ?>" data-xtell="1" data-ytell="-1"></button>
<button type="button" class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" data-on-click="controlCmd" value="<?php echo $cmds['MoveLeft'] ?>" data-xtell="-1" data-ytell="0"></button>

View File

@ -126,6 +126,29 @@ function dataOnClick() {
window[fnName](ev);
};
});
document.querySelectorAll("button[data-on-mousedown]").forEach(function(el) {
var fnName = el.getAttribute("data-on-mousedown");
if ( !window[fnName] ) {
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
return;
}
el.onmousedown = function(ev) {
window[fnName](ev);
};
});
document.querySelectorAll("button[data-on-mouseup]").forEach(function(el) {
var fnName = el.getAttribute("data-on-mouseup");
if ( !window[fnName] ) {
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
return;
}
el.onmouseup = function(ev) {
window[fnName](ev);
};
});
}
// 'data-on-click-true' calls the global function in the attribute value with no arguments when a click happens.

View File

@ -619,7 +619,15 @@ function getControlResponse(respObj, respText) {
function controlCmd(event) {
button = event.target;
control = button.getAttribute('value');
console.log(event);
if (event.type !='mouseup') {
control = button.getAttribute('value');
} else {
console.log('stop');
console.log(event);
control = 'moveStop';
}
xtell = button.getAttribute('data-xtell');
ytell = button.getAttribute('data-ytell');