bugfinx - UI Hovered is always false while the mouse is being clicked

This commit is contained in:
ikpil 2023-06-15 00:38:52 +09:00
parent 91cc42b828
commit 4c97468f06
3 changed files with 10 additions and 8 deletions

View File

@ -33,7 +33,7 @@ public class RcLogView : IRcView
var lines = message var lines = message
.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries) .Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)
.Select(x => new LogMessageItem { Level = level, Message = x }); .Select(x => new LogMessageItem { Level = level, Message = x });
_lines.AddRange(lines); _lines.AddRange(lines);
} }
@ -78,7 +78,7 @@ public class RcLogView : IRcView
if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar)) 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); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);

View File

@ -25,14 +25,17 @@ using DotRecast.Core;
using DotRecast.Recast.Demo.Draw; using DotRecast.Recast.Demo.Draw;
using DotRecast.Recast.DemoTool; using DotRecast.Recast.DemoTool;
using ImGuiNET; using ImGuiNET;
using Serilog;
namespace DotRecast.Recast.Demo.UI; namespace DotRecast.Recast.Demo.UI;
public class RcSettingsView : IRcView public class RcSettingsView : IRcView
{ {
private static readonly ILogger Logger = Log.ForContext<RecastDemo>();
private bool buildTriggered; private bool buildTriggered;
private long buildTime; private long buildTime;
private readonly int[] voxels = new int[2]; private readonly int[] voxels = new int[2];
private readonly int[] tiles = new int[2]; private readonly int[] tiles = new int[2];
private int maxTiles; private int maxTiles;
@ -52,9 +55,8 @@ public class RcSettingsView : IRcView
public RcSettingsView() public RcSettingsView()
{ {
} }
public void SetSample(Sample sample) public void SetSample(Sample sample)
{ {
_sample = sample; _sample = sample;
@ -72,14 +74,14 @@ public class RcSettingsView : IRcView
public void Draw(double dt) public void Draw(double dt)
{ {
var settings = _sample.GetSettings(); var settings = _sample.GetSettings();
int width = 310; int width = 310;
var posX = _canvas.Size.X - width; var posX = _canvas.Size.X - width;
ImGui.SetNextWindowPos(new Vector2(posX, 0)); ImGui.SetNextWindowPos(new Vector2(posX, 0));
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y));
ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
_mouseInside = ImGui.IsWindowHovered(); _mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
ImGui.Text("Input Mesh"); ImGui.Text("Input Mesh");
ImGui.Separator(); ImGui.Separator();

View File

@ -59,7 +59,7 @@ public class RcToolsetView : IRcView
ImGui.SetNextWindowPos(new Vector2(0, 0)); ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y));
ImGui.Begin("Tools", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); 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) for (int i = 0; i < tools.Length; ++i)
{ {