Skip to content

Commit

Permalink
Make hover time quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
Banane9 committed Dec 18, 2024
1 parent 1b6b56c commit eb25262
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions MonkeyLoader.Resonite.Integration/UI/Tooltips/TooltipConfig.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Elements.Core;
using Elements.Quantity;
using FrooxEngine;
using MonkeyLoader.Configuration;
using MonkeyLoader.Resonite.Configuration;
using System;

namespace MonkeyLoader.Resonite.UI.Tooltips
Expand All @@ -13,16 +15,17 @@ public sealed class TooltipConfig : SingletonConfigSection<TooltipConfig>
private static readonly DefiningConfigKey<colorX> _backgroundColorKey = new("BackgroundColor", "Sets the background color of a tooltip.", () => RadiantUI_Constants.BG_COLOR);
private static readonly DefiningConfigKey<bool> _enableDebugButtonData = new("EnableDebugButtonData", "Controls whether debug data for missing button tooltips is logged. Useful when wanting to add new labels.", () => false);
private static readonly DefiningConfigKey<bool> _enableNonLocalTooltips = new("EnableNonLocalTooltips", "When enabled, tooltips are created as regular slots instead of local ones. Can be used to show them to others. Experimental.", () => false);
private static readonly DefiningConfigKey<colorX> _textColorKey = new("TextColor", "Sets the text color of a tooltip.", () => RadiantUI_Constants.TEXT_COLOR);

private static readonly DefiningConfigKey<float> _textScaleKey = new("TextSize", "Sets the size of the text on a tooltip.", () => 1f)
private static readonly DefiningConfigKey<float> _hoverTime = new("Hover Time", "The amount of time required to hover on the button before the tooltip opens.", () => 0.5f)
{
new ConfigKeyRange<float>(.5f, 4)
new ConfigKeyQuantity<float, Time>(new UnitConfiguration("s", "0", " ", ["s", "ms"]), null, 0, 2)
};

private static readonly DefiningConfigKey<float> _hoverTime = new("Hover Time", "The amount of time required to hover on the button before the tooltip opens.", () => 0.5f)
private static readonly DefiningConfigKey<colorX> _textColorKey = new("TextColor", "Sets the text color of a tooltip.", () => RadiantUI_Constants.TEXT_COLOR);

private static readonly DefiningConfigKey<float> _textScaleKey = new("TextSize", "Sets the size of the text on a tooltip.", () => 1f)
{
new ConfigKeyRange<float>(0, 2)
new ConfigKeyRange<float>(.5f, 4)
};

/// <summary>
Expand All @@ -43,6 +46,8 @@ public sealed class TooltipConfig : SingletonConfigSection<TooltipConfig>
/// </summary>
public bool EnableNonLocalTooltips => _enableNonLocalTooltips;

public float HoverTime => _hoverTime;

/// <inheritdoc/>
public override string Id => "Tooltips";

Expand All @@ -56,8 +61,6 @@ public sealed class TooltipConfig : SingletonConfigSection<TooltipConfig>
/// </summary>
public float TextScale => _textScaleKey;

public float HoverTime => _hoverTime;

/// <inheritdoc/>
public override Version Version { get; } = new Version(1, 0, 0);
}
Expand Down

0 comments on commit eb25262

Please sign in to comment.