Inconsistent UI Scaling Rounding (1 pixel offset?)


The elements are contained in a frame. The top and bottom middle elements have a scale of .5 on y
The left and right elements showing score have a scale of 1 on y.
Logically this would mean the height of the left and right elements would = the 2 middle elements together but depending on the screen’s Y size there’s sometimes this pixel offset. If you change the Y screen resolution you’ll see it go from correct, offset, correct, offset

This shouldn’t be the case.
video displaying the inconsistent scaling:

5 Likes

This should be a Client Bug report, and personally I wouldn’t rely too much on Scale over Offset when it comes to sizing and positioning adjacent guis. On a side note, how come you are using several backings instead of one continuous background for the whole frame?

1 Like

My bad, its fixed.
Scale is very very convenient for positioning/sizing things just how I want them tbh and still getting good scaling across resolutions. With anchorpoint I now use offset very little.

Personally for organization I have this whole UI section in a frame then the score is in a frame positioned to the left and right of the parent frame. the clock frame positioned to the top middle of the parent frame and the round status to the bottom middle. (This also allows for easy UI manipulation for FX when the server tells the client the game status) oh and it makes well for applying things like UI padding to very specific elements.

I believe this is to do with the fact that 0.5*height of screen will not be an integer value for odd numbered window heights. A window 1001px height would result in the size of the UI being 500.5px and so it rounds.

That said I’m not sure why the two UIs on the left and right would not be subject to the same issue (and all round to the same value) but this is the explanation I’ve been given in the past.

Yep now that I look at the Y absolute size when its inconsistent for example - the height of the frame is 57 pixels.
The 0.5 elements are 29 pixels which 29*2 = 58

When its even in an example the total height is 56 and the 0.5 frames are 28 and 28*2 = 56.

Still, I wonder if there is a possible fix for the rounding issue?

It might be possible to resolve this by rounding the corners of the rectangle instead of separately rounding the position and size. However, I’m not sure this will fix all cases.

I’ve noted it down though. I will add a unit test for this and see if I can fix it as part of my internal refactor of the gui system, which should ship early next year.

6 Likes

I have an update on this. I added a unit test and I have found a fix which works for at least this particular case. But as I mentioned, this is unlikely to ship this year.

6 Likes

Any update to this? ETA on when it’ll ship?

1 Like