@@ -1750,30 +1750,12 @@ def __init__(self, annotation, use_blit=False):
1750
1750
1751
1751
def save_offset (self ):
1752
1752
ann = self .annotation
1753
- x , y = ann .xyann
1754
- if isinstance (ann .anncoords , tuple ):
1755
- xcoord , ycoord = ann .anncoords
1756
- x1 , y1 = ann ._get_xy (self .canvas .renderer , x , y , xcoord )
1757
- x2 , y2 = ann ._get_xy (self .canvas .renderer , x , y , ycoord )
1758
- ox0 , oy0 = x1 , y2
1759
- else :
1760
- ox0 , oy0 = ann ._get_xy (self .canvas .renderer , x , y , ann .anncoords )
1761
-
1762
- self .ox , self .oy = ox0 , oy0
1763
- self .annotation .anncoords = "figure pixels"
1764
- self .update_offset (0 , 0 )
1753
+ self .ox , self .oy = ann .get_transform ().transform (ann .xyann )
1765
1754
1766
1755
def update_offset (self , dx , dy ):
1767
1756
ann = self .annotation
1768
- ann .xyann = self .ox + dx , self .oy + dy
1769
- x , y = ann .xyann
1770
-
1771
- def finalize_offset (self ):
1772
- loc_in_canvas = self .annotation .xyann
1773
- self .annotation .anncoords = "axes fraction"
1774
- pos_axes_fraction = self .annotation .axes .transAxes .inverted ()
1775
- pos_axes_fraction = pos_axes_fraction .transform_point (loc_in_canvas )
1776
- self .annotation .xyann = tuple (pos_axes_fraction )
1757
+ ann .xyann = ann .get_transform ().inverted ().transform (
1758
+ (self .ox + dx , self .oy + dy ))
1777
1759
1778
1760
1779
1761
if __name__ == "__main__" :
0 commit comments