-
February 2nd, 2009, 04:15 PM
#1
onmouseup not recognized if mouse moves
I'm writing a tracing program in JS to drawline from where the mouse is pressed, held while its moved and then released. The onmouseup function is NOT called when the mouse is moved away from the location where it was pressed. It is called if the up is at the same location as the down. A workaround I've found is for the mousemove function to exit when a key (control or alt) is pressed as that is recorded in the event property.
Is there a way for mouseup to be recognized when the mouse has moved from the down location?
The tracing is over the top of a large image of a map. The purpose of the program is to measure distances on the map for various trips.
Thanks,
Norm
Norm
-
February 2nd, 2009, 05:36 PM
#2
Re: onmouseup not recognized if mouse moves
I would suggest registering the mouse events with the document object.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
February 2nd, 2009, 08:50 PM
#3
Re: onmouseup not recognized if mouse moves
Meddle not in the affairs of dragons, human, for thou art crunchy and taste good with ketchup.
-
February 2nd, 2009, 08:59 PM
#4
Re: onmouseup not recognized if mouse moves
Well, it's slightly more than just that. Remember to use document.addEventListener for non-IE browsers and document.attachEvent for Internet Explorer.
Last edited by PeejAvery; February 4th, 2009 at 03:28 PM.
Reason: Fixed BB code.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
February 4th, 2009, 03:14 PM
#5
Re: onmouseup not recognized if mouse moves
Thanks.
I was also having a problem with the design. Holding the mouse down while moving it was being interpreted as a drag. I changed the design to use a mousedown to start, mousemove to trace and another mousedown to end the trace. It's now working.
Norm
Norm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|