diff --git a/src/DotRecast.Recast.Demo/RecastDemo.cs b/src/DotRecast.Recast.Demo/RecastDemo.cs index 75fad26..c6e1f1a 100644 --- a/src/DotRecast.Recast.Demo/RecastDemo.cs +++ b/src/DotRecast.Recast.Demo/RecastDemo.cs @@ -362,7 +362,7 @@ public class RecastDemo dd.Init(camr); - ImGuiFontConfig imGuiFontConfig = new(Path.Combine("resources\\fonts", "DroidSans.ttf"), 24, null); + ImGuiFontConfig imGuiFontConfig = new(Path.Combine("resources\\fonts", "DroidSans.ttf"), 16, null); _imgui = new ImGuiController(_gl, window, _input, imGuiFontConfig); DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj")); diff --git a/src/DotRecast.Recast.Demo/UI/RcLogView.cs b/src/DotRecast.Recast.Demo/UI/RcLogView.cs index 4b3409b..c66df0d 100644 --- a/src/DotRecast.Recast.Demo/UI/RcLogView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcLogView.cs @@ -63,18 +63,23 @@ public class RcLogView : IRcView public void Draw(double dt) { - int otherWidth1 = 350; - int otherWidth2 = 620; - int height = 234; - var width = _canvas.Size.X - (otherWidth1 + otherWidth2); - //var posX = _canvas.Size.X - width; - ImGui.SetNextWindowPos(new Vector2(otherWidth1, _canvas.Size.Y - height)); - ImGui.SetNextWindowSize(new Vector2(width, height)); - if (!ImGui.Begin("Log", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize)) + if (!ImGui.Begin("Log")) { ImGui.End(); return; } + + // size reset + var size = ImGui.GetItemRectSize(); + if (32 >= size.X && 32 >= size.Y) + { + int otherWidth = 310; + int height = 234; + var width = _canvas.Size.X - (otherWidth * 2); + //var posX = _canvas.Size.X - width; + // ImGui.SetNextWindowPos(new Vector2(otherWidth1, _canvas.Size.Y - height)); + ImGui.SetWindowSize(new Vector2(width, height)); + } if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar)) diff --git a/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs b/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs index 871390a..125781c 100644 --- a/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs @@ -75,11 +75,17 @@ public class RcSettingsView : IRcView { var settings = _sample.GetSettings(); - int width = 620; - var posX = _canvas.Size.X - width; - ImGui.SetNextWindowPos(new Vector2(posX, 0)); - ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); - ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); + ImGui.Begin("Properties"); + + // size reset + var size = ImGui.GetItemRectSize(); + if (32 >= size.X && 32 >= size.Y) + { + int width = 310; + var posX = _canvas.Size.X - width; + //ImGui.SetWindowPos(new Vector2(posX, 0)); + ImGui.SetWindowSize(new Vector2(width, _canvas.Size.Y)); + } _isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); diff --git a/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs b/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs index 12f14f4..a8b8341 100644 --- a/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs @@ -55,10 +55,17 @@ public class RcToolsetView : IRcView public void Draw(double dt) { - int width = 350; - ImGui.SetNextWindowPos(new Vector2(0, 0)); - ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); - ImGui.Begin("Tools", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); + ImGui.Begin("Tools"); + + // size reset + var size = ImGui.GetItemRectSize(); + if (32 >= size.X && 32 >= size.Y) + { + int width = 310; + //ImGui.SetWindowPos(new Vector2(0, 0)); + ImGui.SetWindowSize(new Vector2(width, _canvas.Size.Y)); + } + _isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); for (int i = 0; i < tools.Length; ++i)