‘widget to centre’ brings up stuff about anchors.
It was pointing you in the right direction; with no proper anchoring you’ll need to constantly translate Absolute to Local and account for viewport size / resolution and so on.
This can be done in a much simpler way.
- I’ve got this nested canvas with some points of interest:
That’s how usually map dragging / panning is done (at least around here)
- the Inner Canvas is anchored to the centre of the screen:
Ctrl + Shift click the middle bit so you do not need to punch in values manually.
- the same is done for the Points of Interest on the map:
You can now move those elements around in relation to the centre of the Inner Canvas. If you’ve already positioned the POIs, you will need to redo it as adjusting anchors would shift them out of place.
- with this in mind, the math for moving stuff about becomes simple:
we only need the POI’s offset from the centre of its canvas - called Pixel Shift Request
here
When it comes to actual animating the movement, you have options. You could interpolate as above, you could use a timeline in the underlaying blueprint, or you could use a widget animation which is already a timeline.
When the user attempts to drag the canvas manually, close the gate / stop the update.
The best part is that you do not need to worry about resolution, aspect ratio and all that jazz:
Widgets have repeaters:
It can be used to perform a data driven animation. This way you do not need to depend on Tick + Interp + Gate control and make it time based instead.