[177] update overlays for queues

This commit is contained in:
meisnate12 2022-10-31 12:28:26 -04:00
parent b493a843ad
commit 36ef657938
4 changed files with 17 additions and 14 deletions

View file

@ -1 +1 @@
1.17.3-develop176
1.17.3-develop177

View file

@ -27,6 +27,10 @@ templates:
- queue
- weight
- font_style
- horizontal_offset
- horizontal_align
- vertical_offset
- vertical_align
- stroke_width
- stroke_color
- back_color

View file

@ -436,13 +436,11 @@ class Overlay:
else:
return value
if new_cords is None:
ho = self.horizontal_offset
ha = self.horizontal_align
vo = self.vertical_offset
va = self.vertical_align
else:
ha, ho, va, vo = new_cords
ho = new_cords[0] if new_cords and self.horizontal_offset is None else self.horizontal_offset
ha = new_cords[1] if new_cords and self.horizontal_align is None else self.horizontal_align
vo = new_cords[2] if new_cords and self.vertical_offset is None else self.vertical_offset
va = new_cords[3] if new_cords and self.vertical_align is None else self.vertical_align
return get_cord(ho, canvas_box[0], box[0], ha), get_cord(vo, canvas_box[1], box[1], va)
def get_canvas(self, item):

View file

@ -777,9 +777,14 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
def parse_cords(data, parent, required=False):
horizontal_align = parse("Overlay", "horizontal_align", data["horizontal_align"], parent=parent,
options=["left", "center", "right"]) if "horizontal_align" in data else "left"
options=["left", "center", "right"]) if "horizontal_align" in data else None
if required and horizontal_align is None:
raise Failed(f"Overlay Error: {parent} horizontal_align is required")
vertical_align = parse("Overlay", "vertical_align", data["vertical_align"], parent=parent,
options=["top", "center", "bottom"]) if "vertical_align" in data else "top"
options=["top", "center", "bottom"]) if "vertical_align" in data else None
if required and vertical_align is None:
raise Failed(f"Overlay Error: {parent} vertical_align is required")
horizontal_offset = None
if "horizontal_offset" in data and data["horizontal_offset"] is not None:
@ -799,8 +804,6 @@ def parse_cords(data, parent, required=False):
elif horizontal_align == "center" and per and (x_off > 50 or x_off < -50):
raise Failed(f"{error} between -50% and 50%")
horizontal_offset = f"{x_off}%" if per else x_off
if horizontal_offset is None and horizontal_align == "center":
horizontal_offset = 0
if required and horizontal_offset is None:
raise Failed(f"Overlay Error: {parent} horizontal_offset is required")
@ -822,8 +825,6 @@ def parse_cords(data, parent, required=False):
elif vertical_align == "center" and per and (y_off > 50 or y_off < -50):
raise Failed(f"{error} between -50% and 50%")
vertical_offset = f"{y_off}%" if per else y_off
if vertical_offset is None and vertical_align == "center":
vertical_offset = 0
if required and vertical_offset is None:
raise Failed(f"Overlay Error: {parent} vertical_offset is required")