This commit is contained in:
Wojtek Figat
2024-03-17 18:27:59 +01:00
parent 700ed25d3d
commit b847c2d056
3 changed files with 8 additions and 6 deletions

View File

@@ -189,9 +189,11 @@ namespace FlaxEditor
internal float ViewScale
{
get => _view.Scale.X;
get => _view?.Scale.X ?? 1;
set
{
if (_view == null)
return;
value = Mathf.Clamp(value, 0.1f, 4.0f);
_view.Scale = new Float2(value);
}
@@ -483,7 +485,7 @@ namespace FlaxEditor
}
}
}
if (EnableSelecting && !_mouseMovesControl && IsMouseOver)
if (EnableSelecting && !_mouseMovesControl && !_mouseMovesWidget && IsMouseOver)
{
// Highlight control under mouse for easier selecting (except if already selected)
if (RayCastControl(ref mousePos, out var hitControl) &&

View File

@@ -201,8 +201,8 @@ namespace FlaxEditor.Options
/// <returns>True if input has been processed, otherwise false.</returns>
public bool Process(Control control)
{
var root = control.Root;
return root.GetKey(Key) && ProcessModifiers(control);
var root = control?.Root;
return root != null && root.GetKey(Key) && ProcessModifiers(control);
}
/// <summary>

View File

@@ -76,10 +76,10 @@ namespace FlaxEditor.Viewport
public Float2 MouseDelta => _mouseDelta * 1000;
/// <inheritdoc />
public bool UseSnapping => Root.GetKey(KeyboardKeys.Control);
public bool UseSnapping => Root?.GetKey(KeyboardKeys.Control) ?? false;
/// <inheritdoc />
public bool UseDuplicate => Root.GetKey(KeyboardKeys.Shift);
public bool UseDuplicate => Root?.GetKey(KeyboardKeys.Shift) ?? false;
/// <inheritdoc />
public Undo Undo { get; }