Incorrect default spacing label for stack layouts with partially specified "betweens"


Hi folks!

I’m using Subform 4449.0.0 1a76794 on Darwin 16.7.0 and noticed an inconsistency between the behavior on the canvas and the default values show in sidebar labels.

Here’s the setup — default artboard, with two default children, and the artboard’s main-between value set to 50px:

  1. Select the first child and change the “space after” to 20px:

This causes the space between the elements to be 20. However, if you then select the second child, you see that it its “space before” is still shown as a default value of 50, though it is actually now effectively zero:

My understanding is that the behavior is intentional and useful, but the label doesn’t take it into account and always shows the underlying parent value when the child’s value is missing.

The symmetric case for space-after also applies — if you set the space-before on the second child then the space-after on the first child shows 50 despite being effectively zero:

Subform’s layout model is wonderful — I actually noticed this behavior while implementing the layout model in Julia to see if it is as elegant in implementation as it is intuitive in use. :smiley:


Hi @yurivish, thanks for writing and it’s cool to hear you are trying to implement Subform’s layout engine in Julia — you have plans for complex charts and graphics?
I did a spot of Julia a few years ago, and it’s a cool language; the method dispatch mechanism in particular solves a longtime OO pet peeve of mine w.r.t. “where” inter-type relationships (like matrix/scalar multiplication) should live.

Anyway, about your question on the labels: This is something that I noticed myself and don’t quite like, but I’m not sure about how to fix it.
Maybe you can help.

The case you brought up does feel weird, and it does seem like the placeholder label should be “20” (the preceding sibling’s space after) rather than “50” (the parent’s default space between).

My problem is that whatever this placeholder shows — 50 or 20 — the semantics implied by the placeholder label aren’t actually followed.
That is, if you type a new value, say 5, then the space before won’t actually be 5, but rather 20+5.

When designing the engine we considered some other behaviors (like having the first sibling’s “after” space and second sibling’s “before” space inputs actually be tweaking the same value), but we settled on the current behavior because we thought it’d be the easiest to internalize.

Anyway, that was how far I got thinking about this before deciding to ignore it and hope that a better solution would crop up later.
But perhaps I’m overthinking it and should just change the placeholder value to show sibling-defined spacing rather than the parent default when one exists.


Hi @kevin, one way to think about the placeholder label is that setting the box explicitly to the placeholder value should always leave the actual spacings on the canvas unchanged.

In that light, the current behavior is doing the right thing in the normal case right now and a zero placeholder for the cases discussed above would also preserve that property.

I might be missing something, but how does that sound to you?

Given the current behavior of the layout system that seems like the best choice to me right now. After all, this is a special case in the layout system, so there’s going to be some oddity somewhere as a result. My code got a lot simpler once I started computing “betweens” rather than befores and afters.


This is an interesting idea, and I like the reasoning about how setting the placeholder shouldn’t change the behavior. Let me stew on it for a bit and get @ryan’s feedback.

Re: between, yeah — our motivation for introducing that came from years of awkward overrides of before/after values in CSS = )