Hello
Sice I am still playing with composite shapes, I found another problem, in addition to incorrect behavior of calling update onto it. This time I found that composite shapes do not send callbacks in lots of cases. Example: | compo ellipse | compo := ((RTBox new size: 50; color: Color red; yourself) + RTBox new) element. compo @ RTDraggable. ellipse := RTEllipse new size: 20; color: Color blue; element. TRConstraint stick: ellipse below: compo. (RTView new) add: compo; add: ellipse; open. When I drag the composite shape, ellipse does not move, although it should. Jan |
Hi Jan!
Composite shapes is a difficult beast to play with. You have found a bug, and I have just fixed it. Please update Roassal and Trachel, and you will obtain the expected behavior. Cheers, Alexandre > On Mar 22, 2015, at 6:22 PM, Jan B. <[hidden email]> wrote: > > Hello > > Sice I am still playing with composite shapes, I found another problem, in > addition to incorrect behavior of calling update onto it. > This time I found that composite shapes do not send callbacks in lots of > cases. Example: > > | compo ellipse | > compo := ((RTBox new size: 50; color: Color red; yourself) + RTBox new) > element. > compo @ RTDraggable. > ellipse := RTEllipse new size: 20; color: Color blue; element. > TRConstraint stick: ellipse below: compo. > (RTView new) add: compo; add: ellipse; open. > > When I drag the composite shape, ellipse does not move, although it should. > > Jan > > > > -- > View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221.html > Sent from the Moose mailing list archive at Nabble.com. > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Thank you, but I don't think that using first shape's callback is working right if I edit second shape's extent.
Consider this example: |s view e encompass block| 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. ]. e addCallback: (TRExtentCallback block: block); addCallback: (TRTranslationCallback block: block). block value. e when: TRMouseClick do: [ :ev | e trachelShape shapes second extent: 20@20. view signalUpdate. ]. view open When I, on mouse click, edit first shape, encompassing box changes fine, but not like this, when I edit second shape. Jan
|
These composite shape may be the most complicated piece of code I have ever written.
Working on it… Alexandre > On Mar 24, 2015, at 8:59 PM, Jan B. <[hidden email]> wrote: > > Thank you, but I don't think that using first shape's callback is working > right if I edit second shape's extent. > > Consider this example: > > |s view e encompass block| > 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. ]. > e addCallback: (TRExtentCallback block: block); addCallback: > (TRTranslationCallback block: block). > block value. > > e when: TRMouseClick do: [ :ev | > e trachelShape shapes second extent: 20@20. > view signalUpdate. > ]. > > view open > > When I, on mouse click, edit first shape, encompassing box changes fine, but > not like this, when I edit second shape. > > Jan > > > abergel wrote >> Hi Jan! >> >> Composite shapes is a difficult beast to play with. You have found a bug, >> and I have just fixed it. >> Please update Roassal and Trachel, and you will obtain the expected >> behavior. >> >> Cheers, >> Alexandre >> >> >>> On Mar 22, 2015, at 6:22 PM, Jan B. < > >> bliznjan@.cvut > >> > wrote: >>> >>> Hello >>> >>> Sice I am still playing with composite shapes, I found another problem, >>> in >>> addition to incorrect behavior of calling update onto it. >>> This time I found that composite shapes do not send callbacks in lots of >>> cases. Example: >>> >>> | compo ellipse | >>> compo := ((RTBox new size: 50; color: Color red; yourself) + RTBox new) >>> element. >>> compo @ RTDraggable. >>> ellipse := RTEllipse new size: 20; color: Color blue; element. >>> TRConstraint stick: ellipse below: compo. >>> (RTView new) add: compo; add: ellipse; open. >>> >>> When I drag the composite shape, ellipse does not move, although it >>> should. >>> >>> Jan >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221.html >>> Sent from the Moose mailing list archive at Nabble.com. >>> _______________________________________________ >>> Moose-dev mailing list >>> > >> Moose-dev@.unibe > >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list > >> Moose-dev@.unibe > >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > > > -- > View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221p4814952.html > Sent from the Moose mailing list archive at Nabble.com. > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Jan Blizničenko
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 > On Mar 24, 2015, at 8:59 PM, Jan B. <[hidden email]> wrote: > > Thank you, but I don't think that using first shape's callback is working > right if I edit second shape's extent. > > Consider this example: > > |s view e encompass block| > 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. ]. > e addCallback: (TRExtentCallback block: block); addCallback: > (TRTranslationCallback block: block). > block value. > > e when: TRMouseClick do: [ :ev | > e trachelShape shapes second extent: 20@20. > view signalUpdate. > ]. > > view open > > When I, on mouse click, edit first shape, encompassing box changes fine, but > not like this, when I edit second shape. > > Jan > > > abergel wrote >> Hi Jan! >> >> Composite shapes is a difficult beast to play with. You have found a bug, >> and I have just fixed it. >> Please update Roassal and Trachel, and you will obtain the expected >> behavior. >> >> Cheers, >> Alexandre >> >> >>> On Mar 22, 2015, at 6:22 PM, Jan B. < > >> bliznjan@.cvut > >> > wrote: >>> >>> Hello >>> >>> Sice I am still playing with composite shapes, I found another problem, >>> in >>> addition to incorrect behavior of calling update onto it. >>> This time I found that composite shapes do not send callbacks in lots of >>> cases. Example: >>> >>> | compo ellipse | >>> compo := ((RTBox new size: 50; color: Color red; yourself) + RTBox new) >>> element. >>> compo @ RTDraggable. >>> ellipse := RTEllipse new size: 20; color: Color blue; element. >>> TRConstraint stick: ellipse below: compo. >>> (RTView new) add: compo; add: ellipse; open. >>> >>> When I drag the composite shape, ellipse does not move, although it >>> should. >>> >>> Jan >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221.html >>> Sent from the Moose mailing list archive at Nabble.com. >>> _______________________________________________ >>> Moose-dev mailing list >>> > >> Moose-dev@.unibe > >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list > >> Moose-dev@.unibe > >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > > > -- > View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221p4814952.html > Sent from the Moose mailing list archive at Nabble.com. > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
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
|
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. <[hidden email]> 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-tp4814221p4818427.html > Sent from the Moose mailing list archive at Nabble.com. > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi, this is a little more difficult to answer than yes or no.
Your solution fixes the problem described by me, but it is not so useful for our needs, because... Calling addCallbackToAllShapes: instead of addCallback:, like with all other shapes we use, means to make exceptions just for composite shapes. Right now we add same callbacks to all our shapes the same way on one place, but with this change we probably will have to either type check in all places we add callbacks or create even more code and make it all more difficult to maintain, because we add those callbacks pretty far from place we create shapes... 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. 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. Jan
|
> 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-tp4814221p4818427.html >>> Sent from the Moose mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> Moose-dev mailing list >>> > >> Moose-dev@.unibe > >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list > >> Moose-dev@.unibe > >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > > > -- > View this message in context: http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814221p4820161.html > Sent from the Moose mailing list archive at Nabble.com. > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |