Add editor shortcuts usability when toolstrip or main menu controls are focused
This commit is contained in:
@@ -304,6 +304,17 @@ namespace FlaxEditor.GUI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnKeyDown(KeyboardKeys key)
|
||||||
|
{
|
||||||
|
if (base.OnKeyDown(key))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Fallback to the edit window for shortcuts
|
||||||
|
var editor = Editor.Instance;
|
||||||
|
return editor.Windows.EditWin.InputActions.Process(editor, this, key);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void PerformLayoutAfterChildren()
|
protected override void PerformLayoutAfterChildren()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using FlaxEditor.Windows;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
using FlaxEngine.GUI;
|
using FlaxEngine.GUI;
|
||||||
|
|
||||||
@@ -181,5 +182,25 @@ namespace FlaxEditor.GUI
|
|||||||
|
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnKeyDown(KeyboardKeys key)
|
||||||
|
{
|
||||||
|
if (base.OnKeyDown(key))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Fallback to the owning window for shortcuts
|
||||||
|
EditorWindow editorWindow = null;
|
||||||
|
ContainerControl c = Parent;
|
||||||
|
while (c != null && editorWindow == null)
|
||||||
|
{
|
||||||
|
editorWindow = c as EditorWindow;
|
||||||
|
c = c.Parent;
|
||||||
|
}
|
||||||
|
var editor = Editor.Instance;
|
||||||
|
if (editorWindow == null)
|
||||||
|
editorWindow = editor.Windows.EditWin; // Fallback to main editor window
|
||||||
|
return editorWindow.InputActions.Process(editor, this, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ namespace FlaxEditor.Modules
|
|||||||
public void ShowFinder(Control control)
|
public void ShowFinder(Control control)
|
||||||
{
|
{
|
||||||
var finder = _finder ?? (_finder = new ContentFinder());
|
var finder = _finder ?? (_finder = new ContentFinder());
|
||||||
|
if (control == null)
|
||||||
|
control = Editor.Instance.Windows.MainWindow.GUI;
|
||||||
var position = (control.Size - new Float2(finder.Width, 300.0f)) * 0.5f;
|
var position = (control.Size - new Float2(finder.Width, 300.0f)) * 0.5f;
|
||||||
finder.Show(control, position);
|
finder.Show(control, position);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user