[Cuis-dev] LayoutMorph separation

Bernhard Pieber bernhard at pieber.com
Tue Aug 27 21:53:47 PDT 2024


Hi Ken,

Sorry for the confusion. The reason for this seemingly strange behavior is that the width of container is fixed. The colored boxes expand to it. In CSS, if they are too big they just overflow. I hate that.

For larger margin values the container width needs to be increased: https://codepen.io/bpieber/pen/PoraLjm

To summarize: margin would be useful to add additional space around a single morph inside a LayoutMorph without the need of a wrapper morph.

The distance between red and green are: red's margin bottom + container's gap + green's margin top.

Cheers,
Bernhard

> Am 27.08.2024 um 21:14 schrieb <ken.dickey at whidbey.com> <ken.dickey at whidbey.com>:
>
> On 2024-08-27 08:32, Bernhard Pieber via Cuis-dev wrote:
>
>> Hi Ken,
>>
>> I agree that the margin functionality could be introduced in a separate
>> step.
>>
>> Here is an example where a margin is useful, though:
>>
>> The container has a gap of 30px and a padding of 0px. Only red has a
>> margin of 8px in addition.
>>
>> You can play around with the values here:
>> https://codepen.io/bpieber/pen/PoraLjm
>>
>> Note that only four morphs are needed, neither spacers nor wrappers.
>>
>> Maybe margin could be emulated by a wrapper with transparent border
>> color.
>
> Bernhard,
>
> Thanks for the example. I am looking for something both explainable and
> easy to calculate. What is the simplest thing that will work?
>
> I changed the green margin to 30px, result attached.
>
> I would not have predicted this result and don't see how it would help
> me.
>
> $0.02,
> -KenD
> <PastedGraphic-1.png><Screenshot_2024-08-27_12-09-23.png><PastedGraphic-1.png>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240828/a6e1b91c/attachment.htm>


More information about the Cuis-dev mailing list