porting 2.7 morph dragging to 3.1

Jim Benson jb at speed.net
Mon Jul 9 08:49:17 UTC 2001


Tim,

As you know, the definitive Squeak work on line-connected morphs by Ned Konz
is available on the super swiki as 'NK-ConnectorsDemo.056.pr'. (Gold bar,
'Find', 'Bobs Superswiki' for those following along at home. It helps to
sort the files by name to locate the project file). If possible, you should
try to convert your work to his model, it's all very entertaining.

If you're looking at a more lightweight approach, like "just tell me how to
fix this bugger", I plan on looking at it tomorrow (looking at the time, I
guess later today ;-) If not, let me know.

Jim



----- Original Message -----
From: "Tim Rowledge" <tim at sumeru.stanford.edu>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Sunday, July 08, 2001 8:26 PM
Subject: Re: porting 2.7 morph dragging to 3.1


> Thanks for the explanation Jim!
>
> I think my needs are way on the simple end of the dragNdrop continuum.
> I have a bunch o'morphs in a tree arrangement and need to be able to
> drag individual morphs (or actually sometimes subtrees) around within
> their world, updating the position of line endpoints so that
> everything stays linked together. The 2.7 code original traps mouseDown:
> and uses waitForClicksOrDrag:, and seems to rely on getting a stream of
> #drag: events.
> I don't need to drag ThingyMorphs outside their little world, nor drop
> them on top of each other, nor anything too clever.
>
> !ThingyMorph methodsFor: 'event handling' !
> drag: evt
> | p oldPosition |
> p _ evt cursorPoint.
> oldPosition _ self position.
> self position: p - evt hand targetOffset.
> evt shiftPressed ifTrue: [self allChildMorphsDo: [:m | m position: m
position + (self position - oldPosition)]]! !
>
>
> !ThingyMorph methodsFor: 'event handling' !
> mouseDown: evt
> Sensor yellowButtonPressed ifTrue: [self createMenu]
> ifFalse:[
> Sensor redButtonPressed ifTrue: [evt hand waitForClicksOrDrag: self event:
evt]]! !
>
> Now, I did actually try a quick evt hand grab: self (or something like
> that) and it does indeed allow me to grab the morph, but I didn't spot
> any way to make sure the attached lines got updated as well.
>
> I should add that I'm not the orginal author and am completely
> inexperienced in the ways of Morphic. I just spend too much time
> fiddling with the VM!
>
> tim
>
> --
> Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
> Useful random insult:- A day late and a dollar short.
>
>
>
>





More information about the Squeak-dev mailing list