[Cuis-dev] LayoutMorph separation
Juan Vuletich
juan at cuis.st
Wed Aug 21 09:03:05 PDT 2024
Hi Folks,
On 8/14/2024 5:59 PM, ken.dickey--- via Cuis-dev wrote:
> On 2024-08-13 17:01, Mark Volkmann via Cuis-dev wrote:
>
>> On Tue, Aug 13, 2024 at 9:18 AM <ken.dickey at whidbey.com> wrote:
>>
>>> On 2024-08-12 17:01, Mark Volkmann via Cuis-dev wrote:
>>>
>>>> I seem to keep running into situations where I want separation in a
>>>> LayoutMorph to only be added between the submorphs and not before the
>>>> first and after the last. I see that I can achieve that by modifying
>>>> the LayoutMorph method layoutSubmorphsHorizontallyIn:. But I don't
>>>> always want that behavior. I'd like that to be configurable. Is there
>>>> already a way to do this that I'm missing?
>
>> No.
>
>>>> I'd rather not have to insert spacer morphs, especially if there
>>>> are a large number of submorphs.
>>>> I attached my solution which is to create a subclass of LayoutMorph
>>>> that adds a boolean instance variable "trim".
>>>> When that is true, it avoids adding separation before the first and
>>>> after the last submorph.
>>>> This works for my use cases.
>>>> It would be great if this was added to LayoutMorph. It wouldn't
>>>> affect its current behavior.
>
> Mark, thanks much for contributing.
>
> Two things:
> [A] I prefer #useEdgeSpace to #trim as 'trim' seems too generic a
> term to me. ['shrinkWrap' might work as well].
> [B] Due to edge cases, the math is a bit difficult to get right.
>
> Please check the code and try `Layout2Morph example1` in the attached.
>
> I am still testing, but think this may be close to what you want.
>
> Thanks again for this!
> -KenD
Thank you very much Mark and Ken for working on this!
I've just integrated a slightly later version of this code with your
latest work. It works nicely.
Thanks!
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
More information about the Cuis-dev
mailing list