pharo-graphics / Toplo

A widget framework on top of Bloc
MIT License
17 stars 8 forks source link

Bug: ToTextField #145

Open Nyan11 opened 1 month ago

Nyan11 commented 1 month ago

Hello,

I found a bug on the ToTextField. The text is displayed in front of the blue shape but it should be displayed behind it.

background := BlElement new background: Color red; yourself.
helloWorld := ToTextField new text: 'Hello world'.
foreground := BlElement new background: Color blue; position: 10 @ 0; yourself.

space := BlSpace new.
space root addChild: background.
space root addChild: helloWorld.
space root addChild: foreground.

space show

image

Nyan11 commented 1 month ago

I think the bug come from the following code. I commented beInSeparateCompositionLayer and the blue box draw in front of the ToTextField.

AlbTextEditorLineSegmentHolder >> createSegmentElement [

    <return: #BlElement>
    ^ AlbTextEditorSegmentElement new
          beInSeparateCompositionLayer;
          layout: self class defaultSegmentLayout;
          focusability: BlFocusability after;
          constraintsDo: [ :c |
              c horizontal matchParent.
              c vertical fitContent ];
          yourself
]

Why do we need beInSeparateCompositionLayer ?

Nyan11 commented 1 month ago

Why do we need composition layers ?