[Cuis-dev] Morph render leftovers when dragging the mouse
Nicolás Papagna Maldonado
nicolas.papagna at gmail.com
Tue Jul 20 12:17:53 PDT 2021
Aloha folks!
I've run into the following issue. I'll do my best to explain it with the
following example.
TL;DR see video reproducing the issue here:
https://drive.google.com/file/d/1HikB46LCob-bf-W4LOnT_azH-0ohlB9I/view?usp=sharing
Let's say I want to display the class name of a morph when I point to it.
If I do this, everything works fine:
label := UpdatingLabelMorph new
target: [
self runningWorld submorphs
detect: [ :morph | morph containsGlobalPoint: self
runningWorld activeHand morphPositionInWorld ]
ifFound: [ :morph | morph class name ]
ifNone: [ 'nothing here' ]
];
getSelector: #value;
stepTime: 10.
self
runningWorld
activeHand
attachMorphBeside: label.
If I try to attach a morph that contains the label defined above (say I
want to display something fancier, not just a label), then every time I
drag the mouse the label behaves like a "pen" leaving traces of its old
renders on the canvas:
self
runningWorld
activeHand
attachMorphBeside: (WidgetMorph new addMorph: label).
My gut feeling is that this might be related to the fact that the
WidgetMorph that contains the label is not aware that it is rendered
outside of its bounds, but I don't have much experience with Morphic.
1) Am I doing something wrong/missing an important concept for
understanding how Morphic works?
2) Related to that: I often find myself wrapping a bunch of morphs to add
behavior/glue code to them, but that wrapper does not do any rendering.
What would be the right way to adjust the wrapper's extent to fit its
submorphs perfectly (e.g. no extra space/no clipping)?
Thanks in advance,
Nico PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210720/dc8d3164/attachment.htm>
More information about the Cuis-dev
mailing list