Merge branch 'doubleclick_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-doubleclick_fix

This commit is contained in:
2026-08-18 12:02:26 +02:00
22 changed files with 110 additions and 65 deletions
@@ -186,8 +186,13 @@ namespace FlaxEditor.Content.Import
/// <inheritdoc />
protected override bool OnMouseDoubleClickHeader(ref Float2 location, MouseButton button)
{
StartRenaming();
return true;
if (button == MouseButton.Left)
{
StartRenaming();
return true;
}
return false;
}
public override bool OnKeyDown(KeyboardKeys key)
+7 -3
View File
@@ -796,10 +796,14 @@ namespace FlaxEditor.Content
{
Focus();
// Open
(Parent as ContentView).OnItemDoubleClick(this);
if (button == MouseButton.Left)
{
// Open
(Parent as ContentView).OnItemDoubleClick(this);
return true;
}
return true;
return false;
}
/// <inheritdoc />
@@ -179,11 +179,18 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
Focus();
// Open model editor window
if (_value.Actor is StaticModel staticModel)
Editor.Instance.ContentEditing.Open(staticModel.Model);
else if (_value.Actor is AnimatedModel animatedModel)
Editor.Instance.ContentEditing.Open(animatedModel.SkinnedModel);
if (button == MouseButton.Left)
{
// Open model editor window
if (_value.Actor is StaticModel staticModel)
Editor.Instance.ContentEditing.Open(staticModel.Model);
else if (_value.Actor is AnimatedModel animatedModel)
Editor.Instance.ContentEditing.Open(animatedModel.SkinnedModel);
else
return base.OnMouseDoubleClick(location, button);
return true;
}
return base.OnMouseDoubleClick(location, button);
}
@@ -395,7 +395,7 @@ namespace FlaxEditor.CustomEditors.Editors
Focus();
// Check if has object selected
if (_value != null)
if (button == MouseButton.Left && _value != null)
{
if (_linkedTreeNode != null)
{
@@ -410,6 +410,8 @@ namespace FlaxEditor.CustomEditors.Editors
Select(script.Actor);
else if (_value is Asset asset)
Editor.Instance.Windows.ContentWin.Select(asset);
return true;
}
return base.OnMouseDoubleClick(location, button);
@@ -236,6 +236,7 @@ namespace FlaxEditor.CustomEditors.Editors
if (button == MouseButton.Left && _value != ScriptType.Null)
{
Editor.Instance.ContentEditing.Open(_value.ContentItem);
return true;
}
return base.OnMouseDoubleClick(location, button);
+1 -1
View File
@@ -341,7 +341,7 @@ namespace FlaxEditor.GUI
{
Focus();
if (Validator.SelectedItem != null && IconRect.Contains(location))
if (button == MouseButton.Left && Validator.SelectedItem != null && IconRect.Contains(location))
{
// Open it
Editor.Instance.ContentEditing.Open(Validator.SelectedItem);
+2 -1
View File
@@ -34,7 +34,8 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
DoubleClick?.Invoke();
if (button == MouseButton.Left)
DoubleClick?.Invoke();
return base.OnMouseDoubleClick(location, button);
}
+12 -9
View File
@@ -554,16 +554,19 @@ namespace FlaxEditor.GUI
if (base.OnMouseDoubleClick(location, button))
return true;
// Add keyframe on double click
var child = GetChildAt(location);
if (child is not KeyframePoint &&
child is not TangentPoint &&
_editor.KeyframesCount < _editor.MaxKeyframes)
if (button == MouseButton.Left)
{
var viewRect = _editor._mainPanel.GetClientArea();
var pos = PointToKeyframes(location, ref viewRect);
_editor.AddKeyframe(pos);
return true;
// Add keyframe on double click
var child = GetChildAt(location);
if (child is not KeyframePoint &&
child is not TangentPoint &&
_editor.KeyframesCount < _editor.MaxKeyframes)
{
var viewRect = _editor._mainPanel.GetClientArea();
var pos = PointToKeyframes(location, ref viewRect);
_editor.AddKeyframe(pos);
return true;
}
}
return false;
+5 -2
View File
@@ -257,8 +257,11 @@ namespace FlaxEditor.GUI
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
DoubleClick?.Invoke();
RowDoubleClick?.Invoke(this);
if (button == MouseButton.Left)
{
DoubleClick?.Invoke();
RowDoubleClick?.Invoke(this);
}
return base.OnMouseDoubleClick(location, button);
}
+1 -1
View File
@@ -478,7 +478,7 @@ namespace FlaxEditor.GUI.Timeline
if (base.OnMouseDoubleClick(location, button))
return true;
if (PropertiesEditObject != null)
if (button == MouseButton.Left && PropertiesEditObject != null)
{
Timeline.ShowEditPopup(PropertiesEditObject, PointToParent(Timeline, location), Track);
return true;
+1 -1
View File
@@ -1286,7 +1286,7 @@ namespace FlaxEditor.GUI.Timeline
if (base.OnMouseDoubleClick(location, button))
return true;
if (CanRename && TestHeaderHit(ref location))
if (button == MouseButton.Left && CanRename && TestHeaderHit(ref location))
{
StartRenaming();
return true;
+4 -3
View File
@@ -508,17 +508,18 @@ namespace FlaxEditor.GUI.Tree
/// <returns>True if event has been handled.</returns>
protected virtual bool OnMouseDoubleClickHeader(ref Float2 location, MouseButton button)
{
if (HasAnyVisibleChild && _animationProgress >= 1.0f)
if (button == MouseButton.Left && HasAnyVisibleChild && _animationProgress >= 1.0f)
{
// Toggle open state (ignored while an expand/collapse animation is running)
if (_opened)
Collapse();
else
Expand();
return true;
}
// Handled
return true;
return false;
}
/// <summary>
@@ -213,7 +213,7 @@ namespace FlaxEditor.Surface.Archetypes
if (base.OnMouseDoubleClick(location, button))
return true;
if (_headerRect.Contains(ref location))
if (button == MouseButton.Left && _headerRect.Contains(ref location))
{
StartRenaming();
return true;
@@ -1129,7 +1129,7 @@ namespace FlaxEditor.Surface.Archetypes
if (base.OnMouseDoubleClick(location, button))
return true;
if (_renameButtonRect.Contains(ref location) || _closeButtonRect.Contains(ref location))
if (button == MouseButton.Left && _renameButtonRect.Contains(ref location) || _closeButtonRect.Contains(ref location))
return true;
return false;
@@ -1489,8 +1489,13 @@ namespace FlaxEditor.Surface.Archetypes
if (base.OnMouseDoubleClick(location, button))
return true;
Edit();
return true;
if (button == MouseButton.Left)
{
Edit();
return true;
}
return false;
}
/// <inheritdoc />
+1 -1
View File
@@ -236,7 +236,7 @@ namespace FlaxEditor.Surface
return true;
// Rename
if (_headerRect.Contains(ref location) && Surface.CanEdit)
if (button == MouseButton.Left && _headerRect.Contains(ref location) && Surface.CanEdit)
{
StartRenaming();
return true;
@@ -464,7 +464,7 @@ namespace FlaxEditor.Surface
CustomMouseDoubleClick?.Invoke(ref location, button, ref handled);
// Insert reroute node
if (!handled && CanEdit && CanUseNodeType(7, 29))
if (button == MouseButton.Left && !handled && CanEdit && CanUseNodeType(7, 29))
{
var mousePos = _rootControl.PointFromParent(ref _mousePos);
if (IntersectsConnection(mousePos, out InputBox inputBox, out OutputBox outputBox, MouseOverConnectionDistance) && GetControlUnderMouse() == null)
+7 -2
View File
@@ -239,8 +239,13 @@ namespace FlaxEditor.Windows
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
Open();
return true;
if (button == MouseButton.Left)
{
Open();
return true;
}
return false;
}
/// <inheritdoc />
+12 -9
View File
@@ -104,18 +104,21 @@ namespace FlaxEditor.Windows
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Click on text block
int textLength = TextLength;
if (textLength != 0)
if (button == MouseButton.Left)
{
var hitPos = CharIndexAtPoint(ref location);
if (hitPos != -1 && GetTextBlock(hitPos, out var textBlock) && textBlock.Tag is TextBlockTag tag)
// Click on text block
int textLength = TextLength;
if (textLength != 0)
{
switch (tag.Type)
var hitPos = CharIndexAtPoint(ref location);
if (hitPos != -1 && GetTextBlock(hitPos, out var textBlock) && textBlock.Tag is TextBlockTag tag)
{
case TextBlockTag.Types.CodeLocation:
Window.Editor.CodeEditing.OpenFile(tag.Url, tag.Line);
return true;
switch (tag.Type)
{
case TextBlockTag.Types.CodeLocation:
Window.Editor.CodeEditing.OpenFile(tag.Url, tag.Line);
return true;
}
}
}
}
@@ -162,7 +162,7 @@ namespace FlaxEngine.Windows.Search
/// <inheritdoc />
protected override bool OnMouseDoubleClickHeader(ref Float2 location, MouseButton button)
{
if (Navigate != null)
if (button == MouseButton.Left && Navigate != null)
{
Navigate.Invoke(this);
return true;
@@ -71,9 +71,14 @@ namespace FlaxEditor.Windows
/// <inheritdoc />
protected override bool OnMouseDoubleClickHeader(ref Float2 location, MouseButton button)
{
var node = GetNode(Tag);
((VisualScriptWindow)node?.Surface.Owner)?.ShowNode(node);
return true;
if (button == MouseButton.Left)
{
var node = GetNode(Tag);
((VisualScriptWindow)node?.Surface.Owner)?.ShowNode(node);
return true;
}
return false;
}
}
+1 -4
View File
@@ -250,10 +250,7 @@ namespace FlaxEngine.GUI
// Test 3D
if (RayCast3D(ref location, out var hit, out var hitLocation))
{
hit.OnMouseDoubleClick(hitLocation, button);
return true;
}
return hit.OnMouseDoubleClick(hitLocation, button);
return false;
}
+13 -10
View File
@@ -257,17 +257,20 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Select the word under the mouse
int textLength = TextLength;
if (textLength != 0 && IsSelectable)
if (button == MouseButton.Left)
{
var hitPos = CharIndexAtPoint(ref location);
int spaceLoc = _text.LastIndexOfAny(Separators, hitPos - 2);
var left = spaceLoc == -1 ? 0 : spaceLoc + 1;
spaceLoc = _text.IndexOfAny(Separators, Math.Min(hitPos + 1, _text.Length));
var right = spaceLoc == -1 ? textLength : spaceLoc;
Deselect();
SetSelection(left, right);
// Select the word under the mouse
int textLength = TextLength;
if (textLength != 0 && IsSelectable)
{
var hitPos = CharIndexAtPoint(ref location);
int spaceLoc = _text.LastIndexOfAny(Separators, hitPos - 2);
var left = spaceLoc == -1 ? 0 : spaceLoc + 1;
spaceLoc = _text.IndexOfAny(Separators, Math.Min(hitPos + 1, _text.Length));
var right = spaceLoc == -1 ? textLength : spaceLoc;
Deselect();
SetSelection(left, right);
}
}
return base.OnMouseDoubleClick(location, button);
+1 -1
View File
@@ -328,7 +328,7 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
if (IsSelectable)
if (button == MouseButton.Left && IsSelectable)
{
SelectAll();
}