/[fenfire]/fenfire/org/fenfire/demo/mm.py
ViewVC logotype

Diff of /fenfire/org/fenfire/demo/mm.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by humppake, Mon Aug 25 08:40:27 2003 UTC revision 1.37 by humppake, Mon Aug 25 14:20:03 2003 UTC
# Line 244  class LMB(Action, vob.mouse.MouseClickLi Line 244  class LMB(Action, vob.mouse.MouseClickLi
244              into = jarray.zeros(3, 'f')              into = jarray.zeros(3, 'f')
245              vs.coords.transformPoints3(cs, [0,0,0], into)              vs.coords.transformPoints3(cs, [0,0,0], into)
246    
247              scale = 1./main.getFocus().getZoom()              scale = main.getFocus().getZoom()
248    
249              # scaling              # scaling
250              nodeScale = ff.fenmm.MMGeometry.getTextScale(int(100+into[2]))              nodeScale = ff.fenmm.MMGeometry.getTextScale(int(100+into[2]))
# Line 265  class LMB(Action, vob.mouse.MouseClickLi Line 265  class LMB(Action, vob.mouse.MouseClickLi
265    
266    
267  class ZoomPan(vob.input.RelativeAxisListener, Action, vob.mouse.MousePressListener):  class ZoomPan(vob.input.RelativeAxisListener, Action, vob.mouse.MousePressListener):
     def __init__(self, fen, context):  
         Action.__init__(self, fen, context)  
         self.oldZoom = 1.  
268      def pressed(self, x,y):      def pressed(self, x,y):
269          return self          return self
270      def changedRelative(self, x):      def changedRelative(self, x):
271          x = x / 2.          self.context.main.changeZoom(x)
272          main = self.context.main          self.context.main.chgFast(self.context.oldVS, -1)
         f = main.getFocus()  
         fX, fY = f.getPanX(), f.getPanY()  
   
         dimensions = w.getSize()  
         fX -= dimensions.width*(-.5/self.oldZoom + .5)  
         fY -= dimensions.height*(-.5/self.oldZoom + .5)  
         fX += dimensions.width*(-.5/f.zoom + .5)  
         fY += dimensions.height*(-.5/f.zoom + .5)  
         f.setPan(fX, fY)  
         self.oldZoom = f.zoom  
           
         if x: main.changeZoom(1./x)  
         else: main.changeZoom(0)  
         main.chgFast(self.context.oldVS, -1)  
   
273          self.context.fastMouseChg = 1          self.context.fastMouseChg = 1
         accursed = self.context.c.getAccursed()  
274          self.context.setFastAnimation()          self.context.setFastAnimation()
275    
276  class PanMover(Action, vob.mouse.RelativeAdapter, vob.mouse.MousePressListener):  class PanMover(Action, vob.mouse.RelativeAdapter, vob.mouse.MousePressListener):
277      def pressed(self, x,y):      def pressed(self, x,y):
278          return self          return self
279      def changedRelative(self, x,y='foo'):      def changedRelative(self, x,y='foo'):
280          main = self.context.main          f = self.context.main.getFocus()
         f = main.getFocus()  
281          fX, fY = f.getPanX(), f.getPanY()          fX, fY = f.getPanX(), f.getPanY()
282          f.setPan(fX+x/f.zoom,          f.setPan(fX-x/f.zoom,
283                   fY+y/f.zoom)                   fY-y/f.zoom)
284          main.chgFast(self.context.oldVS, -1)          self.context.main.chgFast(self.context.oldVS, -1)
285          self.context.setFastAnimation()          self.context.setFastAnimation()
286    
287  class MMScene:  class MMScene:

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26