mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
BUG: Fix blitting behavior in canvastools
This commit is contained in:
@@ -23,8 +23,8 @@ class CanvasToolBase(object):
|
||||
useblit = True if mpl.backends.backend.endswith('Agg') else False
|
||||
self.useblit = useblit
|
||||
if useblit:
|
||||
bbox = self.ax.bbox
|
||||
self.img_background = self.canvas.copy_from_bbox(bbox)
|
||||
self.canvas.draw()
|
||||
self.img_background = self.canvas.copy_from_bbox(self.ax.bbox)
|
||||
|
||||
def connect_event(self, event, callback):
|
||||
"""Connect callback with an event.
|
||||
|
||||
@@ -23,9 +23,6 @@ class LineTool(CanvasToolBase):
|
||||
lineprops=None):
|
||||
super(LineTool, self).__init__(ax)
|
||||
|
||||
#TODO: Figure out how to cleanly restore image background for useblit
|
||||
self.useblit = False
|
||||
|
||||
props = dict(color='r', linewidth=1, alpha=0.4, solid_capstyle='butt')
|
||||
props.update(lineprops if lineprops is not None else {})
|
||||
self.linewidth = props['linewidth']
|
||||
@@ -105,8 +102,9 @@ class LineTool(CanvasToolBase):
|
||||
|
||||
def redraw(self):
|
||||
if self.useblit:
|
||||
# self.canvas.restore_region(self.img_background)
|
||||
self.ax.draw_artist(self._line)
|
||||
self.canvas.restore_region(self.img_background)
|
||||
for artist in self._artists:
|
||||
self.ax.draw_artist(artist)
|
||||
self.canvas.blit(self.ax.bbox)
|
||||
else:
|
||||
self.canvas.draw_idle()
|
||||
|
||||
Reference in New Issue
Block a user