OnMouseMove - Move child object based on parent coordinates?

I’ve been wrestling with this for a bit, and was hoping to get advice on how to achieve this effect. The attached screenshot best shows what I’m trying to do (hard to explain).

Basically, I have a parent dynamic panel as a container, and OnMouseMove, it moves a child dynamic panel of an image within it. I am able to move the child DP to follow the cursor in the parent DP.

However, I’m at a loss on how to move the child based on the parent coordinates (the right three thumbs in the screenshot). I’ve tried setting the “origin 0,0” to the middle of the parent, but getting stuck with the child to match up – not even sure if this even the right approach…

Any help is greatly appreciated. Thank you!

Hi @daleskim,

Here is an approach to start with.
My solution consists of a dynamic panel and an image in it.
OnMouseMove when the cursor is on the area of DP, I use Move action on the image.

Take your mouse over the image and then to left-top and right-top. I think it is what you wanted.
You have to figure out the logic of how your image will move.
I have created a simple one with my logic.

Check out the POC below. Let me know if you do not follow anything. I will try my best to help you
ImageExplore.rp (65.9 KB)

Thanks for the feedback. I found a solution that I think maybe the simplest way to do it – definitely would like to learn how to make it better.

For simplicity sake, make the child DP 2x the size of the parent. OnMouseMove on the parent DP, move the child DP to [[(Cursor.x - Parent.x) *-1]], [[(Cursor.y - Parent.y) *-1]]. The negative multiplier was the “thing” that I was overcomplicating earlier, but basically it moves the child DP the opposite direction/displacement.

Hope this helps someone else looking to get the same effect.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.