I thought about subclassing TRCompositeshape and rewriting addCallback: to affect all our shapes, but we use also TRRemoveCallbacks, and those need to be triggered only once, because we use them to remove our labels of edges... if we trigger such TRRemoveCallback when labels were already removed before, by callback from previous subshape, error occurs.
Actually, I would not really subclass TRCompositeShape. This is a complex class, that subclassing it will result in frustration. I think it is better to make your own that fits your need. Maybe we need several way to compose shape, and not just one. In Mondrian, (the great-great-father of Roassal), we had a ComplexShape that followed CSS rules: a % for each subshape and some annotation to tell show resize should behave (is it a fixed column? Size is a pixels or in %?).
Maybe we should revive this.
This last problem with multiple calling remove callbacks, is, by the way, happening even now, because TRCompositeShape>>remove calls remove callbacks twice for first subshape... one from triggerRemoveCallbacks, second from the loop calling remove on all subshapes, as we discussed in TRCompositeShape regression thread: http://forum.world.st/Roassal-TRCompositeShape-regression-td4816726.html
So what we do now is use old version of trachel and do not explicitely use composite shapes anymore.
Ok!
Alexandre
abergel wrote
Hi Jan!
Is the problem you described below still an issue? (I am going through marked emails)
Cheers, Alexandre
On Apr 8, 2015, at 2:58 PM, Jan B. <
bliznjan@.cvut
> wrote:
Hi
This method does what I want and it works just fine. Only problem is that we add callbacks to all shapes in one place the same way, but this requires exception for composite shapes.
It seems composite shapes need different behavior with different usage of them. I thought about using replacable blocks for composite shapes actions like adding callbacks, resizing or moving composite shape, reaction to moving or resizing sub-shapes etc.
I will try to unify discussion about composite shapes into "Roassal TRCompositeShape regression" thread started by Peter.
Jan
abergel wrote
Hi Jan,
I have a solution for your problem (you need to update Roassal). Let’s see whether it works for you.
Here is an updated version of your script:
s := RTCompositeShape new. s add: (RTBox new color: Color blue; size: 50). s add: (RTEllipse new color: Color green; size: 100). s horizontal. s setAutomaticRelayout.
e := s element. view := RTView new. view add: e.
e @ RTDraggable.
encompass := RTBox new color: Color transparent; borderColor: Color red; element. view add: encompass.
block := [ encompass extent: e encompassingRectangle extent; translateTo: e position. view signalUpdate. ].
“I have introduced #addCallbackToAllShapes:" e trachelShape addCallbackToAllShapes: (TRExtentCallback block: block). e trachelShape addCallbackToAllShapes: (TRTranslationCallback block: block). block value.
e when: TRMouseClick do: [ :ev | e trachelShape shapes second extent: 20@20. view signalUpdate. ].
view open
Let us know about your progresses!
Alexandre
-- View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp48142... Sent from the Moose mailing list archive at Nabble.com.
Moose-dev mailing list
Moose-dev@.unibe
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list
Moose-dev@.unibe
-- View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp48142... Sent from the Moose mailing list archive at Nabble.com.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev