v1.0.8.18: Visibility 'Hide unless hovered' option
Made-with: Cursor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user