Changing ScrollingFrame CanvasSize changes the CanvasPosition

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.


CanvasSize: 0,500
CanvasPostion: 0,100

CanvasSize: 0,600
CanvasPostion: 0,120

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.

Agree. Hope they fix/change this soon because its ruining the current project I’m working on.

“its ruining the current project I’m working on.”

It’s pretty easy to work around if you really need it:

local LastCanvasPosition = scrollingFrame.CanvasPosition
local LastLastCanvasPosition = LastCanvasPosition
    if prop == 'CanvasPosition' then
        LastLastCanvasPosition = LastCanvasPosition
        LastCanvasPosition = scrollingFrame.CanvasPosition
    elseif prop == 'CanvasSize' then
        LastCanvasPosition = LastLastCanvasPosition
        scrollingFrame.CanvasPosition = LastLastCanvasPosition

I’ll take a look into this


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.

I tried it but still it didn’t work. The code I tested it with:

I have checked in a fix for this. Should see a fix in the next couple of weeks on production