using HSUI.Interface;
namespace HSUI.Helpers
{
///
/// Tracks which HUD element currently has its context menu open, so visibility can be ignored for that element
/// while the menu is open (e.g. "hide unless hovered" would otherwise hide the element when the mouse moves to the menu).
///
public static class ContextMenuVisibilityHelper
{
private static HudElement? _elementWithContextMenuOpen;
/// Call when opening a context menu for this element.
public static void SetContextMenuOpen(HudElement? element)
{
_elementWithContextMenuOpen = element;
}
/// True if the given element currently has its context menu open.
public static bool IsContextMenuOpenFor(HudElement element)
{
return _elementWithContextMenuOpen != null && _elementWithContextMenuOpen == element;
}
}
}