Pārlūkot izejas kodu

wxGUI: fix zooming out for recenter mode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52373 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 13 gadi atpakaļ
vecāks
revīzija
eead88d24a
1 mainītis faili ar 10 papildinājumiem un 5 dzēšanām
  1. 10 5
      gui/wxpython/mapdisp/mapwindow.py

+ 10 - 5
gui/wxpython/mapdisp/mapwindow.py

@@ -983,11 +983,16 @@ class BufferedWindow(MapWindow, wx.Window):
         Debug.msg (5, "BufferedWindow.MouseAction(): wheel=%d" % wheel)
         # zoom 1/2 of the screen (TODO: settings)
         if zoomBehaviour == 0:  # zoom and recenter
-            # TODO: fix zooming out
-            begin = (current[0] - self.Map.width / 4,
-                     current[1] - self.Map.height / 4)
-            end   = (current[0] + self.Map.width / 4,
-                     current[1] + self.Map.height / 4)
+            if wheel > 0:
+                begin = (current[0] - self.Map.width / 4,
+                         current[1] - self.Map.height / 4)
+                end   = (current[0] + self.Map.width / 4,
+                         current[1] + self.Map.height / 4)
+            else:
+                begin = ((self.Map.width - current[0]) / 2,
+                         (self.Map.height - current[1]) / 2)
+                end = (begin[0] + self.Map.width / 2,
+                       begin[1] + self.Map.height / 2)
         elif zoomBehaviour == 1:  # zoom to current cursor position
             begin = (current[0]/2, current[1]/2)
             end = ((self.Map.width - current[0])/2 + current[0],