Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mousemove event dispatches when moving anywhere #2310

Closed
sktt opened this issue Jan 25, 2016 · 8 comments
Closed

mousemove event dispatches when moving anywhere #2310

sktt opened this issue Jan 25, 2016 · 8 comments

Comments

@sktt
Copy link
Contributor

sktt commented Jan 25, 2016

Greetings, thanks for a great tool...

I discovered that the mousemove event is fired even though the mouse movement happens outside of the targeted DisplayObject.. This may also be true for the touchmove event.

I assume it's only about checking if a hit occured and don't fire unless so..

Is this correctly assumed? Should I open a pr?

sktt added a commit to sktt/pixi.js that referenced this issue Jan 25, 2016
- Don't fire mousemove or touchmove unless hit is true
- Fixes issue described in pixijs#2310
sktt added a commit to sktt/pixi.js that referenced this issue Jan 25, 2016
- Don't fire mousemove or touchmove unless hit is true
- Fixes issue described in pixijs#2310
@kaariparamesh
Copy link

Some kinds of drap/drog wouldn't work if mousemove wasn't called while the cursor is outside the object though, for eg, imagine manipulating a control knob. Once the knob was clicked, it shouldn't let go until mouseup.

@sktt
Copy link
Contributor Author

sktt commented Jan 26, 2016

Valid point! But I'm not really sure if this use case justifies emitting
mousemove events on to all interactive displayobjects all the time...?

For your example it would actually be wiser to use the pointer lock api
https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API to fix
the position while mouse button is pressed. If you for instance look at how
ableton live handles their knobs, they actually do this.

Otherwise ux would be flawed anyway because if your window is small you'd
have to release and move the cursor back every time the it leaves the
window. on top of that the mouseup event will probably not even be captured
cause the cursor is not even inside the browser window anymore..
On Jan 26, 2016 05:28, "alclub" notifications@github.com wrote:

Some kinds of drap/drog wouldn't work if mousemove wasn't called while the
cursor is outside the object though, for eg, imagine manipulating a control
knob. Once the knob was clicked, it shouldn't let go until mouseup.


Reply to this email directly or view it on GitHub
#2310 (comment).

@NikkiKoole
Copy link
Contributor

"on top of that the mouseup event will probably not even be captured
cause the cursor is not even inside the browser window anymore.."

thats why there's a mouseupoutside,

here's a similar issue #1250

@sktt
Copy link
Contributor Author

sktt commented Jan 27, 2016

Since there's already similar issue I guess that has to mean that other developers are also surprised by the behaviour... It's however true that it can easily be checked for so its not really a big deal. I just don't think it makes sense. I could just as well put the mousemove listener to the root container itself

@NikkiKoole
Copy link
Contributor

No it's intended behaviour ;) it does make sense too imo, imagine you putting a mousemove handler on the root, it could work sure, but then you'd need to keep track of the currently dragging item in the root (to be set in the mousedown handler of the item), now imagine using touch and doing that for 10+ items ;)

Just set some property 'isDown' or something when you start a mousedown on an item, then in your mousemove do the moving and set the isDown = false in the mouseup(outside) of that item

@GoodBoyDigital
Copy link
Member

Hello! We have decided to offer the best of both worlds for this issue.
there is a new property in the interactionManager called moveWhenInside
Setting to true will make things work more in line with how the DOM verison works.
Setting to false will mean the mousemove and touchmove will be dispatched regardless of weather the cursor is over the object.

The default of this property is true. 👍

@sktt
Copy link
Contributor Author

sktt commented Feb 9, 2016

Thanks @GoodBoyDigital !
A small typo though.. #2347

@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants