[Q][Connectors] Locking ends?
German Morales
germanmorales at delta-sys.com
Sun Jul 13 15:05:26 UTC 2003
It seems that Ned Konz wrote:
> Where you want to probably want to change it is in:
> #mouseDownInConnected: and/or #mouseDownInOneEndConnected:, and keep
> them from emitting #mouseDownNearEnd events.
I took that approach, doing a quick hack that seems to work.
I modified #mouseDownInConnected: this way:
mouseDownInConnected: anEvent
"<snip>"
constraint
ifNotNil: [
(self
wantsToDettachEnd: (constraints indexOf: constraint)
fromMorph: constraint inputs first)
ifTrue: [^ fsm
trigger: #mouseDownNearEnd
withArguments: {constraint. anEvent}]
ifFalse: [^ self]].
"<more snip>"
And I also created the #wantsToDettachEnd:fromMorph: method in the same
fashion as #wantsToAttachEnd:toMorph:.
wantsToDettachEnd: index fromMorph: aMorph
"Answer true if I want my end with index 'index' (1 or 2) to be
dettached from
the given Morph."
^ true
As you can see I used "constraint inputs first" to get the Morph, but...
why is there an array there? It's possible to have many morphs?
The "^ self" prevents unexpected behaviors, like considering that you are
dragging a vertex.
One thing I don't like is to check for the index (1 or 2)... perhaps two
methods would be more Smalltalk-like ;-)
> Thanks for the suggestion, though. Want to be an alpha tester?
Could be if I have time... but work + university + family leaves little
free. I'll probably add it to my list of things I want to do but I can't
:-(
Thanks for your help,
German Morales
More information about the Squeak-dev
mailing list
|