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: 151
Joined: Sun Jun 05, 2016 2:53 pm

onmousedown and onmouseup implementation in control scripts

Post by alabamatoy » Mon Mar 13, 2017 8:45 pm

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: 151
Joined: Sun Jun 05, 2016 2:53 pm

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy » Mon Jun 05, 2017 12:44 am

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: 151
Joined: Sun Jun 05, 2016 2:53 pm

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy » Mon Nov 13, 2017 3:49 pm

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: 737
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: onmousedown and onmouseup implementation in control scripts

Post by iconnor » Tue Nov 28, 2017 11:52 am

I think on mobile it uses a different action called ontouch

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

Re: onmousedown and onmouseup implementation in control scripts

Post by alabamatoy » Wed Apr 10, 2019 1:39 pm

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.

User avatar
james37
Posts: 1
Joined: Tue Apr 16, 2019 7:50 am

Re: onmousedown and onmouseup implementation in control scripts

Post by james37 » Tue Apr 16, 2019 8:04 am

Everywhere there is a "onmousedown" there needs to be also a "ontouchstart", and everywhere there is a "onmouseup"
alabamatoy, well actually it is not always. Sometimes it should be combined with "mousedown" pressed first. We had the same problem, but only on mobile platforms, and after all we've decided to rewrite our code to match up with our mobile customers, and we simply thought about website development costs, as well as would it be worth at all or not. And fortunately, we found a great developers team, whom offered us a lot of options to choose, with different features, and prices as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests