Offset of hypeGestureXPosition and hypeGestureYPosition

Hi guys,

At the end of a Drag gesture, I check the hypeGestureXPosition and hypeGestureYPosition to see if they fall in a predetermined target area.

However, these values change if I resize the browser window.

How can I get the offset that is added to hypeGestureXPosition and hypeGestureYPosition ?

Many thanks.

It sounds like you may need to capture the location of the initial drag action, and do addition or subtraction to determine the offset based from hypeGestureXPosition and hypeGestureYPosition.

There are a few threads on dragging / dropping that might provide code hints for this workflow: Drag and Drop for simple Quiz & the DragDrop tag.

Wow ! 10 minutes for a feedback : this is amazing ! Thanks !

By looking at the code bits you pointed out, I found the problem :

I relied on the getElementProperty() function to get the bounds of the ‘landing zone’ rectangle area, instead of the getBoundingClientRect() function.

The first returns relative coordinates, the second returns absolute coordinates which are in the same referential as the hypeGestureXPosition and hypeGestureYPosition values.

Thank you again and keep it up - this is a marvelous and incredibly powerful software.

1 Like

Glad you were able to discover the difference. The getElementProperty() API is meant to hook directly into Hype’s runtime as far as its view on properties before flexible modification. Also this came out in 3.5 vs. the gesture position properties which were 2.0 or 2.5 I believe… if I were to redo it they might have the same coordinate space since it is clearly inconsistent.

Maybe the easiest way for a fix in a future version would be to add relative versions of the hypeGestureXPosition and hypeGestureYPosition methods so everything takes place in the same referential.

1 Like