[self-interest] Fix morphs
randall.smith at sun.com
Fri May 10 19:09:33 UTC 2002
I am not certain what you want, but I think you are saying you want an object that follows
you through the world as you move from one place to another.
To do that, you can always just attach your morph to one of your screenEdges. Your
screenEdges are a set of four lines just out of reach for each user, that bound their view
rectangle onto the world. When there are multiple users in the world, you can see these
edges go by as another user passes by your position in the wolrd.
Unfortunately, the screen edges for each user are rather hard to find, we should have put
an easy access method in traits hand or something.
Here is some code:
| world. stickyMorph. edge. myHand |
world: (desktop named: 'Self 1')."or however you want to get the world of interest."
stickyMorph: morph copy. "or however you want to make your sticky morph."
myHand: world hands first. "or however you want to get your cursor"
edge: (world morphs asList copyFilteredBy:
[ | :m | (m morphTypeName = screenEdge morphTypeName) &&
[m winCanvas = myHand winCanvasForHand]
"edge is now the first of your 4 screenEdges, the one across the top."
stickyMorph globalPosition: edge globalPosition + (20 at 30).
edge addMorph: stickyMorph.
The stickyMorph now follows you everywhere. Hope that helps!
> For an application that I'm writing in the moment, I need a morph that has
> fix position to the current view. For example like the radarView. When I
> looked at this implementation I found out that it works in different way
> then I mentioned. The radarView is not fixed, it just ignore the movements
> that was directed by the radarView itself. For example, if you have 2
> radarViews and you use one of them to move to the right, the other is not
> visible in the current view anymore.
> What I need is something like the flaps in Squeak, but I found it not very
> helpful to look at their implementation. For me the differences between the
> two different implementations looks to great, maybe I'm wrong.
> Any idea how I can do things like that in self?
> Thorsten Dittmar
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the Self-interest