Fixed ListBox/Menu not accounting for its border

This commit is contained in:
2026-04-15 22:08:27 -05:00
parent 3375d2d224
commit b694269409
2 changed files with 4 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ module CyberarmEngine
def show_menu
@menu.clear do
@menu.style.width = width
@menu.style.width = width - (@menu.styled(:border_thickness_left) + @menu.styled(:border_thickness_right))
@items.each do |item|
# prevent already selected item from appearing in list

View File

@@ -11,10 +11,10 @@ module CyberarmEngine
# FIXME: properly find scrollable parent, if any.
parent_scroll_top = parent&.parent ? parent.parent.scroll_top : 0
@x = @parent.x
@y = parent_scroll_top + @parent.y + @parent.height
@x = @parent.x + @parent.styled(:border_thickness_left)
@y = parent_scroll_top + @parent.y + @parent.height + @parent.styled(:border_thickness_top)
@y = (parent_scroll_top + @parent.y) - height if @y + height > window.height
@y = (parent_scroll_top + @parent.y + @parent.styled(:border_thickness_top)) - height if @y + height > window.height
end
def show