I’m not sure if this is supposed to be a bug or a feature, but it acts really weird and ruin things up when the CanvasSize keeps increasing and the CanvasPosition doesn’t stay stable but moves with it.
The CanvasPosition is stable only when its zero but not when its more. It’s probably a bug.
I believe it’s a feature. When you change the CanvasSize, the CanvasPosition changes to where the percentage you had scrolled down before the scaling is the same after the scaling – in essence, the scrollbar stays in the same place.
IMO it’s a pretty crappy feature – just because the scrollbar is in the same position doesn’t necessarily mean that the content pre-scaling is in the same position post-scaling.
I tried something like that but it still didn’t work for some reason. (saving previous position and set it again when CanvasPosition changes via CanvasSize).
Edit In the case I’m doing, the CanvasSize is always increasing and the user should be able to scroll smoothly in the frame.
“I tried something like that but it still didn’t work for some reason.”
Try the code I posted. There’s a slight gotcha in that the Changed(CanvasPosition) due to the size change fires before the Changed(CanvasSize). That means that if you’re using only a single “LastPosition” it will get clobbered by the Changed(CanvasPosition) before you even know that a Changed(CanvasSize) is happening and that you need to fix the position as a result. So, you actually need two cascaded “Last” positions.