@@ -280,7 +280,7 @@ def contains(self, mouseevent):
280
280
281
281
def _get_xy_display (self ):
282
282
'get the (possibly unit converted) transformed x, y in display coords'
283
- x , y = self .get_position ()
283
+ x , y = self .get_unitless_position ()
284
284
return self .get_transform ().transform_point ((x , y ))
285
285
286
286
def _get_multialignment (self ):
@@ -536,8 +536,8 @@ def update_bbox_position_size(self, renderer):
536
536
537
537
trans = self .get_transform ()
538
538
539
- # don't use self.get_position here, which refers to text position
540
- # in Text, and dash position in TextWithDash:
539
+ # don't use self.get_unitless_position here, which refers to text
540
+ # position in Text, and dash position in TextWithDash:
541
541
posx = float (self .convert_xunits (self ._x ))
542
542
posy = float (self .convert_yunits (self ._y ))
543
543
@@ -877,12 +877,20 @@ def get_horizontalalignment(self):
877
877
"""
878
878
return self ._horizontalalignment
879
879
880
- def get_position (self ):
881
- "Return the position of the text as a tuple (*x*, *y*)"
880
+ def get_unitless_position (self ):
881
+ "Return the unitless position of the text as a tuple (*x*, *y*)"
882
+ # This will get the position with all unit information stripped away.
883
+ # This is here for convienience since it is done in several locations.
882
884
x = float (self .convert_xunits (self ._x ))
883
885
y = float (self .convert_yunits (self ._y ))
884
886
return x , y
885
887
888
+ def get_position (self ):
889
+ "Return the position of the text as a tuple (*x*, *y*)"
890
+ # This should return the same data (possible unitized) as was
891
+ # specified with 'set_x' and 'set_y'.
892
+ return self ._x , self ._y
893
+
886
894
def get_prop_tup (self ):
887
895
"""
888
896
Return a hashable tuple of properties.
@@ -891,7 +899,7 @@ def get_prop_tup(self):
891
899
want to cache derived information about text (e.g., layouts) and
892
900
need to know if the text has changed.
893
901
"""
894
- x , y = self .get_position ()
902
+ x , y = self .get_unitless_position ()
895
903
return (x , y , self .get_text (), self ._color ,
896
904
self ._verticalalignment , self ._horizontalalignment ,
897
905
hash (self ._fontproperties ),
@@ -950,7 +958,7 @@ def get_window_extent(self, renderer=None, dpi=None):
950
958
raise RuntimeError ('Cannot get window extent w/o renderer' )
951
959
952
960
bbox , info , descent = self ._get_layout (self ._renderer )
953
- x , y = self .get_position ()
961
+ x , y = self .get_unitless_position ()
954
962
x , y = self .get_transform ().transform_point ((x , y ))
955
963
bbox = bbox .translated (x , y )
956
964
if dpi is not None :
@@ -1365,12 +1373,20 @@ def __init__(self,
1365
1373
1366
1374
#self.set_bbox(dict(pad=0))
1367
1375
1368
- def get_position (self ):
1369
- "Return the position of the text as a tuple (*x*, *y*)"
1376
+ def get_unitless_position (self ):
1377
+ "Return the unitless position of the text as a tuple (*x*, *y*)"
1378
+ # This will get the position with all unit information stripped away.
1379
+ # This is here for convienience since it is done in several locations.
1370
1380
x = float (self .convert_xunits (self ._dashx ))
1371
1381
y = float (self .convert_yunits (self ._dashy ))
1372
1382
return x , y
1373
1383
1384
+ def get_position (self ):
1385
+ "Return the position of the text as a tuple (*x*, *y*)"
1386
+ # This should return the same data (possibly unitized) as was
1387
+ # specified with set_x and set_y
1388
+ return self ._dashx , self ._dashy
1389
+
1374
1390
def get_prop_tup (self ):
1375
1391
"""
1376
1392
Return a hashable tuple of properties.
@@ -1402,7 +1418,7 @@ def update_coords(self, renderer):
1402
1418
with respect to the actual canvas's coordinates we need to map
1403
1419
back and forth.
1404
1420
"""
1405
- dashx , dashy = self .get_position ()
1421
+ dashx , dashy = self .get_unitless_position ()
1406
1422
dashlength = self .get_dashlength ()
1407
1423
# Shortcircuit this process if we don't have a dash
1408
1424
if dashlength == 0.0 :
0 commit comments