This commit is contained in:
2025-12-20 04:01:20 +09:00
6 changed files with 117 additions and 56 deletions

View File

@@ -31,7 +31,7 @@
<PackageReference Include="Brio.API" Version="3.0.0" /> <PackageReference Include="Brio.API" Version="3.0.0" />
<PackageReference Include="Downloader" Version="4.0.3" /> <PackageReference Include="Downloader" Version="4.0.3" />
<PackageReference Include="K4os.Compression.LZ4.Legacy" Version="1.3.8" /> <PackageReference Include="K4os.Compression.LZ4.Legacy" Version="1.3.8" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.212"> <PackageReference Include="Meziantou.Analyzer" Version="2.0.264">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@@ -39,13 +39,13 @@
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="10.0.1" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
<PackageReference Include="Glamourer.Api" Version="2.8.0" /> <PackageReference Include="Glamourer.Api" Version="2.8.0" />
<PackageReference Include="NReco.Logging.File" Version="1.2.2" /> <PackageReference Include="NReco.Logging.File" Version="1.3.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.7.0.110445"> <PackageReference Include="SonarAnalyzer.CSharp" Version="10.17.0.131074">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.7.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
<PackageReference Include="YamlDotNet" Version="16.3.0" /> <PackageReference Include="YamlDotNet" Version="16.3.0" />
</ItemGroup> </ItemGroup>

View File

@@ -629,8 +629,9 @@ public class CompactUi : WindowMediatorSubscriberBase
{ {
var seString = SeStringUtils.BuildFormattedPlayerName(uidText, vanityTextColor, vanityGlowColor); var seString = SeStringUtils.BuildFormattedPlayerName(uidText, vanityTextColor, vanityGlowColor);
var cursorPos = ImGui.GetCursorScreenPos(); var cursorPos = ImGui.GetCursorScreenPos();
var fontPtr = ImGui.GetFont(); var targetFontSize = ImGui.GetFontSize();
SeStringUtils.RenderSeStringWithHitbox(seString, cursorPos, fontPtr, "uid-header"); var font = ImGui.GetFont();
SeStringUtils.RenderSeStringWithHitbox(seString, cursorPos, targetFontSize ,font , "uid-header");
} }
else else
{ {
@@ -716,8 +717,9 @@ public class CompactUi : WindowMediatorSubscriberBase
{ {
var seString = SeStringUtils.BuildFormattedPlayerName(_apiController.UID, vanityTextColor, vanityGlowColor); var seString = SeStringUtils.BuildFormattedPlayerName(_apiController.UID, vanityTextColor, vanityGlowColor);
var cursorPos = ImGui.GetCursorScreenPos(); var cursorPos = ImGui.GetCursorScreenPos();
var fontPtr = ImGui.GetFont(); var targetFontSize = ImGui.GetFontSize();
SeStringUtils.RenderSeStringWithHitbox(seString, cursorPos, fontPtr, "uid-footer"); var font = ImGui.GetFont();
SeStringUtils.RenderSeStringWithHitbox(seString, cursorPos, targetFontSize, font, "uid-footer");
} }
else else
{ {

View File

@@ -332,7 +332,7 @@ public partial class EditProfileUi
saveTooltip: "Apply the selected tags to this syncshell profile.", saveTooltip: "Apply the selected tags to this syncshell profile.",
submitAction: payload => SubmitGroupTagChanges(payload), submitAction: payload => SubmitGroupTagChanges(payload),
allowReorder: true, allowReorder: true,
sortPayloadBeforeSubmit: true, sortPayloadBeforeSubmit: false,
onPayloadPrepared: payload => onPayloadPrepared: payload =>
{ {
_tagEditorSelection.Clear(); _tagEditorSelection.Clear();
@@ -586,7 +586,7 @@ public partial class EditProfileUi
IsNsfw: null, IsNsfw: null,
IsDisabled: null)).ConfigureAwait(false); IsDisabled: null)).ConfigureAwait(false);
_profileTagIds = payload.Length == 0 ? Array.Empty<int>() : payload.ToArray(); _profileTagIds = payload.Length == 0 ? [] : [.. payload];
Mediator.Publish(new ClearProfileGroupDataMessage(_groupInfo.Group)); Mediator.Publish(new ClearProfileGroupDataMessage(_groupInfo.Group));
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -122,6 +122,7 @@ public class IdDisplayHandler
if (!string.Equals(_editEntry, pair.UserData.UID, StringComparison.Ordinal)) if (!string.Equals(_editEntry, pair.UserData.UID, StringComparison.Ordinal))
{ {
var targetFontSize = ImGui.GetFontSize();
var font = textIsUid ? UiBuilder.MonoFont : ImGui.GetFont(); var font = textIsUid ? UiBuilder.MonoFont : ImGui.GetFont();
var rowWidth = MathF.Max(editBoxWidth.Invoke(), 0f); var rowWidth = MathF.Max(editBoxWidth.Invoke(), 0f);
float rowRightLimit = 0f; float rowRightLimit = 0f;
@@ -183,7 +184,7 @@ public class IdDisplayHandler
} }
} }
SeStringUtils.RenderSeStringWithHitbox(seString, rowStart, font, pair.UserData.UID); SeStringUtils.RenderSeStringWithHitbox(seString, rowStart, targetFontSize, font, pair.UserData.UID);
nameRectMin = ImGui.GetItemRectMin(); nameRectMin = ImGui.GetItemRectMin();
nameRectMax = ImGui.GetItemRectMax(); nameRectMax = ImGui.GetItemRectMax();

