Skip to main content
Question

Within some frames with auto layout, elements are placed with strange rounding to 2 decimal places


Hi guys,
I am experiencing some problems in using the auto layout that I have never had. Some elements are being placed on the x-axis or y-axis with an approximate value to 2 seemingly anomalous decimal numbers.
I give a practical example to clarify.

Already from this image it can be seen that the height of the element is not precise. Hence my investigation.
Let’s open the autolayout to see the various elements:

  • The image has integer values such as height and width, and the positioning on the x- and y-axis is consistent with the auto layout padding.
    Let’s move on to the next element.
  • The text has integer values such as height and width but the x-axis positioning has a strange value of 23.62 which does not respect the auto layout padding.
    Let’s look at the last element.
  • The text has integer values such as height and width but the y-axis positioning has a strange value of 283.99 that does not respect the sum of padding, heights of sibling elements, and the gap between elements.

I would only like to understand if it is an error on my part or a Figma problem that could be fixed in the next updates.
I hope I have managed to explain myself and thank you in advance for any answers.

6 replies

  • Figmate
  • 1763 replies
  • March 14, 2024

Hey @Riccardo7, Thank you for bringing this to our attention! I really appreciate you sharing the screenshot and your efforts in troubleshooting. I understand that it might seem a bit unusual.

Based on your explanation, it appears that the Auto layout frame’s height is set as a decimal value(361.99), despite the settings as below. Please let us know if I misunderstood anything!

  • Within the Auto layout frame, there are an image and two text objects.
  • These objects have integer values for the dimensions (X, Y).
  • The auto layout frame resizing settings are set to [hug] both horizontally and vertically.
  • The padding and gap within the auto layout are integers.

I tried to replicate the issue on my end but haven’t been able to do so yet. I will consult with my team internally to see if we can provide further assistance on this matter. We will keep you updated once we have more information.

We also welcome any insights or suggestions from our community!

Thank you,


  • Author
  • 4 replies
  • March 21, 2024

Hello,
Sorry I am only responding now.
I confirm the information you described. I would add that:

  • The texts have width “fill” and height “hug”;
  • If I change the width of the texts from “fill” to “fixed” (without changing the value), they are positioned correctly with respect to the padding. However, the final width of the container remains with a float value that I do not understand.
  • If I try to change the height of the texts from “hug” to “fixed” nothing changes.

Thanks for the support.


  • Author
  • 4 replies
  • March 21, 2024


  • Author
  • 4 replies
  • March 21, 2024


  • Author
  • 4 replies
  • March 21, 2024

Sorry for the many replies but as a new user I could only post one schreenshot at a time


  • Figmate
  • 1763 replies
  • April 3, 2024

Hi @Riccardo7, Thank you for getting back to us. I really appreciate you sharing those screenshots. I apologize for the delayed response.

I tried to replicate the issue but wasn’t successful. However, after looking into it internally, I found two settings that might help prevent the frame property from displaying decimals for pixels.

Snap to Pixel Grid
Enabling the ‘Snap to Pixel Grid’ setting, it should align objects to the underlying grid when placing or moving them.
You can find more details here: Snap to pixel grid

Round to Pixel
Select the top-level frame, go to the main menu, and choose Quick Actions. Then, search for “Round to pixel”.
image

I hope these information help! If not, could you please provide a quick video recording of the issue you’re facing? Showing the full Figma screen, including the left and right panels, will help our community visualize the problem and assist us in reproducing it for further investigation.

Alternatively, I came across some plugins from our community that might be able to assist you:

Additionally,I found a feature request from other community members regarding decimal pixels here:
​​Preventing Resizing to Decimal Pixels
Feel free to check it out.

Hope to hear from you soon!

Thanks,


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings