[Cuis-dev] LayoutMorph separation
Bernhard Pieber
bernhard at pieber.com
Tue Aug 27 08:32:55 PDT 2024
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:
[PastedGraphic-1.png]
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.
Cheers,
Bernhard
> Am 26.08.2024 um 21:27 schrieb ken.dickey--- via Cuis-dev <cuis-dev at lists.cuis.st>:
>
> I also would like LayoutMorph's to retain #spacing and not add the
> complexity of individual #margins, negative margins et al.
>
> What use cases in Cuis would offset the added complexity of #margin
> calculation?
>
> I like #padding added to #BoxedMorph.
>
> I suspect the #minimumExtent and #morphExtent would continue to refer to
> the exterior edge of a Morph. Proportional layout also w.r.t. exterior
> edges. #morphPosition as the upper-left point of the border.
>
> Perhaps a new #contentExtent synthesized from #morphExtent less 2 *
> (#borderWidth + #padding)?
>
> $0.02,
> -KenD
>
>> On Mon, Aug 26, 2024 at 9:45 AM Juan Vuletich <juan at cuis.st> wrote:
>
> ..
>
>> This is my suggestion:
>> - BoxedMorph would have 2 "Borders": Border and Padding
>> - Padding is drawn the same as background, i.e. using the morph 'color'
>> - Padding behaves as an inner part of the current Border. Any code that
>> needs the boundary between current Border and the "inside" of the morph
>> would now get the boundary between Padding and the area inside it.
>> - Margin is only a property that a morph can be queried about, and is
>> part of its LayoutSpec. It is not considered part of the morph at all.
>> It is only used by the containing LayoutMorph. This design is
>> consistent with [1], that states: "Note: The margin property also
>> affects the total space that the box will take up on the page, but the
>> margin is not included in the actual size of the box. The box's total
>> width and height stops at the border."
>>
>> So, Bernhard, the difference with your design would be:
>> - Margin is moved from LayoutMorph to the inner morphs, but to their
>> LayoutSpec. It is to be used in place of "separation" or "spacing".
>> - Padding is moved up to BorderedMorph as you suggest. LayoutMorphs
>> would inherit it. This means that any BorderedMorph could have a
>> non-zero padding of their contents
>> - LayoutMorph would no longer have 'separation' and 'margin', neither
>> 'useEdgeSpace' nor a specific 'padding'.
>>
>> I think this would cover all the suggested use cases.
>>
>> Opinions?
>
> On 2024-08-26 08:16, Mark Volkmann via Cuis-dev wrote:
>
> I like the proposal to add padding to BoxedMorph.
>
> Do I understand correctly that there is a desire to remove separation
> from LayoutMorph? I don't think I like that. I think LayoutMorph needs
> an easy way to specify the gap that should be present between each
> submorph. But I think the gap should not be applied before the first
> submorph and after the last submorph. The new padding in BoxedMorph can
> handle that. Adding a margin to each submorph can achieve the same
> result, but that seems more tedious to apply.
>
> Object Computing, Inc.
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240827/bd7d2b3a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 11467 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240827/bd7d2b3a/attachment-0001.png>
More information about the Cuis-dev
mailing list