First of all, sorry for replaying a bit slowly. My week end was quite busy and I was not
in front of my computer.
This topic was started because remove callbacks got triggered from same
shape multiple times by single event. I think I fixed this problem. And I
did few more things to TRCompositeShape while I was at it. I fixed exactly
same problem with translation callbacks, I modified composite shape callback
test to test this case with removing, and I added and used shapesDo: and
firstShape methods to simplify code and make it faster - calling
Collection>>#collect:thenDo: is faster than (collect:)do:, because is does
not create temporary collection in the middle of it.
It is integrated in Roassal!
Unfortunately, in the meantime, I found much nastier bug, which is not so
common to trigger, but it causes infinite loop and it happens in our
It happens only if:
We have a composite shape, canvas of this composite shape is not set (is
nil), and then we add TRTranslationCallback to that shape - callback which
gets encompassingRectangle of this shape in its block.
If canvas is nil, method encompassingRectangle sends (for some reason
unclear to me) positionShapesAfterBeingAdded, which translates subshapes,
which triggers translation callback, which sends encompassingRectangle,
which sends positionShapesAfterBeingAdded etc...
Same problem happens by calling many methods which then call
encompassingRectanhle, like center, position, extent, height and width.
| shape process |
shape := (RTBox new + RTBox new) element.
shape addCallback: (TRTranslationCallback block: [shape
process := [shape translateTo: 100@100] fork.
(Delay forMilliseconds: 300) wait.
process suspend; debug.
Hum… This is a strange bug…
I do not quite understand what’s going on here. I have an error in
^ shapeAndOffsets collect: #first
As we discussed in topic "[Roassal] TRCompositeShape not sending callbacks"
), there is a problem if I use simple addCallback: for translation or extent
callbacks, because this way it triggers only when first subshape is changed,
but after that, the rest of subshapes get changed, but no callback is
triggered anymore. You proposed method addCallbackToAllShapes:, but it would
require to make nasty exceptions and type checking for composite shapes in
multiple places in our code, because TRRemoveCallbacks have to be triggered
only once per composite shape (which seems to be opposite of translation and
Only possible solution that occurs to me is to edit addCallback: just for
our need in subclass of RTCompositeShape, or use mentioned replacable blocks
for that in TRCompositeShape.
Sincerely, I am not convinced at all by TRCompositeShape, as it is implemented now.
For example, having a shapeAndOffsets variable is odd to me.
Apparently, you guys are having a deeper use of it than I do. You can easily make your own
CompositeShape, and all in a modular fashion, without touching the core of either roassal
I would like to help you on this, but I am not sure how.
Question 1 (maybe Problem 4?))
And to finish this, I have one question. What is and/or should be difference
between TRShape>>#position and TRShape>>#center? In case of RTElement, it is
explicitely the same, but what about here, where it sometimes is and
sometimes isn't the same, especially with composite shapes (but not only
I think this is because of the composite shape. A question: can a composite shape have a
position that is different than its center? I think yes.
View this message in context:
Sent from the Moose mailing list archive at Nabble.com
Moose-dev mailing list