Преглед на файлове

wxGUI/wxpsmap: reopened bug https://trac.osgeo.org/grass/ticket/1547 hopefully fixed

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50518 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová преди 13 години
родител
ревизия
42ce983dec
променени са 1 файла, в които са добавени 17 реда и са изтрити 14 реда
  1. 17 14
      gui/wxpython/psmap/frame.py

+ 17 - 14
gui/wxpython/psmap/frame.py

@@ -1451,20 +1451,23 @@ class PsMapBufferedWindow(wx.Window):
 
 
             if self.mouse['use'] == 'zoomout':
-                zoomFactor = min(rW/cW, rH/cH) 
-            if rW/rH > cW/cH:
-                yView = rect.GetY() - (rW*(cH/cW) - rH)/2
-                xView = rect.GetX()
-                
-                if self.mouse['use'] == 'zoomout':
-                    x,y = rect.GetX() + (rW-(cW/cH)*rH)/2, rect.GetY()
-                    xView, yView = -x, -y
-            else:
-                xView = rect.GetX() - (rH*(cW/cH) - rW)/2
-                yView = rect.GetY()
-                if self.mouse['use'] == 'zoomout':
-                    x,y = rect.GetX(), rect.GetY() + (rH-(cH/cW)*rW)/2
-                    xView, yView = -x, -y
+                zoomFactor = min(rW/cW, rH/cH)
+            try:
+                if rW/rH > cW/cH:
+                    yView = rect.GetY() - (rW*(cH/cW) - rH)/2
+                    xView = rect.GetX()
+                    
+                    if self.mouse['use'] == 'zoomout':
+                        x,y = rect.GetX() + (rW-(cW/cH)*rH)/2, rect.GetY()
+                        xView, yView = -x, -y
+                else:
+                    xView = rect.GetX() - (rH*(cW/cH) - rW)/2
+                    yView = rect.GetY()
+                    if self.mouse['use'] == 'zoomout':
+                        x,y = rect.GetX(), rect.GetY() + (rH-(cH/cW)*rW)/2
+                        xView, yView = -x, -y
+            except ZeroDivisionError:
+                xView, yView = rect.GetX(), rect.GetY()
         return zoomFactor, (int(xView), int(yView))