diff --git a/Source/Editor/Content/GUI/ContentView.cs b/Source/Editor/Content/GUI/ContentView.cs
index 9bb9a5ba3..8c3c26e54 100644
--- a/Source/Editor/Content/GUI/ContentView.cs
+++ b/Source/Editor/Content/GUI/ContentView.cs
@@ -597,6 +597,14 @@ namespace FlaxEditor.Content.GUI
}
}
+ ///
+ public override bool OnMouseDown(Vector2 location, MouseButton button)
+ {
+ if (base.OnMouseDown(location, button))
+ return true;
+ return AutoFocus && Focus(this);
+ }
+
///
public override bool OnMouseWheel(Vector2 location, float delta)
{
diff --git a/Source/Engine/UI/GUI/Common/Button.cs b/Source/Engine/UI/GUI/Common/Button.cs
index 576563f49..fa2b89d7e 100644
--- a/Source/Engine/UI/GUI/Common/Button.cs
+++ b/Source/Engine/UI/GUI/Common/Button.cs
@@ -236,51 +236,59 @@ namespace FlaxEngine.GUI
///
public override bool OnMouseDown(Vector2 location, MouseButton button)
{
+ if (base.OnMouseDown(location, button))
+ return true;
+
if (button == MouseButton.Left && !_isPressed)
{
OnPressBegin();
return true;
}
-
- return base.OnMouseDown(location, button);
+ return false;
}
///
public override bool OnMouseUp(Vector2 location, MouseButton button)
{
+ if (base.OnMouseUp(location, button))
+ return true;
+
if (button == MouseButton.Left && _isPressed)
{
OnPressEnd();
OnClick();
return true;
}
-
- return base.OnMouseUp(location, button);
+ return false;
}
///
public override bool OnTouchDown(Vector2 location, int pointerId)
{
+ if (base.OnTouchDown(location, pointerId))
+ return true;
+
if (!_isPressed)
{
OnPressBegin();
return true;
}
-
- return base.OnTouchDown(location, pointerId);
+ return false;
}
///
public override bool OnTouchUp(Vector2 location, int pointerId)
{
+ if (base.OnTouchUp(location, pointerId))
+ return true;
+
if (_isPressed)
{
OnPressEnd();
OnClick();
return true;
}
-
- return base.OnTouchUp(location, pointerId);
+ return false;
}
///
diff --git a/Source/Engine/UI/GUI/Common/Dropdown.cs b/Source/Engine/UI/GUI/Common/Dropdown.cs
index ea2debb4a..cab63ba32 100644
--- a/Source/Engine/UI/GUI/Common/Dropdown.cs
+++ b/Source/Engine/UI/GUI/Common/Dropdown.cs
@@ -547,23 +547,25 @@ namespace FlaxEngine.GUI
if (button == MouseButton.Left)
{
_touchDown = true;
+ Focus();
return true;
}
-
return false;
}
///
public override bool OnMouseUp(Vector2 location, MouseButton button)
{
+ if (base.OnMouseUp(location, button))
+ return true;
+
if (_touchDown && button == MouseButton.Left)
{
_touchDown = false;
ShowPopup();
return true;
}
-
- return base.OnMouseUp(location, button);
+ return false;
}
///
diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs
index 9a57cf91c..0b02d0c21 100644
--- a/Source/Engine/UI/GUI/ContainerControl.cs
+++ b/Source/Engine/UI/GUI/ContainerControl.cs
@@ -783,10 +783,8 @@ namespace FlaxEngine.GUI
var child = _children[i];
if (child.Visible && child.Enabled)
{
- // Fire events
if (IntersectsChildContent(child, location, out var childLocation))
{
- // Wheel
if (child.OnMouseWheel(childLocation, delta))
{
return true;
@@ -794,8 +792,7 @@ namespace FlaxEngine.GUI
}
}
}
-
- return base.OnMouseWheel(location, delta);
+ return false;
}
///
@@ -807,10 +804,8 @@ namespace FlaxEngine.GUI
var child = _children[i];
if (child.Visible && child.Enabled)
{
- // Fire event
if (IntersectsChildContent(child, location, out var childLocation))
{
- // Send event further
if (child.OnMouseDown(childLocation, button))
{
return true;
@@ -818,8 +813,7 @@ namespace FlaxEngine.GUI
}
}
}
-
- return base.OnMouseDown(location, button);
+ return false;
}
///
@@ -831,10 +825,8 @@ namespace FlaxEngine.GUI
var child = _children[i];
if (child.Visible && child.Enabled)
{
- // Fire event
if (IntersectsChildContent(child, location, out var childLocation))
{
- // Send event further
if (child.OnMouseUp(childLocation, button))
{
return true;
@@ -842,8 +834,7 @@ namespace FlaxEngine.GUI
}
}
}
-
- return base.OnMouseUp(location, button);
+ return false;
}
///
@@ -855,10 +846,8 @@ namespace FlaxEngine.GUI
var child = _children[i];
if (child.Visible && child.Enabled)
{
- // Fire event
if (IntersectsChildContent(child, location, out var childLocation))
{
- // Send event further
if (child.OnMouseDoubleClick(childLocation, button))
{
return true;
@@ -866,8 +855,7 @@ namespace FlaxEngine.GUI
}
}
}
-
- return base.OnMouseDoubleClick(location, button);
+ return false;
}
///
diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs
index ca62f117f..4117822c1 100644
--- a/Source/Engine/UI/GUI/Control.cs
+++ b/Source/Engine/UI/GUI/Control.cs
@@ -653,7 +653,7 @@ namespace FlaxEngine.GUI
[NoAnimate]
public virtual bool OnMouseDown(Vector2 location, MouseButton button)
{
- return _autoFocus && Focus(this);
+ return false;
}
///
diff --git a/Source/Engine/UI/GUI/Panels/Panel.cs b/Source/Engine/UI/GUI/Panels/Panel.cs
index f2e1a2a46..eff9e99b8 100644
--- a/Source/Engine/UI/GUI/Panels/Panel.cs
+++ b/Source/Engine/UI/GUI/Panels/Panel.cs
@@ -261,6 +261,14 @@ namespace FlaxEngine.GUI
PerformLayout();
}
+ ///
+ public override bool OnMouseDown(Vector2 location, MouseButton button)
+ {
+ if (base.OnMouseDown(location, button))
+ return true;
+ return AutoFocus && Focus(this);
+ }
+
///
public override bool OnMouseWheel(Vector2 location, float delta)
{
diff --git a/Source/Engine/UI/GUI/Panels/SplitPanel.cs b/Source/Engine/UI/GUI/Panels/SplitPanel.cs
index 04160db25..841d6ff55 100644
--- a/Source/Engine/UI/GUI/Panels/SplitPanel.cs
+++ b/Source/Engine/UI/GUI/Panels/SplitPanel.cs
@@ -169,29 +169,31 @@ namespace FlaxEngine.GUI
///
public override bool OnMouseDown(Vector2 location, MouseButton button)
{
- if (button == MouseButton.Left)
- {
- if (_splitterRect.Contains(location))
- {
- // Start moving splitter
- StartTracking();
- return false;
- }
- }
+ if (base.OnMouseDown(location, button))
+ return true;
- return base.OnMouseDown(location, button);
+ if (button == MouseButton.Left && _splitterRect.Contains(location))
+ {
+ // Start moving splitter
+ StartTracking();
+ Focus();
+ return false;
+ }
+ return false;
}
///
public override bool OnMouseUp(Vector2 location, MouseButton button)
{
+ if (base.OnMouseUp(location, button))
+ return true;
+
if (_splitterClicked)
{
EndTracking();
return true;
}
-
- return base.OnMouseUp(location, button);
+ return false;
}
///