Morphic question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Morphic question

Markus Stumptner
Years ago, I asked a Morphic question here and in response was kindly
provided with the code snippet at the bottom, which I puttered around
with and it eventually led me to puttingsome useful functionality
together, so thanks again.  I came across again now and as I played
around with it, there is a question that I can't work out, silly as it
may seem: in the example, the circle shows standard drag-and-drop
behaviour, while the orange Morph "sticks" to the mouse once clicked and
has to be clicked again to be dropped off.  I could not work out where
(i.e., which method) that difference in behaviour comes from. It's not
due to the order of processing; adding the CircleMorph second doesn't
change things. Any ideas?

Notably, when I run the #exampleCircleMorph class method, the
CircleMorph that opens on the screen does not show this behaviour, it
"sticks" to the mouse in the same way as the orange Morph.

FWIW, this is Pharo 6 under Windows (7 or 10 makes no difference).


| window pane board background scaler|

background := AlphaImageMorph withForm: (ZnEasy getJpeg:
'http://i.imgur.com/K1QR9vA.jpg').
background lock.

board := PasteUpMorph new.
board
color: Color gray;
borderWidth: 3;
borderColor: Color black;
extent: background extent;
backgroundMorph: background;
addMorph: (CircleMorph new color: Color cyan; position: 41@23; yourself);
addMorph: (Morph new color: Color orange; position: 1200@1200; yourself).

scaler := TransformMorph new.
scaler extent: background extent * 0.5.
scaler scale: 0.5@0.5.
scaler addMorph: board.

pane := ScrollPane new.
pane scroller addMorph: scaler.

window := pane openInWindow.
window position: 20@20; extent: 420@420.