Force cursor to center of Game Window when tab handle is clicked
This commit is contained in:
@@ -1068,8 +1068,11 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
if (Editor.StateMachine.IsPlayMode && !Editor.StateMachine.PlayingState.IsPaused)
|
if (Editor.StateMachine.IsPlayMode && !Editor.StateMachine.PlayingState.IsPaused)
|
||||||
{
|
{
|
||||||
|
// Make sure the cursor is always in the viewport when cursor is locked
|
||||||
|
bool forceCenter = _cursorLockMode != CursorLockMode.None && !IsMouseOver;
|
||||||
|
|
||||||
// Center mouse in play mode
|
// Center mouse in play mode
|
||||||
if (CenterMouseOnFocus)
|
if (CenterMouseOnFocus || forceCenter)
|
||||||
{
|
{
|
||||||
var center = PointToWindow(Size * 0.5f);
|
var center = PointToWindow(Size * 0.5f);
|
||||||
Root.MousePosition = center;
|
Root.MousePosition = center;
|
||||||
|
|||||||
Reference in New Issue
Block a user