mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 09:15:21 +00:00
Small fix for text alignment in scheduler
This commit is contained in:
@@ -98,21 +98,14 @@ class Scheduler:
|
|||||||
|
|
||||||
# figuring text alignment
|
# figuring text alignment
|
||||||
style_name = td.getAttribute("stylename")
|
style_name = td.getAttribute("stylename")
|
||||||
if (
|
style = styles[style_name] if style_name else {}
|
||||||
style_name
|
if style_name and "vertical-align" in style and style["vertical-align"] != "automatic":
|
||||||
and "vertical-align" in styles[style_name]
|
vertical_align = style["vertical-align"]
|
||||||
and styles[style_name]["vertical-align"] != "automatic"
|
|
||||||
):
|
|
||||||
vertical_align = styles[style_name]["vertical-align"]
|
|
||||||
else:
|
else:
|
||||||
vertical_align = "bottom"
|
vertical_align = "bottom"
|
||||||
|
|
||||||
if (
|
if style_name and "text-align" in style and style["text-align"] != "automatic":
|
||||||
style_name
|
horizontal_align = style["text-align"]
|
||||||
and "text-align" in styles[style_name]
|
|
||||||
and styles[style_name]["text-align"] != "automatic"
|
|
||||||
):
|
|
||||||
horizontal_align = styles[style_name]["text-align"]
|
|
||||||
horizontal_align = "middle" if horizontal_align == "center" else horizontal_align
|
horizontal_align = "middle" if horizontal_align == "center" else horizontal_align
|
||||||
else:
|
else:
|
||||||
horizontal_align = "left"
|
horizontal_align = "left"
|
||||||
@@ -122,6 +115,9 @@ class Scheduler:
|
|||||||
else:
|
else:
|
||||||
box_alignment = f"{vertical_align}-{horizontal_align}"
|
box_alignment = f"{vertical_align}-{horizontal_align}"
|
||||||
|
|
||||||
|
# for future use
|
||||||
|
wrap_text = style.get("wrap-option", None) == "wrap"
|
||||||
|
|
||||||
# drawing cells and text
|
# drawing cells and text
|
||||||
for i in range(0, repeat):
|
for i in range(0, repeat):
|
||||||
width = sum(column_widths[tdi : tdi + int(column_span)])
|
width = sum(column_widths[tdi : tdi + int(column_span)])
|
||||||
@@ -145,7 +141,7 @@ class Scheduler:
|
|||||||
|
|
||||||
if box_alignment.startswith("top"):
|
if box_alignment.startswith("top"):
|
||||||
text_position[1] = y + self.padding
|
text_position[1] = y + self.padding
|
||||||
elif box_alignment == "center":
|
elif box_alignment.startswith("middle") or box_alignment == "center":
|
||||||
text_position[1] = y + height / 2
|
text_position[1] = y + height / 2
|
||||||
elif box_alignment.startswith("bottom"):
|
elif box_alignment.startswith("bottom"):
|
||||||
text_position[1] = y + height - self.padding
|
text_position[1] = y + height - self.padding
|
||||||
|
|||||||
Reference in New Issue
Block a user