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

Path.onMouseDown changes behavior of Path.onMouseUp #1247

Closed
Octember opened this issue Jan 31, 2017 · 2 comments
Closed

Path.onMouseDown changes behavior of Path.onMouseUp #1247

Octember opened this issue Jan 31, 2017 · 2 comments

Comments

@Octember
Copy link

Check out the following example. Click one circle, then drag and release on top of the other circle:

http://sketch.paperjs.org/#S/pZBNC4JAEIb/yrAXFUSs6GJ08hwE0Sk9rOuEi9usrKsdov/eiNY5cA7DfPG+D/MSJB8oMnFp0atGxELZeupH6aCTvoEjED7hzGWSa6cMhq+CgEMheXQZ3DZpGgOnMp4XTtZ66DPYp8vgro3JrbF8HFRGqjYo6B0dCiposkgsnezQ47Vjs/tAymtLIY6sH8Fi5hvdJz8dvgsc1sG0YalJ6Mu7/QN4twJ4Rt6uZuZPVw5l21lNvhfZrXx/AA==

The circle you released the mouse on top of will turn red, as specified in Path.onMouseUp()

Now, try the exact same example but with Path.onMouseDown() included:

http://sketch.paperjs.org/#S/zZI9C8IwEIb/ypGlCqVUxaXiVFdBECfrENPThsZLSdN2EP+7V/xAnBQXMxy5D56X97izIHlCkYh1iV4VIhTK5n3eSgeV9AXMgbCDFX+jVDtlcHDOCPgpJI8uge0ojkPgsAtvDSdz3dQJTON74aCNSa2xPBzsjVRlkNFlOMsoo14isrS0TY0L2xHLHRpSXlsaYMsKQ7jL+ULX0ZPEc8HRIVLQ9xj3DttU36Ac5q+gh/nxB+4n/+L+hhv/vAC+gb1DWVZWk69Fst1drg==

The behavior changes: onMouseUp fires for both circles.

Curious if this is intended behavior or not. I'm guessing not, it seems to break what the API specifies.

@lehni
Copy link
Member

lehni commented Mar 8, 2017

Yes I agree, this is strange. I need to look into what's causing it. Thanks for spotting it!

@lehni
Copy link
Member

lehni commented Mar 8, 2017

I think the only situation where this behavior makes sense is when an item defines a onMouseDrag() event. Then I would expect to receive the onMouseUp() wether it is inside or outside of the item (this is also the case why it was implemented it in such a way). This can be easily fixed.

@lehni lehni closed this as completed in e145b1d Mar 8, 2017
lehni added a commit that referenced this issue Mar 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants