'Real' zooming&panning

cg at cdegroot.com cg at cdegroot.com
Fri Oct 31 08:19:19 UTC 2003


Andreas Raab <squeak-dev at lists.squeakfoundation.org> said:
>[...]. So you might want to give it a try by simply converting
>your regular canvas into a balloon canvas and see what you get.
>
Simpler said than done for this graphics newbie, I fear (if only because
Google is awfully unhelpful when entering 'Squeak Balloon' - is there
any documentation at all?). 

What I tried to get something to draw on a balloon canvas is to subclass
TwoWayScrollPane (which, except for the ugly zooming in its
TransformMorph, does mostly what I want if I'd add some zoom in/out
controls), and override initialize:

MyTwoWayScrollPane>>initialize
    | oldscroller |
    super initialize.
    oldscroller := scroller.
    scroller := MyTransformMorph new color: Color transparent.
    scroller offset: 0 at 0.
    self replaceSubmorph: oldscroller by: scroller

I did this because the scroller seems to the actual submorph drawing, so
my first point of attack: 

MyTransformMorph>>drawSubmorphsOn: aCanvas
    | balloon |
    balloon := aCanvas asBalloonCanvas.
    balloon transformBy: transform asMatrixTransform2x3.
    balloon
	clipBy: self innerBounds
	during: [:myCanvas |
		submorphs reverseDo:[:m | myCanvas fullDrawMorph: m] ]

This replaced my test design (basically a Form with some morphs on it)
with a red rectangle having a diagonal yellow cross, and then I went to
bed ;-).

Is this the right direction? Sorry for bothering y'all, but this stuff
is extremely time-consuming to find out...

-- 
Cees de Groot               http://www.cdegroot.com     <cg at cdegroot.com>
GnuPG 1024D/E0989E8B 0016 F679 F38D 5946 4ECD  1986 F303 937F E098 9E8B
Cogito ergo evigilo




More information about the Squeak-dev mailing list