Hi!I’ve just introduced a new class TRExtensibleLabelShape and TRLabelShape. This will ease the problem we are experiencing with using labels in a composed shape.I would like now to discuss about how to compose shapes. This has been a big discussion for at least 5 years. I propose a solution in this email, I hope this will make most of us happy :-)
Consider the example:-=-=-=-=-=-=-=-=| v s1 s2 c es |
v := RTView new.
s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).
c := RTCompositeShape new
shape1: s1;
shape2: s2;
offset2: 0 @ -30.
es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.
es when: TRMouseClick do: [ :evt | evt element remove. v signalUpdate ].
RTHorizontalLineLayout on: v elements.
v open-=-=-=-=-=-=-=-=This is the output:If you click on an element, then the element with its label is properly removed. Yupi! Leo will be happy with that :-)The reason is that how can I specify to have s2 above s1? What should I put in offset2 ? Instead of fiddling with blocks like [:shape1 :shape2 :element | … ] I have introduced RTHorizontalCompositeShape and RTVerticalCompositeShape just to try whether it make sense or not.We can have-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=| v s1 s2 c es |
v := RTView new.
s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).
c := RTHorizontalCompositeShape new
shape1: s1;
shape2: s2.
es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.
RTHorizontalLineLayout on: v elements.
v-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Replacing Horizontal by Vertical works as expected.You can also compose these things. Look at that:-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=| v s1 s2 c es |
v := RTView new.
s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).
c2 := RTVerticalCompositeShape new
shape1: s1;
shape2: s2.
c := RTHorizontalCompositeShape new
shape1: s1;
shape2: c2.
es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.
RTHorizontalLineLayout on: v elements.
v-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Are we happy with RTVerticalCompositeShape, RTHorizontalCompositeShape and RTCompositeShape ?If yes, then RTLabelling (and its problem of passing the view along :-) will be obsolete.Cheers,Alexandre--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev