Make sure mouse is in target display for resize/dragging/panel operations

This commit is contained in:
Sinai 2022-01-23 23:08:34 +11:00
parent 96a1cc69fb
commit 97a82c1661
3 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ namespace UnityExplorer.UI
public static int Height => ActiveDisplay.renderingHeight; public static int Height => ActiveDisplay.renderingHeight;
public static Vector3 MousePosition => Display.RelativeMouseAt(InputManager.MousePosition); public static Vector3 MousePosition => Display.RelativeMouseAt(InputManager.MousePosition);
public static bool MouseInTargetDisplay => MousePosition.z == ActiveDisplayIndex;
private static Camera canvasCamera; private static Camera canvasCamera;

View File

@ -67,6 +67,9 @@ namespace UnityExplorer.UI.Panels
public static void UpdateInstances() public static void UpdateInstances()
{ {
if (!DisplayManager.MouseInTargetDisplay)
return;
if (!resizeCursorObj) if (!resizeCursorObj)
CreateCursorUI(); CreateCursorUI();

View File

@ -33,7 +33,8 @@ namespace UnityExplorer.UI.Panels
return; return;
// if the user is clicking // if the user is clicking
if (InputManager.GetMouseButtonDown(0) || InputManager.GetMouseButtonDown(1)) if (DisplayManager.MouseInTargetDisplay
&& (InputManager.GetMouseButtonDown(0) || InputManager.GetMouseButtonDown(1)))
{ {
int count = UIManager.PanelHolder.transform.childCount; int count = UIManager.PanelHolder.transform.childCount;
var mousePos = DisplayManager.MousePosition; var mousePos = DisplayManager.MousePosition;