Auto-layout (fill container) should respect snap to pixel grid

For example, if I have 3 horizontal child containers with “Fill Container” constraint, they will divide their width by 1/3 pixels (Width: 16.33px) if inside an odd pixel number parent container. So now any element inside that child container is not able to be spaced according to it’s container unless manually typing sub-pixel x-axis placement. Very arduous and tedious workaround.

I’m not sure there’s an elegant solution to this outside of simply making one of the child containers 1 less pixel than the others. Does anyone else struggle with this?

EDIT: After further testing, I’ve realized that layout grids currently work in this way and auto-layout does not. This causes misalignment if using both of these methods in a frame (auto-layout modal within a parent layout grid frame)

6 Likes

Totally agree! It happens with me all the time

It would be great. For now, it’s kind of messy. :slightly_frowning_face:

I am struggling with this issue and the worst part is that when a resource is exported its measure is not the expected.
For example: 3 tabs, each tab with icon + text. The measure of the icon is 16x16 but when exporting is 17x16. Moreover when it is exporte x3 a side part of the icon is cut.

I think is not necessary that visually we are able to see the icons in the right place but at least the exportation should be correct.

Meanwhile I have to provide this icons to the developer team isolated so they can export them correctly.

Hope it is fixed soon.

I’ve run into this too. It seems that any node that is not positioned on a whole pixel - rounds up when it gets exported.

1 Like

Yes, please!

Same here.

It’s annoying and messy when the auto layout (fill container) values aren’t matching the layout grid.

I think that retaining sub-pixel values in the live design artifact makes sense, but I would like it if there was a toggle for whether shapes should be rounded to the nearest whole-pixel during export (for example to png). This should also be reflected in pixel preview mode.

This is very important when designing for the precise resolution of a specific display. If I set the resolution of my design frame to match the display I’m designing for, I expect that to mean that 1-pixel wide lines should fall directly along a line of pixels in the final rendered image (at least for certain design applications).

I imagine that this could only be done near the very end of the layout process. If one box fills the width of the screen, and then 5 child boxes fill the space inside that box, and 3 more levels of nested boxes each fill their parent boxes, it will get really ugly really fast if each nested division rounds to the nearest whole pixel. But once all of the lines have landed in their sub-pixel defined destinations, I would like to have them snap to whole pixels when I export.

1 Like