Cursor X and Y always returns 0

Dominik shared this problem 3 years ago
Solved

Hi there,


I created a simple text element, added a "tap" interaction, choose "Set Value" and "Calculated" using the expression "Cursor X" (as in the provided constant).


However, no matter where on the text element I click the value is always set to 0.


Replacing "Cursor X" with "Random", for example, works just fine: the text element displays a different random number on each click.


Any idea what the problem could be?


Thanks,


Dominik

Comments (8)

photo
1

Hi Dominik,


This is happening because the interaction "On tap" is simulating a finger and not a mouse cursor. The behavior is different.


Best,


Sonia Durán

photo
1

Hi Sonia,


Thanks! How do I get the location of the (simulated) finger, though?


On mobile, I don't have a cursor. All interactions are triggered by taps (i.e., fingers). Still, I need to know where on the screen the user is interacting (tapping, dragging, etc.).


Given there are already cursor coordinates (for desktop prototypes), wouldn't it make sense to also have tap coordinates (for mobile and tablet prototypes)?


Thanks,


Dominik

photo
1

Hi Dominik,


This makes sense. I will transfer your suggestion to our development team.


Best,


Sonia Durán

photo
1

Cool, thanks, Sonia :)!

photo
1

Hi Dominik,


I'm happy to inform you that this issue has been resolved on our last 7.1.0 update.


Best,


Sonia Durán

photo
1

Thank you :)!

photo
1

What about getting CursorX and CursorY values on drag?

photo
1

Check out the attached prototype to see how to do this.

photo