Parabeac/parabeac_core

Interpretation of constraints inside AutoLayout

ivan-015 opened this issue · 0 comments

Description

In the Figma UI, children of AutoLayout Frames have a couple of options when it comes to resizing. Most commonly, those options are FILL and FIXED sizing.

These sizing options, however, do not go into the normal "constraints" property of a Figma object. Rather, they go to LAYOUT_ALIGN and LAYOUT_GROW properties.

Take the following image, for example.

image

Its vertical and horizontal constraints are set to FIXED, which means it shouldn't change sizes as the frame scales up/down. However, in the Figma JSON object, we have the following:

image

Figma exports the constraints as SCALE both vertically and horizontally.

Since parabeac_core exports exactly what Figma tells us, we export the following:

image

This is because Figma told us to scale both images.

Goal

The goal of this task is to define the rules to overwrite the constraints of objects with Layout Grow and Layout Align properties. This should likely be done inside of PBDL, since the rules come from Figma itself, so they should be adjusted so that PBDL exports the correct constraints.

Test

A good golden test for this rule could be the two images that are set to FIX in Figma. The expected output shall be that they are actually fixed in constraints instead of using MediaQuery.