Padding doesn't update when changing to freeform


#1

Summary: When adding padding to a layer and then changing the layer to freeform the padding property ignores any further changes. When changing it back to computed padding continues to ignore new values.

Version: MacOS 0.0.0+3f2bab9

Steps to reproduce:
1. Create new layer
2. Create text layer as child layer
3. Adding padding of any value to parent layer of text
4. Switch to freeform mode on parent layer
5. Edit value of padding on parent layer

Result: Editing the value of padding is not visible in the graphical preview

Expected outcome: Changing the value of the padding for a shape when in freeform should change the padding in the graphical preview, or at the least allow the padding to be changed when switching back to computed.


#2

Hi @sevenupcan,

Padding is an invisible property of a box that affects two things: the layout of its children and the auto size of the box (e.g., if a box has a 10px wide child and padding left = padding right = 20px, then the "auto" width of the box will be calculated as 10 + 20 + 20 = 50px)

Also: Only boxes and artboards (but not text) can have padding, since the former can have children and text cannot.

So for your steps, I'm interpreting #3 to mean that you are adding padding to the box you created in step #1. But #4 is ambiguous --- are you converting the box to freeform or are you converting the text to freeform?

I'm also not sure what you mean by "does not change the padding of the shape".
Please clarify.


#3

Hi @kevin

I've edited my post to clarify the steps to reproduce the problem. Basically editing padding on a layer after changing it to freeform has no effect.


#4

I'm still not sure what you mean when you say that changing the padding on the parent "has no effect".
What are you expecting to be affected?

Say you create a box, then add a text child to the box.
When you add a top padding of "50" to the box, the box height changes to 64 (50 padding + 14 automatic height of default text child).
Now switch the box to freeform --- this sets the box's height explicitly as "64" (switching from computed to freeform sets an explicit width/height on the box).

Now when you remove the padding nothing happens.

  1. If you expected the box height to get smaller, this doesn't happen because an explicit height was set.
  2. If you expected the text to change position, this doesn't happen because the vertical alignment "middle" setting in child layout doesn't take padding into effect.
    (Setting it to "top", though, would take padding into account, and the text box would be "padding-top" away from the height of the parent.)

The overall behavior and UI of the layout engine is pretty complex, and redesigning it is a high priority for us.
We'll be talking more about that in another topic in the next few weeks.


#5

This is incredibly frustrating. I'm just talking in the language I know so I'm sorry that I cannot explain the issue to you in a way that you understand. I feel like I'm stupid and I'm what I'm trying to explain is wasting your time because Subform works the way you think it should.

I would have expected the padding to either a) change the height of the box in freeform mode (but you have confirmed that this is not the way you have configured subform, fair enough) b) the padding box be disabled to show that changing the padding on the layer has no effect in freeform mode, or c) changing the padding after switching back to computed mode should change the height of the layer.

There is a bug in there somewhere.


#6

Hi @sevenupcan,

I'm not trying to be dense, and my apologies that things are frustrating right now.
Ryan and I are looking into redesigning the layout engine to avoid these kind of frustrations.

To answer your points:

Yep. If you want padding to affect the height of the box in freeform mode, you can remove the height value from the box, and then the "auto" height will take padding and children height into account.

The padding values still have an affect on the placement of computed children within the parent, regardless of whether the parent is in freeform or computed mode.
So they still need to be accessible.

Same explanation as the first --- padding will affect the parent size if the parent width/height is blank ("auto mode").

Agreed, we will be redesigning the layout engine over the next few weeks to make the semantics clearer.
Sorry for the frustration, and I do appreciate that you took the time to explain what was happening and your expectations.
It is exactly these sorts of conversations that Ryan and I setup the forum to have.

If we ever run into each other in person, please let me buy you a beer.


#7

Ah I see. So when you change a layer to freeform mode, it explicitly sets the height and width, and then when you switch back to computed mode it keeps these explicit widths and heights which you have to remove if you want the layer to rely on the padding for it's height and width.

Next time I'll try and upload a video of the problem the issue. Maybe that will help.

Thanks for your patience and I'll be sure to take you up on that beer if ever do bump into each other! :slight_smile: