'Real' zooming&panning

Ned Konz ned at bike-nomad.com
Mon Nov 3 14:22:17 UTC 2003


cg at tric.nl wrote:
> Ned Konz  <squeak-dev at lists.squeakfoundation.org> said:
> 
>>I don't disagree with how it should look. I'm just saying that it's not the 
>>job of the Canvas to do this. If the Morph wants to draw itself differently 
>>than just scaling itself, then it's the Morph's responsibility to do so.
>>
> 
> Does the Morph know that it is being drawn in a scaled environment?
> Because that's something it should know so it can draw user interface
> elements (the 'handle' triangles and circles for sure, and the outline
> in our case as well) at the appropriate scale.

I think that what I would do is to have a Project/World subclass that 
maintains the global translation and can tell its submorphs.

>>I don't understand why you feel you have to bypass Morphic. The user 
>>interaction -- the event handling especially -- is already handled by 
>>Morphic.
>>
> 
> Well, then probably you know too much about Morphic to appreciate how
> completely lost this beginner is. If I cannot untangle the code that is 
> currently there, and at the moment it looks that way, it is probably
> faster to junk the lot and start from scratch...
> 
> Maybe we can subclass from Morph to get the event handling, but all the
> useful stuff in PolygonMorph (our most important worker at this moment)
> and others we probably need to rewrite from scratch :-(.
> 

Hmm... I guess I should release Connectors v2, which includes a 
replacement for PolygonMorph (NCLineMorph and soon NCBezierOutlineMorph).

If you maintain world scaling, you could use Morphic straight for the 
UI. Layout would be done by the World, which would be responsible for 
panning and zooming. Morphs could remain blissfully unaware that they 
were living in scaled space, except for any interaction that had to be 
in real-world units.

I wouldn't use PolygonMorph by itself as the basis of a CAD system 
(unless you like their user interface, which I don't for anything but 
very simple systems).

I've found it useful to make grabble handle morphs to adjust things like 
line vertices; these tend to grab the mouse focus when you mouse down on 
them.




More information about the Squeak-dev mailing list