From 4c97468f0600f878a2bfc41af096b42d84c9d811 Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 15 Jun 2023 00:38:52 +0900 Subject: [PATCH] bugfinx - UI Hovered is always false while the mouse is being clicked --- src/DotRecast.Recast.Demo/UI/RcLogView.cs | 4 ++-- src/DotRecast.Recast.Demo/UI/RcSettingsView.cs | 12 +++++++----- src/DotRecast.Recast.Demo/UI/RcToolsetView.cs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/DotRecast.Recast.Demo/UI/RcLogView.cs b/src/DotRecast.Recast.Demo/UI/RcLogView.cs index 30a2652..0e92a2e 100644 --- a/src/DotRecast.Recast.Demo/UI/RcLogView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcLogView.cs @@ -33,7 +33,7 @@ public class RcLogView : IRcView var lines = message .Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries) .Select(x => new LogMessageItem { Level = level, Message = x }); - + _lines.AddRange(lines); } @@ -78,7 +78,7 @@ public class RcLogView : IRcView if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar)) { - _mouseInside = ImGui.IsWindowHovered(); + _mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero); diff --git a/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs b/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs index ab7d8a6..a23f0cb 100644 --- a/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcSettingsView.cs @@ -25,14 +25,17 @@ using DotRecast.Core; using DotRecast.Recast.Demo.Draw; using DotRecast.Recast.DemoTool; using ImGuiNET; +using Serilog; namespace DotRecast.Recast.Demo.UI; public class RcSettingsView : IRcView { + private static readonly ILogger Logger = Log.ForContext(); + private bool buildTriggered; private long buildTime; - + private readonly int[] voxels = new int[2]; private readonly int[] tiles = new int[2]; private int maxTiles; @@ -52,9 +55,8 @@ public class RcSettingsView : IRcView public RcSettingsView() { - } - + public void SetSample(Sample sample) { _sample = sample; @@ -72,14 +74,14 @@ public class RcSettingsView : IRcView public void Draw(double dt) { var settings = _sample.GetSettings(); - + int width = 310; 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); - _mouseInside = ImGui.IsWindowHovered(); + _mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); ImGui.Text("Input Mesh"); ImGui.Separator(); diff --git a/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs b/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs index ca90bdc..374e53d 100644 --- a/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs +++ b/src/DotRecast.Recast.Demo/UI/RcToolsetView.cs @@ -59,7 +59,7 @@ public class RcToolsetView : IRcView ImGui.SetNextWindowPos(new Vector2(0, 0)); ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); ImGui.Begin("Tools", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); - _mouseInside = ImGui.IsWindowHovered(); + _mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); for (int i = 0; i < tools.Length; ++i) {