Skip to content

Commit

Permalink
fix: menu not selecting item under pointer after content updates
Browse files Browse the repository at this point in the history
ref #964
  • Loading branch information
tomasklaen committed Sep 3, 2024
1 parent 6b256b2 commit 0d2705b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/uosc/elements/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,6 @@ function Menu:render()
local ass = assdraw.ass_new()
local spacing = self.item_padding
local icon_size = self.font_size
local is_alive = self:is_alive()

---@param menu MenuStack
---@param x number
Expand All @@ -1228,8 +1227,7 @@ function Menu:render()
bx = bx,
by = by + self.padding,
}
local cursor_is_moving = self.mouse_nav and cursor.distance > 10
local blur_action_index = cursor_is_moving and menu.action_index ~= nil
local blur_action_index = self.mouse_nav and menu.action_index ~= nil

-- Background
ass:rect(menu_rect.ax, menu_rect.ay, menu_rect.bx, menu_rect.by, {
Expand Down Expand Up @@ -1457,7 +1455,7 @@ function Menu:render()
end

-- Select hovered item
if is_current and cursor_is_moving and item.selectable ~= false
if is_current and self.mouse_nav and item.selectable ~= false
-- Do not select items if cursor is moving towards a submenu
and (not submenu_rect or not cursor:direction_to_rectangle_distance(submenu_rect))
and (submenu_is_hovered or get_point_to_rectangle_proximity(cursor, item_rect_hitbox) == 0) then
Expand Down

0 comments on commit 0d2705b

Please sign in to comment.