few changes:
- sending a successful pair request through context menu while a pending one exists in client clears it - adjustments to higlight coloring, preventing any text colors to blend with the highlight - some text adjustments - editing uid color in profile editor also previews the highlight
This commit is contained in:
@@ -7,6 +7,7 @@ using LightlessSync.LightlessConfiguration;
|
||||
using LightlessSync.PlayerData.Pairs;
|
||||
using LightlessSync.Services.Mediator;
|
||||
using LightlessSync.Services.ServerConfiguration;
|
||||
using LightlessSync.UI.Style;
|
||||
using LightlessSync.Utils;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
@@ -26,6 +27,9 @@ public class IdDisplayHandler
|
||||
private bool _popupShown = false;
|
||||
private DateTime? _popupTime;
|
||||
|
||||
private Vector4 _currentBg = new(0.15f, 0.15f, 0.15f, 1f);
|
||||
private float _highlightBoost;
|
||||
|
||||
public IdDisplayHandler(LightlessMediator mediator, ServerConfigurationManager serverManager, LightlessConfigService lightlessConfigService)
|
||||
{
|
||||
_mediator = mediator;
|
||||
@@ -98,7 +102,7 @@ public class IdDisplayHandler
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
var font = UiBuilder.MonoFont;
|
||||
var font = textIsUid ? UiBuilder.MonoFont : ImGui.GetFont();
|
||||
|
||||
Vector4? textColor = null;
|
||||
Vector4? glowColor = null;
|
||||
@@ -127,10 +131,11 @@ public class IdDisplayHandler
|
||||
float highlightPadX = 0f;
|
||||
float highlightPadY = 0f;
|
||||
|
||||
if (useVanityColors && textColor is Vector4 contrastColor)
|
||||
if (useVanityColors)
|
||||
{
|
||||
var brightness = (0.299f * contrastColor.X) + (0.587f * contrastColor.Y) + (0.114f * contrastColor.Z);
|
||||
if (brightness < 0.35f)
|
||||
float boost = Luminance.ComputeHighlight(textColor, glowColor);
|
||||
|
||||
if (boost > 0f)
|
||||
{
|
||||
var style = ImGui.GetStyle();
|
||||
useHighlight = true;
|
||||
@@ -138,6 +143,12 @@ public class IdDisplayHandler
|
||||
highlightPadY = MathF.Max(style.FramePadding.Y * 0.55f, 1.25f * ImGuiHelpers.GlobalScale);
|
||||
drawList.ChannelsSplit(2);
|
||||
drawList.ChannelsSetCurrent(1);
|
||||
|
||||
_highlightBoost = boost;
|
||||
}
|
||||
else
|
||||
{
|
||||
_highlightBoost = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +160,7 @@ public class IdDisplayHandler
|
||||
SeStringUtils.RenderSeStringWithHitbox(seString, rowStart, font);
|
||||
itemMin = ImGui.GetItemRectMin();
|
||||
itemMax = ImGui.GetItemRectMax();
|
||||
textSize = itemMax - itemMin;
|
||||
//textSize = itemMax - itemMin;
|
||||
}
|
||||
|
||||
if (useHighlight)
|
||||
@@ -170,11 +181,14 @@ public class IdDisplayHandler
|
||||
highlightMin.Y = MathF.Max(highlightMin.Y, contentMin.Y);
|
||||
highlightMax.Y = MathF.Min(highlightMax.Y, contentMax.Y);
|
||||
|
||||
var highlightColor = style.Colors[(int)ImGuiCol.TableRowBgAlt];
|
||||
highlightColor.X = 0.25f;
|
||||
highlightColor.Y = 0.25f;
|
||||
highlightColor.Z = 0.25f;
|
||||
highlightColor.W = 1f;
|
||||
var highlightColor = new Vector4(
|
||||
0.25f + _highlightBoost,
|
||||
0.25f + _highlightBoost,
|
||||
0.25f + _highlightBoost,
|
||||
1f
|
||||
);
|
||||
|
||||
highlightColor = Luminance.BackgroundContrast(textColor, glowColor, highlightColor, ref _currentBg);
|
||||
|
||||
float rounding = style.FrameRounding > 0f ? style.FrameRounding : 5f * ImGuiHelpers.GlobalScale;
|
||||
drawList.ChannelsSetCurrent(0);
|
||||
|
||||
Reference in New Issue
Block a user