fix: account for global scale
This commit is contained in:
parent
a249efca37
commit
4c9492ca28
@ -6,6 +6,7 @@ using ChatTwo.Util;
|
|||||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Interface;
|
||||||
using Dalamud.Logging;
|
using Dalamud.Logging;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
@ -85,9 +86,11 @@ internal sealed class PayloadHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void Hover(Payload payload) {
|
internal void Hover(Payload payload) {
|
||||||
|
var hoverSize = 250f * ImGuiHelpers.GlobalScale;
|
||||||
|
|
||||||
switch (payload) {
|
switch (payload) {
|
||||||
case StatusPayload status: {
|
case StatusPayload status: {
|
||||||
this.DoHover(() => this.HoverStatus(status), 250f);
|
this.DoHover(() => this.HoverStatus(status), hoverSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ItemPayload item: {
|
case ItemPayload item: {
|
||||||
@ -105,7 +108,7 @@ internal sealed class PayloadHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DoHover(() => this.HoverItem(item), 250f);
|
this.DoHover(() => this.HoverItem(item), hoverSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,9 +134,10 @@ internal sealed class PayloadHandler {
|
|||||||
var lineHeight = ImGui.CalcTextSize("A").Y;
|
var lineHeight = ImGui.CalcTextSize("A").Y;
|
||||||
|
|
||||||
var cursor = ImGui.GetCursorPos();
|
var cursor = ImGui.GetCursorPos();
|
||||||
ImGui.Image(icon.ImGuiHandle, new Vector2(icon.Width, icon.Height));
|
var size = new Vector2(icon.Width, icon.Height) * ImGuiHelpers.GlobalScale;
|
||||||
|
ImGui.Image(icon.ImGuiHandle, size);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetCursorPos(cursor + new Vector2(icon.Width + 4, (float) icon.Height / 2 - lineHeight / 2));
|
ImGui.SetCursorPos(cursor + new Vector2(size.X + 4, size.Y / 2 - lineHeight / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HoverStatus(StatusPayload status) {
|
private void HoverStatus(StatusPayload status) {
|
||||||
|
@ -351,7 +351,7 @@ internal sealed class ChatLog : IUiComponent {
|
|||||||
|
|
||||||
ImGui.PushID($"tab-context-menu-{i}");
|
ImGui.PushID($"tab-context-menu-{i}");
|
||||||
|
|
||||||
ImGui.SetNextItemWidth(250f);
|
ImGui.SetNextItemWidth(250f * ImGuiHelpers.GlobalScale);
|
||||||
if (ImGui.InputText("##tab-name", ref tab.Name, 128)) {
|
if (ImGui.InputText("##tab-name", ref tab.Name, 128)) {
|
||||||
anyChanged = true;
|
anyChanged = true;
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ internal sealed class ChatLog : IUiComponent {
|
|||||||
var texSize = new Vector2(this._fontIcon.Width, this._fontIcon.Height);
|
var texSize = new Vector2(this._fontIcon.Width, this._fontIcon.Height);
|
||||||
|
|
||||||
var sizeRatio = this.Ui.Plugin.Config.FontSize / bounds.Value.W;
|
var sizeRatio = this.Ui.Plugin.Config.FontSize / bounds.Value.W;
|
||||||
var size = new Vector2(bounds.Value.Z, bounds.Value.W) * sizeRatio;
|
var size = new Vector2(bounds.Value.Z, bounds.Value.W) * sizeRatio * ImGuiHelpers.GlobalScale;
|
||||||
|
|
||||||
var uv0 = new Vector2(bounds.Value.X, bounds.Value.Y - 2) / texSize;
|
var uv0 = new Vector2(bounds.Value.X, bounds.Value.Y - 2) / texSize;
|
||||||
var uv1 = new Vector2(bounds.Value.X + bounds.Value.Z, bounds.Value.Y - 2 + bounds.Value.W) / texSize;
|
var uv1 = new Vector2(bounds.Value.X + bounds.Value.Z, bounds.Value.Y - 2 + bounds.Value.W) / texSize;
|
||||||
|
@ -52,9 +52,8 @@ internal static class ImGuiUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float scale = 1.0f;
|
|
||||||
var widthLeft = ImGui.GetContentRegionAvail().X;
|
var widthLeft = ImGui.GetContentRegionAvail().X;
|
||||||
var endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, scale, text, textEnd, widthLeft);
|
var endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, ImGuiHelpers.GlobalScale, text, textEnd, widthLeft);
|
||||||
if (endPrevLine == null) {
|
if (endPrevLine == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -68,7 +67,7 @@ internal static class ImGuiUtil {
|
|||||||
++text;
|
++text;
|
||||||
} // skip a space at start of line
|
} // skip a space at start of line
|
||||||
|
|
||||||
endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, scale, text, textEnd, widthLeft);
|
endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, ImGuiHelpers.GlobalScale, text, textEnd, widthLeft);
|
||||||
if (endPrevLine == null) {
|
if (endPrevLine == null) {
|
||||||
ImGui.TextUnformatted("");
|
ImGui.TextUnformatted("");
|
||||||
ImGui.TextUnformatted("");
|
ImGui.TextUnformatted("");
|
||||||
|
Loading…
Reference in New Issue
Block a user