changed IsMousInside -> IsHovered

This commit is contained in:
ikpil 2023-06-15 23:10:52 +09:00
parent b7c8111a69
commit bf8d5f165d
6 changed files with 16 additions and 15 deletions

View File

@ -781,7 +781,7 @@ public class RecastDemo
dd.Fog(false);
_canvas.Draw(dt);
_mouseOverMenu = _canvas.IsMouseOverUI();
_mouseOverMenu = _canvas.IsMouseOver();
_imgui.Render();

View File

@ -21,7 +21,7 @@ namespace DotRecast.Recast.Demo.UI;
public interface IRcView
{
void Bind(RcCanvas canvas);
bool IsMouseInside();
bool IsHovered();
void Update(double dt);
void Draw(double dt);
}

View File

@ -33,8 +33,9 @@ public class RcCanvas
private readonly IWindow _window;
private readonly IRcView[] _views;
private bool _mouseOverUI;
public bool IsMouseOverUI() => _mouseOverUI;
private bool _mouseOver;
public bool IsMouseOver() => _mouseOver;
public Vector2D<int> Size => _window.Size;
@ -107,11 +108,11 @@ public class RcCanvas
public void Draw(double dt)
{
_mouseOverUI = false;
_mouseOver = false;
foreach (var view in _views)
{
view.Draw(dt);
_mouseOverUI |= view.IsMouseInside();
_mouseOver |= view.IsHovered();
}
}
}

View File

@ -14,7 +14,8 @@ namespace DotRecast.Recast.Demo.UI;
public class RcLogView : IRcView
{
private RcCanvas _canvas;
private bool _mouseInside;
private bool _isHovered;
public bool IsHovered() => _isHovered;
private readonly List<LogMessageItem> _lines;
private readonly ConcurrentQueue<LogMessageItem> _queues;
@ -59,7 +60,6 @@ public class RcLogView : IRcView
}
}
public bool IsMouseInside() => _mouseInside;
public void Draw(double dt)
{
@ -78,7 +78,7 @@ public class RcLogView : IRcView
if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar))
{
_mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);

View File

@ -47,8 +47,8 @@ public class RcSettingsView : IRcView
private bool meshInputTrigerred;
private bool navMeshInputTrigerred;
private bool _mouseInside;
public bool IsMouseInside() => _mouseInside;
private bool _isHovered;
public bool IsHovered() => _isHovered;
private Sample _sample;
private RcCanvas _canvas;
@ -81,7 +81,7 @@ public class RcSettingsView : IRcView
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y));
ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
_mouseInside = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
ImGui.Text("Input Mesh");
ImGui.Separator();

View File

@ -34,8 +34,8 @@ public class RcToolsetView : IRcView
private IRcTool currentTool;
private bool enabled;
private readonly IRcTool[] tools;
private bool _mouseInside;
public bool IsMouseInside() => _mouseInside;
private bool _isHovered;
public bool IsHovered() => _isHovered;
private RcCanvas _canvas;
@ -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(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
for (int i = 0; i < tools.Length; ++i)
{