David Poundall wrote:
> Hi Chris,
> As part of my GUI interface I am emulating some of the functionality of 
> visio.  That is to say…

> Shift + wheel operation à pan left/right
> 
> Wheel operation  à   Pan up/down
> 
> Control + wheel operation à Zoom.

This should be quite doable , in a GUIMode. I think there are examples of:

wheel pan up/down

and

wheel Zoom

in various places. Zoom is certainly there.

>     def OnKeyDown(self,event):
>         self.controlDown = event.ControlDown()
>         self.altDown = event.AltDown()
>         self.shiftDown = event.ShiftDown()

This isn't the way to do it, what you want is something like:

      def OnWheel(self, event):
         modifier = None
         if event.ShiftDown:
             #pan left right code
        elif event.CmdDown: (this is "command on Mac, control elsewhere)
             if event.GetWheelRotation() < 0:
                 self.Canvas.Zoom(0.9)
             else:
                 self.Canvas.Zoom(1.1)
         else:
             #pan up/down code
         if event.GetWheelRotation() < 0:
             self.Canvas.Zoom(0.9)
         else:
             self.Canvas.Zoom(1.1)



>             if self.Pan.StartMove <> None:
>                 xy[1] = xy[1] + float(1.0*event.m_wheelRotation / 6)
>                 self.Pan.MoveImage(event, xy)
>                 print 'Up/Down ---- ',xy

MoveImage takes a "Shift" parameter -- how much you want to move the 
image, not it's position. It can take either pixel or world coordinates:

     def MoveImage(self, shift, CoordType):
         """
         move the image in the window.

         shift is an (x,y) tuple, specifying the amount to shift in each 
direction

         It can be in any of three coordinates: Panel, Pixel, World,
         specified by the CoordType parameter

         Panel coordinates means you want to shift the image by some
         fraction of the size of the displaced image

         Pixel coordinates means you want to shift the image by some 
number of pixels

         World coordinates mean you want to shift the image by an amount
         in Floating point world coordinates

         """


So you need to decide how much you want to shift the image with each 
click of the wheel -- 20 pixels? 1/10 of the Window width? whatever.


-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]

_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to