[Thuban-commits] r2879 - in trunk/thuban: . Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Jun 27 01:16:12 CEST 2009


Author: dpinte
Date: 2009-06-27 01:16:11 +0200 (Sat, 27 Jun 2009)
New Revision: 2879

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Thuban/UI/view.py
Log:
2009-06-27 Didrik Pinte <dpinte at dipole-consulting.com>

  * Thuban/UI/view.py : added mouse wheel zoom support



Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2009-06-02 11:06:15 UTC (rev 2878)
+++ trunk/thuban/ChangeLog	2009-06-26 23:16:11 UTC (rev 2879)
@@ -1,3 +1,7 @@
+2009-06-27 Didrik Pinte <dpinte at dipole-consulting.com>
+
+  * Thuban/UI/view.py : added mouse wheel zoom support
+
 2009-06-02 Didrik Pinte <dpinte at dipole-consulting.com>
 
   * Thuban/UI/projlist.py : removed called to inexistant __del__ method on

Modified: trunk/thuban/Thuban/UI/view.py
===================================================================
--- trunk/thuban/Thuban/UI/view.py	2009-06-02 11:06:15 UTC (rev 2878)
+++ trunk/thuban/Thuban/UI/view.py	2009-06-26 23:16:11 UTC (rev 2879)
@@ -127,6 +127,7 @@
         self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMiddleDown)
         self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleUp)
         self.Bind(wx.EVT_MOTION, self.OnMotion)
+        self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
         self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
         self.Bind(wx.EVT_SIZE, self.OnSize)
         self.Bind(wx.EVT_IDLE, self.OnIdle)
@@ -418,6 +419,16 @@
 
     def OnLeaveWindow(self, event):
         self.set_current_position(None)
+        
+    
+    def OnMouseWheel(self, event):
+        """
+        Manages the zoom on wheel event
+        """
+        if event.GetWheelRotation() > 0:
+            factor = 2
+        else: factor = 1.0/2.0
+        self.ZoomFactor(factor)
 
     def OnSize(self, event):
         # the window's size has changed. We have to get a new bitmap. If



More information about the Thuban-commits mailing list