Redo 969d0390ce to use in-built AutoFocus but fix focus issue
This commit is contained in:
@@ -14,8 +14,6 @@ namespace FlaxEditor.Windows
|
||||
/// <seealso cref="DockWindow" />
|
||||
public abstract class EditorWindow : DockWindow
|
||||
{
|
||||
private bool _mouseDown;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the editor object.
|
||||
/// </summary>
|
||||
@@ -40,6 +38,7 @@ namespace FlaxEditor.Windows
|
||||
protected EditorWindow(Editor editor, bool hideOnClose, ScrollBars scrollBars)
|
||||
: base(editor.UI.MasterPanel, hideOnClose, scrollBars)
|
||||
{
|
||||
AutoFocus = true;
|
||||
Editor = editor;
|
||||
|
||||
InputActions.Add(options => options.ContentFinder, () =>
|
||||
@@ -225,41 +224,6 @@ namespace FlaxEditor.Windows
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
if (base.OnMouseDown(location, button))
|
||||
return true;
|
||||
if (button == MouseButton.Left)
|
||||
{
|
||||
_mouseDown = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (base.OnMouseUp(location, button))
|
||||
return true;
|
||||
if (button == MouseButton.Left && _mouseDown)
|
||||
{
|
||||
_mouseDown = false;
|
||||
Focus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseLeave()
|
||||
{
|
||||
_mouseDown = false;
|
||||
|
||||
base.OnMouseLeave();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user