Squeak
  links to this page:    
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Views on a map
Last updated at 4:31 pm UTC on 14 January 2006
Blake February 01, 2005 I've been playing with the playfield (appropriately enough) and would like to go to the next level, as it were: I want a view that scrolls around a larger playfield than is seen at anyone time. While I think I could do this with the 3D graphics, I'd prefer to keep things 2D for now.

Frank Shearar Perhaps a ScrollPane is in order? This is what I use for my ImageMapEditor.
Bert Freudenberg
(PasteUpMorph new extent: 800@800; inATwoWayScrollPane) openInWorld
Blake OK, I'll start with this. I'm loathe to moosh the representations of the objects together with the objects, but it's probably okay for starters.

How to save a part bin The easiest thing to do is just to offset all the submorphs. There is a limit, though, to positions in Morphic; I think that we may be limited to +/-32K. Beyond this you may have to remove invisible morphs from the World (perhaps adding them as children of a separate, hidden morph) and put them back later when they become available. Or you could move them just offscreen and save their actual position in a property. When you pan the world you just adjust
the offsets and saved positions.

If you add translation to the world (or scaling, for that matter) you will find that there are a number of cases where transformations will have to be applied to event coordinates. I've tracked down a number of these over the years but there are still some left.

Blake Change the locations of every morphic every time I want the screen to move? I mean, I've done stuff like that, but it's not very efficient, is it?

Regarding 'removinginvisible morphs from the World...etc'Isn't it simpler to give them their actual positions and just pan the window? I guess if the whole graphic image is stored in memory, it's a different kind of inefficient.

How to save a part bin You can do that too (by adding a translation when you render the World). But you still have to deal with the 32K limits on the arguments to the primitives somewhere. Perhaps this won't be a problem. Anyhow, it's easy to try. Just subclass PasteUpMorph or change its drawSubmorphsOn: method to do a translation. You can then do something like
  World become: (World as: MyNewPasteUpMorph)
to try the new behavior (assuming that you subclassed). You can now have Project subclasses; these can provide different kinds of Worlds.

Ruedi Steinmann Sounds like my ScrollMorph.