Skip to content

Conversation

@PrismaticReflection
Copy link

With this "fix", I removed a workaround that was in the "Control::_update_canvas_item_transform()" function, that was making the scaling of a control node that has a pivot offset jump around, due to the "floor()" funciton being called on the position. I'll provide a video of the issue down below, which can also be "solved" by disabling "snap_controls_to_pixels" in the project settings, so the video is recorded in Godot 4.5, where I first found the issue.

I don't know what that workaround is for, after removing the line, I tried rotating, scaling and changing the pivot offset to check if there was any "flickering" as the comment above the workaround suggested, but I couldn't see anything. Maybe I'm wrong, and that workaround is very important, if that's the case, feel free to reject this pull request and I'll resign myself to disabling "snap_controls_to_pixels" as the solution.

Here is the video:

Bug.mp4

Thanks for your time, and sorry if this was unwanted.

@PrismaticReflection PrismaticReflection requested a review from a team as a code owner October 22, 2025 16:39
@AThousandShips AThousandShips changed the title Fixed janky scaling for controls with pivot offset. Fix janky scaling for controls with pivot offset. Oct 22, 2025
@AThousandShips
Copy link
Member

The video doesn't display what happens in the case that is referenced, can you please show how it compares when moving the pivot offset?

@PrismaticReflection
Copy link
Author

Here's a video of the version without the workaround in which I change scale, rotate, and change the pivot offset, both with the new pivot offset ratio and the normal one.

Bugpart2.mp4

And here is the same messing around in the version with the janky scaling.

BugPart3.mp4

I see no difference between the two, except the fact that when you mess with the scale when having a pivot_offset in the old version, it jumps around.

Hopefully this is what you meant, if not, let me know and I'll try again!

@AThousandShips
Copy link
Member

You didn't change the offset gradually, which is what probably should cause flickering, so please check that

@PrismaticReflection
Copy link
Author

My bad, here they are.

"Old" version:

BugPart4OldVersion.mp4

"Fix" version:

BugPart4NewVersion.mp4

@AThousandShips
Copy link
Member

AThousandShips commented Oct 22, 2025

I'm not sure what steps are required to replicate this but from the video I can't replicate the janky behavior, can you provide an MRP to test with or more detailed steps?

You mention the video is recorded in 4.5, can you test it with master without your changes? To make sure you're not fixing something that's already been fixed (and which is not fixed by your changes but not there regardless)

@PrismaticReflection
Copy link
Author

Here is an MRP for Godot 4.5 stable, just select the texture rect in the scene, and gradually change its scale to see it jump around in place due to the "floor()" function call. Go to project settings and disable "snap_controls_to_pixels" and repeat the gradual scalling to see the "fixed" behavior.
janky-scaling-mrp.zip

I did test it without my changes, and the issue was still there, but in any case, I'll provide here a video of the issue in the current master branch.

BugPart5.mp4

Let me know if I can provide any more info.

@AThousandShips
Copy link
Member

Can confirm with that MRP, however the behavior when moving with the pivot offset tool (the 6th button in the menu) is still janky, when not using snapping, though less so than before

@PrismaticReflection
Copy link
Author

PrismaticReflection commented Oct 22, 2025

Oh yeah, I didn't even remember about that tool, I'm guessing that looks "janky" because the pivot is snapping to the pixels, even though the controls aren't due to the disabled snap option, so when the pivot snaps to the pixel, it just moves the whole thing by "1 pixel" instead of gradually. Enabling the grid snap does the same thing but to the size of the grid sections.

So I don't think there's a real issue in that case? But I could be wrong of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants