mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-14 10:14:15 +01:00
fix icons and text of buttons being static in place
This commit is contained in:
parent
fdc0d4bf6f
commit
5a62012d2a
1 changed files with 7 additions and 5 deletions
|
|
@ -360,6 +360,8 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||||
var cursor = ImGui.GetCursorPos();
|
var cursor = ImGui.GetCursorPos();
|
||||||
var drawList = ImGui.GetWindowDrawList();
|
var drawList = ImGui.GetWindowDrawList();
|
||||||
var pos = ImGui.GetWindowPos();
|
var pos = ImGui.GetWindowPos();
|
||||||
|
var scrollPosY = ImGui.GetScrollY();
|
||||||
|
var scrollPosX = ImGui.GetScrollX();
|
||||||
|
|
||||||
Vector2 buttonSize;
|
Vector2 buttonSize;
|
||||||
var buttonSizeY = textSize.Y + padding.Y * 2;
|
var buttonSizeY = textSize.Y + padding.Y * 2;
|
||||||
|
|
@ -388,13 +390,13 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||||
}
|
}
|
||||||
|
|
||||||
drawList.AddText(UiBuilder.IconFont, ImGui.GetFontSize() * iconScaling,
|
drawList.AddText(UiBuilder.IconFont, ImGui.GetFontSize() * iconScaling,
|
||||||
new(pos.X + cursor.X + iconXoffset + padding.X,
|
new(pos.X - scrollPosX + cursor.X + iconXoffset + padding.X,
|
||||||
pos.Y + cursor.Y + (buttonSizeY - (iconSize.Y * iconScaling)) / 2f),
|
pos.Y - scrollPosY + cursor.Y + (buttonSizeY - (iconSize.Y * iconScaling)) / 2f),
|
||||||
ImGui.GetColorU32(ImGuiCol.Text), icon.ToIconString());
|
ImGui.GetColorU32(ImGuiCol.Text), icon.ToIconString());
|
||||||
|
|
||||||
drawList.AddText(UiBuilder.DefaultFont, ImGui.GetFontSize(),
|
drawList.AddText(UiBuilder.DefaultFont, ImGui.GetFontSize(),
|
||||||
new(pos.X + cursor.X + (padding.X) + spacing.X + (iconSize.X * iconScaling) + (iconXoffset * 2) + iconExtraSpacing,
|
new(pos.X - scrollPosX + cursor.X + (padding.X) + spacing.X + (iconSize.X * iconScaling) + (iconXoffset * 2) + iconExtraSpacing,
|
||||||
pos.Y + cursor.Y + ((buttonSizeY - textSize.Y) / 2f)),
|
pos.Y - scrollPosY + cursor.Y + ((buttonSizeY - textSize.Y) / 2f)),
|
||||||
ImGui.GetColorU32(ImGuiCol.Text), text);
|
ImGui.GetColorU32(ImGuiCol.Text), text);
|
||||||
|
|
||||||
return wasClicked;
|
return wasClicked;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue