v1.0.8.18: Visibility 'Hide unless hovered' option

Made-with: Cursor
This commit is contained in:
2026-02-28 15:09:42 -05:00
parent 1c25918c22
commit 3618fc5121
6 changed files with 34 additions and 5 deletions
+7
View File
@@ -256,6 +256,13 @@ namespace HSUI.Interface
{
return (new List<Vector2>(), new List<Vector2>());
}
/// <summary>Returns the screen-space bounding box of the element for hover detection (e.g. visibility "hide unless hovered").</summary>
public virtual (Vector2 min, Vector2 max) GetScreenBounds(Vector2 origin)
{
var basePos = origin + ParentPos();
return (basePos + MinPos, basePos + MaxPos);
}
#endregion
}
@@ -1,3 +1,4 @@
using Dalamud.Bindings.ImGui;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.ClientState.Objects.SubKinds;
@@ -6,12 +7,17 @@ using HSUI.Config.Attributes;
using HSUI.Interface.GeneralElements;
using HSUI.Interface.Party;
using System.Linq;
using System.Numerics;
namespace HSUI.Interface
{
[Exportable(false)]
public class VisibilityConfig : PluginConfigObject
{
[Checkbox("Hide unless hovered", help = "When enabled, the element is hidden until the cursor hovers over it. Requires HUD to be locked.")]
[Order(4)]
public bool HideUnlessHovered = false;
[Checkbox("Hide outside of combat")]
[Order(5)]
public bool HideOutsideOfCombat = false;
@@ -96,6 +102,18 @@ namespace HSUI.Interface
if (element != null && element.GetType() == typeof(PlayerCastbarHud)) { return true; }
if (element != null && !element.GetConfig().Enabled) { return false; }
// Hide unless hovered: element is visible only when the cursor is over it
if (HideUnlessHovered && element is DraggableHudElement draggable)
{
Vector2 origin = ImGui.GetMainViewport().Size / 2f;
var hudOptions = ConfigurationManager.Instance?.GetConfigObject<HUDOptionsConfig>();
if (hudOptions != null && hudOptions.UseGlobalHudShift)
origin += hudOptions.HudOffset;
var (min, max) = draggable.GetScreenBounds(origin);
if (!ImGui.IsMouseHoveringRect(min, max))
return false;
}
// Alliance frames only matter in alliance raids (duty). HideInDuty would hide them exactly when needed.
bool isAllianceFrames = element != null && element.GetType() == typeof(AllianceFramesHud);
@@ -144,6 +162,7 @@ namespace HSUI.Interface
{
Enabled = config.Enabled;
HideUnlessHovered = config.HideUnlessHovered;
HideOutsideOfCombat = config.HideOutsideOfCombat;
HideInCombat = config.HideInCombat;
HideInGoldSaucer = config.HideInGoldSaucer;