Fixed mouse wrapping when scene viewport is inactive

This commit is contained in:
Simon Lübeß
2022-09-27 00:00:17 +02:00
parent 0f1eddad5f
commit e035832ab0
@@ -56,10 +56,15 @@ namespace GlitchyEditor.EditWindows
ShowMenuBar();
var viewportSize = ImGui.GetContentRegionAvail();
if(ImGui.IsWindowHovered() && Input.IsMouseButtonPressing(.RightButton))
{
var currentWindow = ImGui.GetCurrentWindow();
ImGui.FocusWindow(currentWindow);
if (_editor.CurrentCamera.[Friend]BindMouse)
WrapMouseInViewport();
}
_hasFocus = ImGui.IsWindowFocused();
@@ -79,11 +84,6 @@ namespace GlitchyEditor.EditWindows
_gizmoMode = .LOCAL;
}
var viewportSize = ImGui.GetContentRegionAvail();
if (_editor.CurrentCamera.[Friend]BindMouse)
WrapMouseInViewport();
if(_renderTarget != null)
{
ImGui.Image(_renderTarget.GetViewBinding(0), viewportSize);