Why not make all AttachmentMorphs that are attached to a morph become visible when the mouse is over the attached morph? Other graphic programs that I've used seem to use this approach.
-david
-----Original Message----- From: Dan Ingalls [mailto:Dan.Ingalls@disney.com] Sent: Sunday, October 01, 2000 1:07 PM To: Ned Konz Subject: Re: How to make Morphs that only appear when the mouse is overthem?
I'm working on my AttachmentMorphs, and am trying to add a mode where they won't be visible unless the mouse is over them.
But using mouseEnter: and mouseLeave: to control visibility doesn't work, since the mouseOver logic in the Hand ignores invisible Morphs.
I guess I could use step and query the cursor position every time, but is there a cleaner way?
(Actually, using step would let me make them visible when the mouse was merely near them. This might be better).
Ned -
You might want a global command (like to any pasteUp or the world) to make all attachers visible. I only mention this beacuse of, eg, the make-visible command in many text editors that lets you see all non-printing characters. This means you needn't be bothered by the attachers when you don't want them, and you don't have to fish for them when you do.
Mouse-over and proximity are certainly equally reasonable preferences to play with, though.
- Dan
"Pennell, David" wrote:
Why not make all AttachmentMorphs that are attached to a morph become visible when the mouse is over the attached morph? Other graphic programs that I've used seem to use this approach.
I'm doing this, kinda.
The way it works is:
* a new AttachmentPointMorph (hereafter APM) can be dropped on a Morph. It will attach itself to the nearest suitable point (by default the 8 outer points of the bounding rectangle or the center) on that Morph.
* When you move the Morph that an APM is attached to, the APM stays stuck to the same point of that Morph (for instance, the upper left corner).
* When you drag an APM that's attached to a Morph, it moves, and displays a rubber-band line going back to its attachment point.
* When an attached APM is dragged over a Morph, all APM's attached to that Morph become visible, if they weren't already.
* Dropping an attached APM on another attached APM connects the two. A description of what _that_ does follows.
* Dropping an attached APM on a Morph (can) create a new APM attached to the nearest attachment point and then connect to the dropped APM. So you don't have to pre-attach APM's to Morphs that are the destination of connections. However, APM's created in this way are of a default type that doesn't affect (move, size, or stretch) their owners. If you want different behavior (like for the APM at the end of a connection line), you have to create one and tell it how to behave.
* You can detach an APM from its morph by using shift-drag on it.
* You can make all the APM's visible per-Morph, or per-pasteUp. Or you can make them only appear when the mouse is over them (or their owner, during attachment, as described above).
The behavior of attached APM's is pluggable. There can be multiple APM's connected together (not just two at a time).
Some possibilities for the action of APM's on their attached morphs:
* do nothing (just sit there). Default for auto-created ones. * move attached morph so that attached APM's are a fixed distance from each other (default: on top of each other) * stretch attached morph so that attached APM's are a fixed distance from each other (default: on top of each other) * move Polygon/Line vertex so that attached APM's are a fixed distance from each other (default: on top of each other)
The destination point that they move towards (if they're moving) is the center of the line segment (N=2) or polygon (N>2) that they define. So if they're all moving, they'll end up in the center, if all but one are moving, they'll end up on top of the immobile one, etc.
An attached APM can ask its attached morph for a reference point (on a line, this would be the next-from-the end vertex for an APM attached to an end). I've been thinking about having a flavor of APM (or another pluggable behavior) that moves its attachment point on its attached Morph so that it's closest to its neighbor's reference point.
Enclosed is a state diagram of what I'm working on now.
It's a Postscript file, in case the MIME type gets munged.
Any feedback would be welcome!
squeak-dev@lists.squeakfoundation.org