Combo highlight config, tooltips, nameplates, hotbars fixes
- Combo highlight: configurable color, glow, line style (solid/dashed/dotted), thickness - Tooltips: font selection, scaling slider, improved wrap/cramping handling - Nameplates: custom quest icons with config, position smoothing fix for jitter - Hotbars: hide keybinds on empty slots, combo highlight within icon bounds - HudHelper: restore default nameplates on plugin disable Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+23
-11
@@ -42,8 +42,8 @@ namespace HSUI.Helpers
|
||||
}
|
||||
#endregion
|
||||
|
||||
private float MaxWidth => 340 * ImGuiHelpers.GlobalScale;
|
||||
private float Margin => 5 * ImGuiHelpers.GlobalScale;
|
||||
private float MaxWidth => Math.Max(160, 340 * ImGuiHelpers.GlobalScale * _config.TooltipScale);
|
||||
private float Margin => Math.Max(4, 5 * ImGuiHelpers.GlobalScale * _config.TooltipScale);
|
||||
|
||||
private TooltipsConfig _config => ConfigurationManager.Instance.GetConfigObject<TooltipsConfig>();
|
||||
|
||||
@@ -95,7 +95,8 @@ namespace HSUI.Helpers
|
||||
_currentTooltipTitle += " (ID: " + id + ")";
|
||||
}
|
||||
|
||||
using (FontsManager.Instance.PushFont(FontsConfig.DefaultSmallFontKey))
|
||||
string fontId = _config.FontID ?? FontsConfig.DefaultSmallFontKey;
|
||||
using (FontsManager.Instance.PushFont(fontId))
|
||||
{
|
||||
_titleSize = ImGui.CalcTextSize(_currentTooltipTitle, false, MaxWidth);
|
||||
_titleSize.Y += Margin;
|
||||
@@ -103,7 +104,8 @@ namespace HSUI.Helpers
|
||||
}
|
||||
|
||||
// calculate text size
|
||||
using (FontsManager.Instance.PushFont(FontsConfig.DefaultSmallFontKey))
|
||||
string fontIdForText = _config.FontID ?? FontsConfig.DefaultSmallFontKey;
|
||||
using (FontsManager.Instance.PushFont(fontIdForText))
|
||||
{
|
||||
_textSize = ImGui.CalcTextSize(_currentTooltipText, false, MaxWidth);
|
||||
}
|
||||
@@ -170,25 +172,27 @@ namespace HSUI.Helpers
|
||||
// no idea why i have to do this
|
||||
float globalScaleCorrection = -15 + 15 * ImGuiHelpers.GlobalScale;
|
||||
|
||||
string fontId = _config.FontID ?? FontsConfig.DefaultSmallFontKey;
|
||||
float wrapWidth = Math.Max(_titleSize.X, _textSize.X) + Margin;
|
||||
if (_currentTooltipTitle != null)
|
||||
{
|
||||
// title
|
||||
Vector2 cursorPos;
|
||||
using (FontsManager.Instance.PushFont(FontsConfig.DefaultSmallFontKey))
|
||||
using (FontsManager.Instance.PushFont(fontId))
|
||||
{
|
||||
cursorPos = new Vector2(windowMargin.X + _size.X / 2f - _titleSize.X / 2f, Margin);
|
||||
ImGui.SetCursorPos(cursorPos);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + _titleSize.X + globalScaleCorrection + Margin);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + wrapWidth + globalScaleCorrection);
|
||||
ImGui.TextColored(_config.TitleColor.Vector, _currentTooltipTitle);
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
|
||||
// text
|
||||
using (FontsManager.Instance.PushFont(FontsConfig.DefaultSmallFontKey))
|
||||
using (FontsManager.Instance.PushFont(fontId))
|
||||
{
|
||||
cursorPos = new Vector2(windowMargin.X + _size.X / 2f - _textSize.X / 2f, Margin + _titleSize.Y);
|
||||
ImGui.SetCursorPos(cursorPos);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + _textSize.X + globalScaleCorrection + Margin);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + wrapWidth + globalScaleCorrection);
|
||||
ImGui.TextColored(_config.TextColor.Vector, _currentTooltipText);
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
@@ -196,13 +200,13 @@ namespace HSUI.Helpers
|
||||
else
|
||||
{
|
||||
// text
|
||||
using (FontsManager.Instance.PushFont(FontsConfig.DefaultSmallFontKey))
|
||||
using (FontsManager.Instance.PushFont(fontId))
|
||||
{
|
||||
var cursorPos = windowMargin + new Vector2(Margin, Margin);
|
||||
var textWidth = _size.X - Margin * 2;
|
||||
|
||||
ImGui.SetCursorPos(cursorPos);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + textWidth + globalScaleCorrection + Margin);
|
||||
ImGui.PushTextWrapPos(cursorPos.X + textWidth + globalScaleCorrection);
|
||||
ImGui.TextColored(_config.TextColor.Vector, _currentTooltipText);
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
@@ -248,8 +252,16 @@ namespace HSUI.Helpers
|
||||
[Order(3)]
|
||||
public bool DebugTooltips = false;
|
||||
|
||||
[Font]
|
||||
[Order(4)]
|
||||
public string? FontID = null;
|
||||
|
||||
[DragFloat("Tooltip Scale", min = 0.5f, max = 2f, help = "Scale the tooltip window size. Useful for large resolutions.")]
|
||||
[Order(6)]
|
||||
public float TooltipScale = 1f;
|
||||
|
||||
[Checkbox("Show Status Effects IDs")]
|
||||
[Order(5)]
|
||||
[Order(7)]
|
||||
public bool ShowStatusIDs = false;
|
||||
|
||||
[Checkbox("Show Source Name")]
|
||||
|
||||
Reference in New Issue
Block a user