Fix Widget element unable to find children element tooltips if the widget's parent(s) had been scrolled

This commit is contained in:
2026-09-04 10:31:02 -05:00
parent 8e7c6f8a19
commit 9d4bc89174

View File

@@ -24,7 +24,16 @@ module CyberarmEngine
# Enable child elements to display their tooltips # Enable child elements to display their tooltips
# but fall back to the Widget if no hit element has a tip # but fall back to the Widget if no hit element has a tip
def tip def tip
elements = hit_element?(window.mouse_x, window.mouse_y) parent_scroll_position = CyberarmEngine::Vector.new
element = self
while (parent_element = element.parent)
parent_scroll_position += parent_element.scroll_position
element = parent_element
end
elements = hit_element?(window.mouse_x - parent_scroll_position.x, window.mouse_y - parent_scroll_position.y)
return @tip unless elements return @tip unless elements