Merge branch 'actor-drag-visual-change' of https://github.com/Tryibion/FlaxEngine into Tryibion-actor-drag-visual-change
This commit is contained in:
@@ -40,6 +40,11 @@ namespace FlaxEditor.GUI.Tree
|
||||
private Margin _margin;
|
||||
private bool _autoSize = true;
|
||||
|
||||
/// <summary>
|
||||
/// The TreeNode that is being dragged over. This could have a value when not dragging.
|
||||
/// </summary>
|
||||
public TreeNode DraggedOverNode = null;
|
||||
|
||||
/// <summary>
|
||||
/// Action fired when tree nodes selection gets changed.
|
||||
/// </summary>
|
||||
|
||||
@@ -659,7 +659,7 @@ namespace FlaxEditor.GUI.Tree
|
||||
Render2D.DrawText(TextFont.GetFont(), _text, textRect, _cachedTextColor, TextAlignment.Near, TextAlignment.Center);
|
||||
|
||||
// Draw drag and drop effect
|
||||
if (IsDragOver)
|
||||
if (IsDragOver && _tree.DraggedOverNode == this)
|
||||
{
|
||||
Color dragOverColor = style.BackgroundSelected * 0.6f;
|
||||
Rectangle rect;
|
||||
@@ -669,10 +669,10 @@ namespace FlaxEditor.GUI.Tree
|
||||
rect = textRect;
|
||||
break;
|
||||
case DragItemPositioning.Above:
|
||||
rect = new Rectangle(textRect.X, textRect.Y - DefaultDragInsertPositionMargin - DefaultNodeOffsetY, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
rect = new Rectangle(textRect.X, textRect.Top - DefaultDragInsertPositionMargin - DefaultNodeOffsetY - _margin.Top, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
break;
|
||||
case DragItemPositioning.Below:
|
||||
rect = new Rectangle(textRect.X, textRect.Bottom - DefaultDragInsertPositionMargin, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
rect = new Rectangle(textRect.X, textRect.Bottom + _margin.Bottom - DefaultDragInsertPositionMargin, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
break;
|
||||
default:
|
||||
rect = Rectangle.Empty;
|
||||
@@ -922,6 +922,7 @@ namespace FlaxEditor.GUI.Tree
|
||||
if (result == DragDropEffect.None)
|
||||
{
|
||||
UpdateDrawPositioning(ref location);
|
||||
_tree.DraggedOverNode = this;
|
||||
|
||||
// Check if mouse is over header
|
||||
_isDragOverHeader = TestHeaderHit(ref location);
|
||||
|
||||
@@ -706,6 +706,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
{
|
||||
DragData data;
|
||||
var tree = ParentTree;
|
||||
if (tree.Selection.Count == 1)
|
||||
Select();
|
||||
|
||||
// Check if this node is selected
|
||||
if (tree.Selection.Contains(this))
|
||||
@@ -715,6 +717,11 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
for (var i = 0; i < tree.Selection.Count; i++)
|
||||
{
|
||||
var e = tree.Selection[i];
|
||||
|
||||
// Skip if parent is already selected to keep correct parenting
|
||||
if (tree.Selection.Contains(e.Parent))
|
||||
continue;
|
||||
|
||||
if (e is ActorTreeNode node && node.ActorNode.CanDrag)
|
||||
actors.Add(node.ActorNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user