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

wx.psmap: fix text background color

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

+ 14 - 6
gui/wxpython/gui_modules/psmap.py

@@ -1536,7 +1536,7 @@ class PsMapBufferedWindow(wx.Window):
             rot = float(textDict['rotate']) 
         else:
             rot = 0
-
+        
         fontsize = textDict['fontsize'] * self.currScale
         if textDict['background'] != 'none':
             background = textDict['background'] 
@@ -1546,19 +1546,27 @@ class PsMapBufferedWindow(wx.Window):
         pdc.RemoveId(drawId)
         pdc.SetId(drawId)
         pdc.BeginDrawing()
-        # doesn't work
+        
+        # border is not redrawn when zoom changes, why?
+##        if textDict['border'] != 'none' and not rot:
+##            units = UnitConversion(self)
+##            borderWidth = units.convert(value = textDict['width'],
+##                                        fromUnit = 'point', toUnit = 'pixel' ) * self.currScale
+##            pdc.SetPen(wx.Pen(colour = convertRGB(textDict['border']), width = borderWidth))
+##            pdc.DrawRectangle(*bounds)
+            
         if background:
-            pdc.SetBackground(wx.Brush(convertRGB(background)))
+            pdc.SetTextBackground(convertRGB(background))
             pdc.SetBackgroundMode(wx.SOLID)
         else:
-            pdc.SetBackground(wx.TRANSPARENT_BRUSH)
             pdc.SetBackgroundMode(wx.TRANSPARENT)
- 
+        
         fn = self.parent.makePSFont(textDict)
-
+        
         pdc.SetFont(fn)
         pdc.SetTextForeground(convertRGB(textDict['color']))        
         pdc.DrawRotatedText(textDict['text'], coords[0], coords[1], rot)
+        
         pdc.SetIdBounds(drawId, wx.Rect(*bounds))
         self.Refresh()
         pdc.EndDrawing()