Sfoglia il codice sorgente

wxGUI: fix trimming legend when it's too close to the edge and -d flagis active

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68958 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 9 anni fa
parent
commit
b0b49a50b3
1 ha cambiato i file con 8 aggiunte e 4 eliminazioni
  1. 8 4
      gui/wxpython/mapwin/decorations.py

+ 8 - 4
gui/wxpython/mapwin/decorations.py

@@ -242,8 +242,8 @@ class LegendController(OverlayController):
         OverlayController.__init__(self, renderer, giface)
         self._name = 'legend'
         self._removeLabel = _("Remove legend")
-        # TODO: synchronize with d.legend?
-        self._defaultAt = 'at=5,50,7,10'
+        # default is in the center to avoid trimmed legend on the edge
+        self._defaultAt = 'at=5,50,47,50'
         self._cmd = ['d.legend', self._defaultAt]
 
     def GetPlacement(self, screensize):
@@ -256,8 +256,12 @@ class LegendController(OverlayController):
         for param in self._cmd:
             if not param.startswith('at'):
                 continue
-            b, t, l, r = [float(number) for number in param.split(
-                '=')[1].split(',')]  # pylint: disable-msg=W0612
+            # if the at= is the default, we will move the legend from the center to bottom left
+            if param == self._defaultAt:
+                b, t, l, r = 5, 50, 7, 10
+            else:
+                b, t, l, r = [float(number) for number in param.split(
+                    '=')[1].split(',')]  # pylint: disable-msg=W0612
             x = int((l / 100.) * screensize[0])
             y = int((1 - t / 100.) * screensize[1])