Stop autocorrecting my SliceCenter input

As a Roblox developer, the auto-correct feature used on the SliceCenter property of GUI image objects is annoying and inaccurate.

If the value of certain parts of the property is 0, whatever gets individually inputted into the property gets moved to where the code thinks it should be.

Often I am just experimenting with SliceCenter, but it becomes impossible to input a value at, say, <new value>,0,0,0. It will just be autocorrected to 0,0,<new value>,0.

I understand this behaviour is meant to somehow make this easier for people, but I really don’t see why. I expect my values to be where I put them. I don’t care if I’m wrong, because it’s even more confusing when they aren’t where I put them.

If for whatever reason it’s still important, at least make a toggle to disable it.

10 Likes

Does this apply anytime you put a larger number in the slot where the smaller number is supposed to go? I don’t think it’s specific to 0, but just the fact that your slice center can’t be inverted.

2 Likes

Oh yeah, just tested and it does it for larger numbers too

This isn’t specific to SliceCenter, but the data type it uses. SliceCenter uses the Rect data type, and its constructor is sensitive to the relative size of its arguments. The constructor is:

Rect(minX, minY, maxX, maxY)

If you don’t put the min values where they’re supposed to, Roblox will adjust the Rect because it’s required for the min values to be before the max values.