@@ -81,7 +81,7 @@ class Label(LabelBase):
81
81
:param str label_direction: string defining the label text orientation. There are 5
82
82
configurations possibles ``LTR``-Left-To-Right ``RTL``-Right-To-Left
83
83
``UPD``-Upside Down ``UPR``-Upwards ``DWR``-Downwards. It defaults to ``LTR``
84
- :param bool verbose: print debugging information in some internal functions. Default to False
84
+ :param bool verbose: print debugging information in some internal functions. Default to False
85
85
86
86
"""
87
87
@@ -185,6 +185,7 @@ def _reset_text(
185
185
y_offset = loose_y_offset
186
186
187
187
# Calculate the background size including padding
188
+ tight_box_x = box_x
188
189
box_x = box_x + self ._padding_left + self ._padding_right
189
190
box_y = box_y + self ._padding_top + self ._padding_bottom
190
191
@@ -245,17 +246,23 @@ def _reset_text(
245
246
# Update bounding_box values. Note: To be consistent with label.py,
246
247
# this is the bounding box for the text only, not including the background.
247
248
if self ._label_direction in ("UPR" , "DWR" ):
249
+ if self ._label_direction == "UPR" :
250
+ top = self ._padding_right
251
+ left = self ._padding_top
252
+ if self ._label_direction == "DWR" :
253
+ top = self ._padding_left
254
+ left = self ._padding_bottom
248
255
self ._bounding_box = (
249
- self ._tilegrid .x ,
250
- self ._tilegrid .y ,
256
+ self ._tilegrid .x + left ,
257
+ self ._tilegrid .y + top ,
251
258
tight_box_y ,
252
- box_x ,
259
+ tight_box_x ,
253
260
)
254
261
else :
255
262
self ._bounding_box = (
256
- self ._tilegrid .x ,
257
- self ._tilegrid .y ,
258
- box_x ,
263
+ self ._tilegrid .x + self . _padding_left ,
264
+ self ._tilegrid .y + self . _padding_top ,
265
+ tight_box_x ,
259
266
tight_box_y ,
260
267
)
261
268
0 commit comments