Test if exposed before using computed values in motion
In some cases, motion event is triggered before expose. So motion method should take care of such case. issue3755 review4301002
This commit is contained in:
1 parent
f30cf99bd0
commit
53e8a1dabe
3 files changed
+9
No files matched your search
@@ -65,6 +65,9 @@ class Bar(Graph):
|
||||
def motion(self, widget, event):
|
||||
super(Bar, self).motion(widget, event)
|
||||
|
||||
if not getattr(self, 'area', None):
|
||||
return
|
||||
|
||||
def intersect(bar, event):
|
||||
x = self.area.w * bar.x + self.area.x
|
||||
y = self.area.h * bar.y + self.area.y
|
||||
|
||||
@@ -154,6 +154,9 @@ class Line(Graph):
|
||||
cr.restore()
|
||||
|
||||
def motion(self, widget, event):
|
||||
if not getattr(self, 'area', None):
|
||||
return
|
||||
|
||||
nearest = None
|
||||
for point in self.points:
|
||||
x = point.x * self.area.w + self.area.x
|
||||
|
||||
@@ -108,6 +108,9 @@ class Pie(Graph):
|
||||
def motion(self, widget, event):
|
||||
super(Pie, self).motion(widget, event)
|
||||
|
||||
if not getattr(self, 'area', None):
|
||||
return
|
||||
|
||||
d = (event.x - self.centerx) ** 2 + (event.y - self.centery) ** 2
|
||||
if d > self.radius ** 2:
|
||||
self.popup.hide()
|
||||
|
||||
Reference in new issue
Block a user