onmousedown and onmouseup implementation in control scripts

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

onmousedown and onmouseup implementation in control scripts

Post by alabamatoy »

I would like to have onmousedown (click and hold) and onmouseup (let go of click and hold) actions passed from the camera control interface to the control scripts. Clicking the "up" arrow repeatedly in order to make the camera tilt up one tiny increment at a time is a PITA - it would be nice to tilt up continuously for onmousedown and keep tilting until onmouseup. Obviously same for left/right and zoom/tele.

If this is already implemented, I couldnt figure out how to capture it with the control script, all I could figure out was a arrow click. If its *not* implemented, is there a reason? I will try to modify the included view file to see if I can make it work, unless someone else is already chasing this.

???
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy »

I have this implemented if anyone cares. It only works with my Amcrest PTZ cameras control script, but the changes to other control scripts shouldn't be that difficult. It requires replacement of the CSS control "include" file along with a new version of the control script.

This allows "press to move, release to stop" type mouse functionality for left/right/up/down and tele/wide controls.

I would like to see an option, perhaps, in the config which would allow selection of this functionality....but I dont know how to code that.

I will post the code if anyone wants it.
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy »

Just talking to myself again...

Apparently onmousedown and onmouseup do not work on Android, at least not in any browser I have yet found. For more info, see https://stackoverflow.com/questions/475 ... on-android

So this whole press-and-hold-to-pan approach doesnt work on an Android. Works nicely on a PC, though.
User avatar
iconnor
Posts: 2881
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: onmousedown and onmouseup implementation in control scripts

Post by iconnor »

I think on mobile it uses a different action called ontouch
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy »

iconnor wrote: Tue Nov 28, 2017 11:52 am I think on mobile it uses a different action called ontouch
The handheld controls appears to be a fairly easy fix. Everywhere there is a "onmousedown" there needs to be also a "ontouchstart", and everywhere there is a "onmouseup" there needs to be also a "ontouchend".

So, for example, in the CSS for the tele/zoom function ("control_functions.php" file) we have:

Code: Select all

<div class="arrowControl zoomControls">
  <div class="arrowLabel"><?php echo translate('Tele') ?></div>
  <div class="longArrowBtn upBtn" onmousedown="controlCmd('<?php echo $cmds['ZoomTele'] ?>',event,0,-1)" onmouseup="controlCmd('<?php echo $cmds['ZoomTeleStop'] ?>',event,0,-1)" ontouchstart="controlCmd('<?php echo $cmds['ZoomTele'] ?>',event,0,-1)" ontouchend="controlCmd('<?php echo $cmds['ZoomTeleStop'] ?>',event,0,-1)"></div>
  <div class="arrowCenter"<?php if ( $monitor->CanZoomCon() ) { ?> onclick="controlCmd('<?php echo $cmds['ZoomStop'] ?>')"<?php } ?>><?php echo translate('Zoom') ?></div>
  <div class="longArrowBtn downBtn" onmousedown="controlCmd('<?php echo $cmds['ZoomWide'] ?>',event,0,1)" onmouseup="controlCmd('<?php echo $cmds['ZoomWideStop'] ?>',event,0,1)" ontouchstart="controlCmd('<?php echo $cmds['ZoomWide'] ?>',event,0,1)" ontouchend="controlCmd('<?php echo $cmds['ZoomWideStop'] ?>',event,0,1)"></div>
  <div class="arrowLabel"><?php echo translate('Wide') ?></div>
This works, verified a few minutes ago.

But the whole phone use of this thing is pretty wretched....or maybe its just my sausage-sized fingers. I have to super-stretch the display to be able to finger the up arrow or down arrow reliably, which totally dorks the video. So you stretch, do what you need to do, then pinch back.
Post Reply