how to get relative position of GUI, after a zoom in

Yo I made this chunk of nodes which deals with the scrolling up and down of my canvas which contains various widgets.

I can press the up and down arrow keys and its steps through my widgets, centering each one by scrolling down the canvas. The start and end position of the translation is fed into ease in / out anim.

I have also placed the vertical scroll window within another canvas which deals with zooming. So I can both go up and down and zoom in and out when I want.

The issue is if I zoom in once and then try and press up or down to scroll, all of the coordinates are now messed up, because it doesn’t take into account the new zoom coord space.

Does anyone know a way of making the zoom influence the translation coordinates of the scroll?

thanks, Sam

You could take this apart:

The script and the description of how it works is in the thread. Relevant image:

I have also placed the vertical scroll window within another canvas which deals with zooming.

The suggestion above is using 2 nested canvasses instead.

Hey thanks Everynone, yes I already had this scene open on my comp and I got a little lost with how everything connected. I think fundamentally I don’t understand the different methods to sample the resolution and position of the object relative to the viewport.

I will take another look at this setup and see if I can get to grips with it.

thanks,
Sam