View File

@@ -559,17 +559,11 @@ public static class SeStringUtils
ImGui.Dummy(new Vector2(0f, textSize.Y)); ImGui.Dummy(new Vector2(0f, textSize.Y));
} }
public static Vector2 RenderSeStringWithHitbox(DalamudSeString seString, Vector2 position, ImFontPtr? font = null, string? id = null) public static Vector2 RenderSeStringWithHitbox(DalamudSeString seString, Vector2 position, ImFontPtr? font = null, string? id = null)
{ {
var drawList = ImGui.GetWindowDrawList(); var drawList = ImGui.GetWindowDrawList();
var usedFont = font ?? UiBuilder.MonoFont; var usedFont = font ?? UiBuilder.MonoFont;
var drawParams = new SeStringDrawParams
{
Font = usedFont,
Color = 0xFFFFFFFF,
WrapWidth = float.MaxValue,
TargetDrawList = drawList
};
var textSize = ImGui.CalcTextSize(seString.TextValue); var textSize = ImGui.CalcTextSize(seString.TextValue);
if (textSize.Y <= 0f) if (textSize.Y <= 0f)
@@ -584,11 +578,17 @@ public static class SeStringUtils
var verticalOffset = MathF.Max((hitboxHeight - textSize.Y) * 0.5f, 0f); var verticalOffset = MathF.Max((hitboxHeight - textSize.Y) * 0.5f, 0f);
var drawPos = new Vector2(position.X, position.Y + verticalOffset); var drawPos = new Vector2(position.X, position.Y + verticalOffset);
ImGui.SetCursorScreenPos(drawPos); var drawParams = new SeStringDrawParams
{
FontSize = usedFont.FontSize,
ScreenOffset = drawPos,
Font = usedFont,
Color = 0xFFFFFFFF,
WrapWidth = float.MaxValue,
TargetDrawList = drawList
};
drawParams.ScreenOffset = drawPos; ImGui.SetCursorScreenPos(drawPos);
drawParams.Font = usedFont;
drawParams.FontSize = usedFont.FontSize;
ImGuiHelpers.SeStringWrapped(seString.Encode(), drawParams); ImGuiHelpers.SeStringWrapped(seString.Encode(), drawParams);
@@ -614,6 +614,64 @@ public static class SeStringUtils
return new Vector2(textSize.X, hitboxHeight); return new Vector2(textSize.X, hitboxHeight);
} }
public static Vector2 RenderSeStringWithHitbox(DalamudSeString seString, Vector2 position, float? targetFontSize, ImFontPtr? font = null, string? id = null)
{
var drawList = ImGui.GetWindowDrawList();
var usedFont = font ?? ImGui.GetFont();
ImGui.PushFont(usedFont);
Vector2 rawSize;
float usedEffectiveSize;
try
{
usedEffectiveSize = ImGui.GetFontSize();
rawSize = ImGui.CalcTextSize(seString.TextValue);
}
finally
{
ImGui.PopFont();
}
var desiredSize = targetFontSize ?? usedEffectiveSize;
var scale = usedEffectiveSize > 0 ? (desiredSize / usedEffectiveSize) : 1f;
var textSize = rawSize * scale;
var style = ImGui.GetStyle();
var frameHeight = desiredSize + style.FramePadding.Y * 2f;
var hitboxHeight = MathF.Max(frameHeight, textSize.Y);
var verticalOffset = MathF.Max((hitboxHeight - textSize.Y) * 0.5f, 0f);
var drawPos = new Vector2(position.X, position.Y + verticalOffset);
var drawParams = new SeStringDrawParams
{
TargetDrawList = drawList,
ScreenOffset = drawPos,
Font = usedFont,
FontSize = desiredSize,
Color = 0xFFFFFFFF,
WrapWidth = float.MaxValue,
};
ImGui.SetCursorScreenPos(drawPos);
ImGuiHelpers.SeStringWrapped(seString.Encode(), drawParams);
ImGui.SetCursorScreenPos(position);
ImGui.PushID(id ?? Interlocked.Increment(ref _seStringHitboxCounter).ToString());
try
{
ImGui.InvisibleButton("##hitbox", new Vector2(textSize.X, hitboxHeight));
}
finally
{
ImGui.PopID();
}
return new Vector2(textSize.X, hitboxHeight);
}
public static Vector2 RenderIconWithHitbox(int iconId, Vector2 position, ImFontPtr? font = null, string? id = null) public static Vector2 RenderIconWithHitbox(int iconId, Vector2 position, ImFontPtr? font = null, string? id = null)
{ {
var drawList = ImGui.GetWindowDrawList(); var drawList = ImGui.GetWindowDrawList();

View File

@@ -52,9 +52,9 @@
}, },
"Meziantou.Analyzer": { "Meziantou.Analyzer": {
"type": "Direct", "type": "Direct",
"requested": "[2.0.212, )", "requested": "[2.0.264, )",
"resolved": "2.0.212", "resolved": "2.0.264",
"contentHash": "U91ktjjTRTccUs3Lk+hrLD9vW+2+lhnsOf4G1GpRSJi1pLn3uK5CU6wGP9Bmz1KlJs6Oz1GGoMhxQBoqQsmAuQ==" "contentHash": "zRG13RDG446rZNdd/YjKRd4utpbjleRDUqNQSrX0etMnH8Rz9NBlXUpS5aR2ExoOokhNfkdOW8HpLzjLj5x0hQ=="
}, },
"Microsoft.AspNetCore.SignalR.Client": { "Microsoft.AspNetCore.SignalR.Client": {
"type": "Direct", "type": "Direct",
@@ -108,35 +108,35 @@
}, },
"NReco.Logging.File": { "NReco.Logging.File": {
"type": "Direct", "type": "Direct",
"requested": "[1.2.2, )", "requested": "[1.3.1, )",
"resolved": "1.2.2", "resolved": "1.3.1",
"contentHash": "UyUIkyDiHi2HAJlmEWqeKN9/FxTF0DPNdyatzMDMTXvUpgvqBFneJ2qDtZkXRJNG8eR6jU+KsbGeMmChgUdRUg==", "contentHash": "4aFUEW1OFJsuKtg46dnqxZUyb37f9dzaWOXjUv2x/wzoHKovR9yqiMzXtCZt3+a9G78YCIAtSEz2g/GaNYbxSQ==",
"dependencies": { "dependencies": {
"Microsoft.Extensions.Logging": "8.0.1", "Microsoft.Extensions.Logging": "10.0.0",
"Microsoft.Extensions.Logging.Configuration": "8.0.1", "Microsoft.Extensions.Logging.Configuration": "10.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0" "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.0"
} }
}, },
"SixLabors.ImageSharp": { "SixLabors.ImageSharp": {
"type": "Direct", "type": "Direct",
"requested": "[3.1.11, )", "requested": "[3.1.12, )",
"resolved": "3.1.11", "resolved": "3.1.12",
"contentHash": "JfPLyigLthuE50yi6tMt7Amrenr/fA31t2CvJyhy/kQmfulIBAqo5T/YFUSRHtuYPXRSaUHygFeh6Qd933EoSw==" "contentHash": "iAg6zifihXEFS/t7fiHhZBGAdCp3FavsF4i2ZIDp0JfeYeDVzvmlbY1CNhhIKimaIzrzSi5M/NBFcWvZT2rB/A=="
}, },
"SonarAnalyzer.CSharp": { "SonarAnalyzer.CSharp": {
"type": "Direct", "type": "Direct",
"requested": "[10.7.0.110445, )", "requested": "[10.17.0.131074, )",
"resolved": "10.7.0.110445", "resolved": "10.17.0.131074",
"contentHash": "U4v2LWopxADYkUv7Z5CX7ifKMdDVqHb7a1bzppIQnQi4WQR6z1Zi5rDkCHlVYGEd1U/WMz1IJCU8OmFZLJpVig==" "contentHash": "N8agHzX1pK3Xv/fqMig/mHspPAmh/aKkGg7lUC1xfezAhFtPTuRqBjuyas622Tvy5jnsN5zCXJVclvNkfJJ4rQ=="
}, },
"System.IdentityModel.Tokens.Jwt": { "System.IdentityModel.Tokens.Jwt": {
"type": "Direct", "type": "Direct",
"requested": "[8.7.0, )", "requested": "[8.15.0, )",
"resolved": "8.7.0", "resolved": "8.15.0",
"contentHash": "8dKL3A9pVqYCJIXHd4H2epQqLxSvKeNxGonR0e5g89yMchyvsM/NLuB06otx29BicUd6+LUJZgNZmvYjjPsPGg==", "contentHash": "dpodi7ixz6hxK8YCBYAWzm0IA8JYXoKcz0hbCbNifo519//rjUI0fBD8rfNr+IGqq+2gm4oQoXwHk09LX5SqqQ==",
"dependencies": { "dependencies": {
"Microsoft.IdentityModel.JsonWebTokens": "8.7.0", "Microsoft.IdentityModel.JsonWebTokens": "8.15.0",
"Microsoft.IdentityModel.Tokens": "8.7.0" "Microsoft.IdentityModel.Tokens": "8.15.0"
} }
}, },
"YamlDotNet": { "YamlDotNet": {
@@ -490,32 +490,32 @@
}, },
"Microsoft.IdentityModel.Abstractions": { "Microsoft.IdentityModel.Abstractions": {
"type": "Transitive", "type": "Transitive",
"resolved": "8.7.0", "resolved": "8.15.0",
"contentHash": "OQd5aVepYvh5evOmBMeAYjMIpEcTf1ZCBZaU7Nh/RlhhdXefjFDJeP1L2F2zeNT1unFr+wUu/h3Ac2Xb4BXU6w==" "contentHash": "e/DApa1GfxUqHSBHcpiQg8yaghKAvFVBQFcWh25jNoRobDZbduTUACY8bZ54eeGWXvimGmEDdF0zkS5Dq16XPQ=="
}, },
"Microsoft.IdentityModel.JsonWebTokens": { "Microsoft.IdentityModel.JsonWebTokens": {
"type": "Transitive", "type": "Transitive",
"resolved": "8.7.0", "resolved": "8.15.0",
"contentHash": "uzsSAWhNhbrkWbQKBTE8QhzviU6sr3bJ1Bkv7gERlhswfSKOp7HsxTRLTPBpx/whQ/GRRHEwMg8leRIPbMrOgw==", "contentHash": "3513f5VzvOZy3ELd42wGnh1Q3e83tlGAuXFSNbENpgWYoAhLLzgFtd5PiaOPGAU0gqKhYGVzKavghLUGfX3HQg==",
"dependencies": { "dependencies": {
"Microsoft.IdentityModel.Tokens": "8.7.0" "Microsoft.IdentityModel.Tokens": "8.15.0"
} }
}, },
"Microsoft.IdentityModel.Logging": { "Microsoft.IdentityModel.Logging": {
"type": "Transitive", "type": "Transitive",
"resolved": "8.7.0", "resolved": "8.15.0",
"contentHash": "Bs0TznPAu+nxa9rAVHJ+j3CYECHJkT3tG8AyBfhFYlT5ldsDhoxFT7J+PKxJHLf+ayqWfvDZHHc4639W2FQCxA==", "contentHash": "1gJLjhy0LV2RQMJ9NGzi5Tnb2l+c37o8D8Lrk2mrvmb6OQHZ7XJstd/XxvncXgBpad4x9CGXdipbZzJJCXKyAg==",
"dependencies": { "dependencies": {
"Microsoft.IdentityModel.Abstractions": "8.7.0" "Microsoft.IdentityModel.Abstractions": "8.15.0"
} }
}, },
"Microsoft.IdentityModel.Tokens": { "Microsoft.IdentityModel.Tokens": {
"type": "Transitive", "type": "Transitive",
"resolved": "8.7.0", "resolved": "8.15.0",
"contentHash": "5Z6voXjRXAnGklhmZd1mKz89UhcF5ZQQZaZc2iKrOuL4Li1UihG2vlJx8IbiFAOIxy/xdbsAm0A+WZEaH5fxng==", "contentHash": "zUE9ysJXBtXlHHRtcRK3Sp8NzdCI1z/BRDTXJQ2TvBoI0ENRtnufYIep0O5TSCJRJGDwwuLTUx+l/bEYZUxpCA==",
"dependencies": { "dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "8.0.2", "Microsoft.Extensions.Logging.Abstractions": "10.0.0",
"Microsoft.IdentityModel.Logging": "8.7.0" "Microsoft.IdentityModel.Logging": "8.15.0"
} }
}, },
"Microsoft.NET.StringTools": { "Microsoft.NET.StringTools": {
@@ -619,7 +619,7 @@
"FlatSharp.Runtime": "[7.9.0, )", "FlatSharp.Runtime": "[7.9.0, )",
"OtterGui": "[1.0.0, )", "OtterGui": "[1.0.0, )",
"Penumbra.Api": "[5.13.0, )", "Penumbra.Api": "[5.13.0, )",
"Penumbra.String": "[1.0.6, )" "Penumbra.String": "[1.0.7, )"
} }
}, },
"penumbra.string": { "penumbra.string": {