Unable to get ralative coordinates of an element. #472
Replies: 3 comments 3 replies
-
You're not using the latest version of use-gesture. |
Beta Was this translation helpful? Give feedback.
-
Well, could you show me how to do it then? I've tried for hours and asked on SO... Thanks |
Beta Was this translation helpful? Give feedback.
-
Well in your example, you have the position of the element due to the fact that it starts in the center of the screen, and the drag values relative to that start are measured. Unlike the example, what if you were to have an element which gets created in a random part of the screen (i.e. you don't have access to the position in the screen or the dimensions of the element). That's what I'm trying to get around. If you have a look at each sandbox I posted, you'll get the idea. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I was trying to recreate the card effect as displayed here, but noticed, that if you want the element to actually be used in a website, you don't have access to its x and y position (I created an example of what I mean here). I found a workaround using the
onMouseLeave
andonMouseMove
events, but would be nice if you could integrate it into theuseMove
function.Sandbox or Video
My take on it
Information:
Beta Was this translation helpful? Give feedback.
All reactions