On Fri, Dec 28, 2007 at 09:36:59PM +0100, Koen Van der Auwera wrote:
> Well, to be honest I like it just the way it is. It's clear. If I understand
> correctly the goal is to keep Shoes as simple as possible and then I'm not
> sure the HTML-way is the best way.
> 
> Padding could be handy though :)

Well, let me share my concern about padding and maybe you can help
me make up my mind here.

The only real use for padding is to offset the contents of a box
from the background and border.  So, the margin offsets the
background and the padding offsets the text.

  <div style="width: 100px; padding: 10px; margin: 10px;
    background:red;">I love ragtime</div>

In this example, the box itself will be 140px wide.  From 0 to 140
on the x-axis.  The background will cover 10 to 130 on the x-axis.
And the text will cover 20 to 120 on the x-axis.

In Shoes, backgrounds are their own element, not a style.  So the
equivalent would be:

  stack :width => 140, :margin => 10 do
    background red
    stack :margin => 10 do
      para "I love ragtime"
    end
  end

So, the trouble with a padding style is that the padding would
affect only most elements, all but `background` and `border`.
This means that different elements would be operating under
slightly different coordinate systems.  I don't really like that a
style would only apply to certain elements, since it requires extra
memorization.

Maybe a padding element, which would pad everything underneath it.

  stack :width => 140, :margin => 10
    background red
    pad 10
    background blue
    para "I love ragtime"
  end

So the blue background is padded ten pixels along with the text.

This might even do away with margins:

  stack :width => 140
    pad 10
    background red
    pad 10
    background blue
    para "I love ragtime"
  end

There is a precedent for this in Shoes, since `stroke` and `fill`
are stateful and affect elements below them.

_why

Reply via email to