@@ -67,7 +67,10 @@ def __init__(self, figure):
67
67
self ._agg_draw_pending = False
68
68
69
69
def drawRectangle (self , rect ):
70
- self ._drawRect = rect
70
+ if rect is not None :
71
+ self ._drawRect = [pt / self ._dpi_ratio for pt in rect ]
72
+ else :
73
+ self ._drawRect = None
71
74
self .update ()
72
75
73
76
def paintEvent (self , e ):
@@ -112,7 +115,9 @@ def paintEvent(self, e):
112
115
113
116
# draw the zoom rectangle to the QPainter
114
117
if self ._drawRect is not None :
115
- p .setPen (QtGui .QPen (QtCore .Qt .black , 1 , QtCore .Qt .DotLine ))
118
+ pen = QtGui .QPen (QtCore .Qt .black , 1 / self ._dpi_ratio ,
119
+ QtCore .Qt .DotLine )
120
+ p .setPen (pen )
116
121
x , y , w , h = self ._drawRect
117
122
p .drawRect (x , y , w , h )
118
123
p .end ()
@@ -149,7 +154,9 @@ def paintEvent(self, e):
149
154
150
155
# draw the zoom rectangle to the QPainter
151
156
if self ._drawRect is not None :
152
- p .setPen (QtGui .QPen (QtCore .Qt .black , 1 , QtCore .Qt .DotLine ))
157
+ pen = QtGui .QPen (QtCore .Qt .black , 1 / self ._dpi_ratio ,
158
+ QtCore .Qt .DotLine )
159
+ p .setPen (pen )
153
160
x , y , w , h = self ._drawRect
154
161
p .drawRect (x , y , w , h )
155
162
0 commit comments