kalilistic / NeatNoter

A note-taking plugin for Dalamud.
MIT License
4 stars 11 forks source link

UI Layout issue when global UI scale is not equal to 1 #3

Closed DarkDestry closed 2 years ago

DarkDestry commented 3 years ago

Screenshot when UI scale is 2.0 image

DarkDestry commented 3 years ago

I might PR if I get bored enough but heres the relevant variables for fixing the bug

GUI Scale variable (float) : ImGui.GetIO().FontGlobalScale Button right align trick : Taken from (https://github.com/ocornut/imgui/issues/934#issuecomment-340231002)

static float HostButtonWidth = 100.0f; //The 100.0f is just a guess size for the first frame.
float pos = HostButtonWidth + ItemSpacing;
ImGui::SameLine(ImGui::GetWindowWidth() - pos);
if(ImGui::SmallButton("Become host"))
{ ... }
HostButtonWidth = ImGui::GetItemRectSize().x; //Get the actual width for next frame.
karashiiro commented 3 years ago

Will look into it, thanks. I'll probably end up copying stuff out of https://github.com/PunishedPineapple/WaymarkPresetPlugin/commit/d26f5334cdcea40c851e176ae47ee437a6707f58.

karashiiro commented 3 years ago

Not perfect, but semi-fixed with 37dc611756106509c782018ff170dd40f2110e99. Leaving this open for now.

Adding a note for myself: It scales perfectly on the two integer sizes -- 1.0 and 2.0 -- but seems the most skewed at 1.5.

kalilistic commented 2 years ago

This seemed pretty solid from Kara's previous fixes but made a few more adjustments and I don't see any remaining issues. Let me know if you do though and what your scale is if so.

This is available on my testing repo: https://github.com/kalilistic/DalamudPluginRepo/raw/master/pluginmaster.json. If there are no issues, will be pushed to main over next week or so.

DarkDestry commented 2 years ago

Yeap looks good to me. Was already pretty useable as of 37dc611.