magnetic morphs

Ned Konz ned at bike-nomad.com
Wed Apr 3 15:41:03 UTC 2002


On Wednesday 03 April 2002 02:25 am, Martin Drautzburg wrote:
>  Now I thought it would be nice to group
> several such
> CBMs together to form some sort of Menu. This would require that one CBM
> notices
> the proximity of another CBM to trigger the grouping.

Of course, if you wanted to do this, you could do something like the following 
(from the point of view of a button morph)

* in the step method, check to see if your bounds intersects the bounds of any 
other morph you'd like to merge with. Something like:

	ActiveWorld morphsInFrontOf: nil overlapping: self bounds do: [ ... ]

* if it does, then ask the other morph whether it wants to merge with you 
(this is to be polite and to keep from merging with, say, browsers)

* if it does, then merge with it:

    * if one of you is already in a column or row container, add the other to 
that container
  * if both of your is already in a container, move the morphs from one 
container to the other one
  * if neither of you is in a container, build a new one and add both morphs 
to it.


-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list