@@ -272,7 +272,6 @@ def _update_text(self, new_text): # pylint: disable=too-many-locals
272272 self ._boundingbox = (left , top , left + right , bottom - top )
273273 self [0 ] = self ._create_background_box (lines , y_offset )
274274
275-
276275 @property
277276 def bounding_box (self ):
278277 """An (x, y, w, h) tuple that completely covers all glyphs. The
@@ -316,11 +315,8 @@ def text(self):
316315 def text (self , new_text ):
317316 try :
318317 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 ))
321318 self ._update_text (str (new_text ))
322319 self .anchored_position = current_anchored_position
323- print ('end anchored_position: {}' .format (self .anchored_position ))
324320 except RuntimeError :
325321 raise RuntimeError ("Text length exceeds max_glyphs" )
326322
@@ -357,10 +353,13 @@ def anchored_position(self):
357353 """Position relative to the anchor_point. Tuple containing x,y
358354 pixel coordinates."""
359355 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+ )
364363
365364 @anchored_position .setter
366365 def anchored_position (self , new_position ):
@@ -370,12 +369,9 @@ def anchored_position(self, new_position):
370369 )
371370 new_y = int (
372371 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 )
375374 )
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-
379375 self ._boundingbox = (new_x , new_y , self ._boundingbox [2 ], self ._boundingbox [3 ])
380376 self .x = new_x
381377 self .y = new_y
0 commit comments