'Real' zooming&panning

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Sun Nov 2 15:52:58 UTC 2003


On Sun, Nov 02, 2003 at 07:33:43AM -0800, Ned Konz wrote:
> On Sunday 02 November 2003 7:04 am, Cees de Groot wrote:
> > On Sat, 2003-11-01 at 17:15, Ned Konz wrote:
> > > How were you doing this?
> >
> > With the code I posted. I took a design (a bitmap as background image
> > with some PolygonMorphs added to it, one of them showing handles), and
> > opened it in a MyTwoWayScrollPane.
> >
> > > I don't think the Canvas should do anything different from dumb scaling
> > > of whatever gets drawn on it. So the morphs should be scaled, as well as
> > > their outlines.
> >
> > That's not what you want for a design program (think CAD) - in 99.99% of
> > the cases, you want the outline of an element to be drawn with a 1 pixel
> > wide border. Furthermore, the PolygonMorph handles should not scale, you
> > always want them at the same absolute size because they are user
> > interface things, not design elements.
> 
> 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.

Are you sure?  What if I wanted to render a Morphic world as though it
were painted, or drawn with a pencil?  One approach would certainly be
to have each morph take responsibility for drawing itself, perhaps
with methods like #drawWithPencilOn:.  Another approach would be to
substitute in a canvas that would override the line drawing/area
filling methods to implement the desired style.  The latter has the
benefit of localizing changes in one class instead of scattering them
across the Morph hierarchy.

This isn't quite the same thing as the scenario that you responded to,
but demonstrates that there are cases where your statement is at least
questionable.  

Of course, other complications arise... if the size that a handle is
drawn is determined by the canvas, then the canvas must become involved
in the event handling process to decide which morph a click should be
handled by.  So for Cees' scenario, I would tend to agree with your
assessment.  I need to think about it a bit more...

Bye,
Joshua


> 
> > > If you want different behavior than just pure scaling, use BalloonCanvas
> > > (in deferred mode if you can) and draw your morphs with the appropriate
> > > sizes for borders, text, etc.. You can ask the canvas for its transform
> > > if you need to.
> >
> > 'use BalloonCanvas' is easier said than done (until someone can give me
> > a pointer to documentation - I still have to find even a single class
> > that has a class comment), but I fear it's the only approach - build a
> > model hierarchy of design elements, and manually draw them on a
> > BalloonCanvas (i.e. completely bypass Morphic for this bit).
> 
> I don't understand why you feel you have to bypass Morphic. The user 
> interaction -- the event handling especially -- is already handled by 
> Morphic.
> 
> -- 
> Ned Konz
> http://bike-nomad.com
> GPG key ID: BEEA7EFE
> 



More information about the Squeak-dev mailing list