@@ -1744,30 +1744,12 @@ def __init__(self, annotation, use_blit=False):
17441744
17451745 def save_offset (self ):
17461746 ann = self .annotation
1747- x , y = ann .xyann
1748- if isinstance (ann .anncoords , tuple ):
1749- xcoord , ycoord = ann .anncoords
1750- x1 , y1 = ann ._get_xy (self .canvas .renderer , x , y , xcoord )
1751- x2 , y2 = ann ._get_xy (self .canvas .renderer , x , y , ycoord )
1752- ox0 , oy0 = x1 , y2
1753- else :
1754- ox0 , oy0 = ann ._get_xy (self .canvas .renderer , x , y , ann .anncoords )
1755-
1756- self .ox , self .oy = ox0 , oy0
1757- self .annotation .anncoords = "figure pixels"
1758- self .update_offset (0 , 0 )
1747+ self .ox , self .oy = ann .get_transform ().transform (ann .xyann )
17591748
17601749 def update_offset (self , dx , dy ):
17611750 ann = self .annotation
1762- ann .xyann = self .ox + dx , self .oy + dy
1763- x , y = ann .xyann
1764-
1765- def finalize_offset (self ):
1766- loc_in_canvas = self .annotation .xyann
1767- self .annotation .anncoords = "axes fraction"
1768- pos_axes_fraction = self .annotation .axes .transAxes .inverted ()
1769- pos_axes_fraction = pos_axes_fraction .transform_point (loc_in_canvas )
1770- self .annotation .xyann = tuple (pos_axes_fraction )
1751+ ann .xyann = ann .get_transform ().inverted ().transform (
1752+ (self .ox + dx , self .oy + dy ))
17711753
17721754
17731755if __name__ == "__main__" :
0 commit comments