Fixed Element's x and y position offset by their containers margin_left and/or margin_top, fixed containers 'inheriting' their parents and/or grandparents margin_left/top causing them to have an outer_height greater than it should be (needs a little more work.)

This commit is contained in:
2026-04-13 20:00:24 -05:00
parent 971ac5ff34
commit a5636c82b3
6 changed files with 63 additions and 46 deletions

View File

@@ -62,32 +62,32 @@ module CyberarmEngine
def update
# TOP
@top.x = @element.x + @element.styled(:border_thickness_left)
@top.y = @element.y
@top.x = @element.x + @element.styled(:margin_left) + @element.styled(:border_thickness_left)
@top.y = @element.y + @element.styled(:margin_top)
@top.z = @element.z
@top.width = @element.width - @element.styled(:border_thickness_left)
@top.height = @element.styled(:border_thickness_top)
# RIGHT
@right.x = @element.x + @element.width
@right.y = @element.y + @element.styled(:border_thickness_top)
@right.x = @element.x + @element.styled(:margin_left) + @element.width
@right.y = @element.y + @element.styled(:margin_top) + @element.styled(:border_thickness_top)
@right.z = @element.z
@right.width = -@element.styled(:border_thickness_right)
@right.height = @element.height - @element.styled(:border_thickness_top)
# BOTTOM
@bottom.x = @element.x
@bottom.y = @element.y + @element.height
@bottom.x = @element.x + @element.styled(:margin_left)
@bottom.y = @element.y + @element.styled(:margin_top) + @element.height
@bottom.z = @element.z
@bottom.width = @element.width - @element.styled(:border_thickness_right)
@bottom.height = -@element.styled(:border_thickness_bottom)
# LEFT
@left.x = @element.x
@left.y = @element.y
@left.x = @element.x + @element.styled(:margin_left)
@left.y = @element.y + @element.styled(:margin_top)
@left.z = @element.z
@left.width = @element.styled(:border_thickness_left)