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

Gestures event issue - No offsets management #1646

Closed
ystreibel opened this issue May 28, 2015 · 7 comments
Closed

Gestures event issue - No offsets management #1646

ystreibel opened this issue May 28, 2015 · 7 comments

Comments

@ystreibel
Copy link

Hi,

When we try to use the x, y coordinates given by gestures event, we have noticed that the values do not take offsets in account.

You can find a sample code at https://github.com/ystreibel/my-canvas and the working demo http://ystreibel.github.io/my-canvas/components/my-canvas/demo/

This issue seems quite important, Could you please fix it up as soon as possible ?

Thanks.

@dfreedm
Copy link
Member

dfreedm commented May 28, 2015

I don't understand what you mean by "offsets". Can you explain a bit more?

@ystreibel
Copy link
Author

Yes, try to draw on the yellow my-canvas components at http://ystreibel.github.io/my-canvas/components/my-canvas/demo/
Click down and move to the top. You can see a difference between your pointer position and the drawing point.
This difference is due to the first my-canvas conponents heigth (=offsets).

@dfreedm
Copy link
Member

dfreedm commented May 28, 2015

Ah I see. What I would recommend you do is use downEvent.sourceEvent.offsetX and offsetY to find your starting point and use offsetX + trackEvent.detail.dx and offsetY + trackEvent.detail.dy to draw your line.

@ystreibel
Copy link
Author

I don't understand why the x,y coordinates are not computed by the topleft corner of the component.
More other, why they are not the sourceEvent on the trackEvent ?

@dfreedm
Copy link
Member

dfreedm commented May 28, 2015

sourceEvent was missing on the track events, I added them here: 5fb2ef3

Making x/y the topleft of a node requires using getBoundingClientRect, which will can cause a synchronous layout and be very expensive and slow.

@ystreibel
Copy link
Author

Cool for sourceEvent on trackEvent, thanks !
Ok, I understand for getBoundingClientRect.

@kevinpschaaf
Copy link
Member

Closing, with @azakus's sourceEvent fix there is enough information to calculate the screen position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants