@@ -272,7 +272,6 @@ def _update_text(self, new_text): # pylint: disable=too-many-locals
272
272
self ._boundingbox = (left , top , left + right , bottom - top )
273
273
self [0 ] = self ._create_background_box (lines , y_offset )
274
274
275
-
276
275
@property
277
276
def bounding_box (self ):
278
277
"""An (x, y, w, h) tuple that completely covers all glyphs. The
@@ -316,11 +315,8 @@ def text(self):
316
315
def text (self , new_text ):
317
316
try :
318
317
current_anchored_position = self .anchored_position
319
- print ('start anchored_position: {}' .format (self .anchored_position ))
320
- print ('self.y: {}, self._scale: {}' .format (self .y , self ._scale ))
321
318
self ._update_text (str (new_text ))
322
319
self .anchored_position = current_anchored_position
323
- print ('end anchored_position: {}' .format (self .anchored_position ))
324
320
except RuntimeError :
325
321
raise RuntimeError ("Text length exceeds max_glyphs" )
326
322
@@ -357,10 +353,13 @@ def anchored_position(self):
357
353
"""Position relative to the anchor_point. Tuple containing x,y
358
354
pixel coordinates."""
359
355
return (
360
- int (self .x + (self ._anchor_point [0 ] * self ._boundingbox [2 ] * self ._scale ) ),
361
- int (self .y + (self ._anchor_point [1 ] * self ._boundingbox [3 ] * self ._scale )
362
- - round ( (self ._boundingbox [3 ] * self ._scale )/ 2.0 ))
363
- )
356
+ int (self .x + (self ._anchor_point [0 ] * self ._boundingbox [2 ] * self ._scale )),
357
+ int (
358
+ self .y
359
+ + (self ._anchor_point [1 ] * self ._boundingbox [3 ] * self ._scale )
360
+ - round ((self ._boundingbox [3 ] * self ._scale ) / 2.0 )
361
+ ),
362
+ )
364
363
365
364
@anchored_position .setter
366
365
def anchored_position (self , new_position ):
@@ -370,12 +369,9 @@ def anchored_position(self, new_position):
370
369
)
371
370
new_y = int (
372
371
new_position [1 ]
373
- - ( self ._anchor_point [1 ] * self ._boundingbox [3 ] * self ._scale )
374
- + round ( (self ._boundingbox [3 ] * self ._scale )/ 2.0 )
372
+ - (self ._anchor_point [1 ] * self ._boundingbox [3 ] * self ._scale )
373
+ + round ((self ._boundingbox [3 ] * self ._scale ) / 2.0 )
375
374
)
376
-
377
- print ('new_y: {}, new_position[1]: {}, self._anchor_point[1]: {}, self._boundingbox[3]: {}' .format (new_y , new_position [1 ], self ._anchor_point [1 ], self ._boundingbox [3 ]))
378
-
379
375
self ._boundingbox = (new_x , new_y , self ._boundingbox [2 ], self ._boundingbox [3 ])
380
376
self .x = new_x
381
377
self .y = new_y
0 commit comments