Move To Cursor not correct in dynamic panels

Moving an [object] to ([[Cursor.x]].[[Cursor.y]]) within a dynamic panel doesnt work as expected. It actually gets the x and y, but adds the distance the parent dynamic object sits from the main stage 0,0.

RP file: MoveToCursor.rp (58.7 KB)

You will see that the first box is 25x25 from top left, and the dot is 25x25 from the cursor. The second box is 300x300 from top left and the dot is 300x300 from the cursor.

I don’t want to -25 or -300 as I want this to be part of a widget that can be placed anywhere on the screen. Any ideas?

P.S. I tried a boundary with limited success.

This is because the built-in variable, [[Cursor]] returns the screen viewport position of the mouse pointer, regardless of what is in your prototype. So, it is actually working correctly.

If you want the position of the cursor relative to your widgets, you will have to do some math, and there’s no way around that. You can use variables in these calculations however, so your code can be flexible and reusable.

See this version of your demo:

MoveToCursor2.rp (116.5 KB)

I included several variations for tracking the cursor location and placing the cursor dots.

1 Like

Thank you mbc66! Method 4 seams the best for my needs.

I understand the built in variable, however I wish Axure would consider changing this to suit the objects canvas (in this case within the dynamic panel)

1 Like