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 Margin _margin;
|
||||||
private bool _autoSize = true;
|
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>
|
/// <summary>
|
||||||
/// Action fired when tree nodes selection gets changed.
|
/// Action fired when tree nodes selection gets changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
Render2D.DrawText(TextFont.GetFont(), _text, textRect, _cachedTextColor, TextAlignment.Near, TextAlignment.Center);
|
Render2D.DrawText(TextFont.GetFont(), _text, textRect, _cachedTextColor, TextAlignment.Near, TextAlignment.Center);
|
||||||
|
|
||||||
// Draw drag and drop effect
|
// Draw drag and drop effect
|
||||||
if (IsDragOver)
|
if (IsDragOver && _tree.DraggedOverNode == this)
|
||||||
{
|
{
|
||||||
Color dragOverColor = style.BackgroundSelected * 0.6f;
|
Color dragOverColor = style.BackgroundSelected * 0.6f;
|
||||||
Rectangle rect;
|
Rectangle rect;
|
||||||
@@ -669,10 +669,10 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
rect = textRect;
|
rect = textRect;
|
||||||
break;
|
break;
|
||||||
case DragItemPositioning.Above:
|
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;
|
break;
|
||||||
case DragItemPositioning.Below:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
rect = Rectangle.Empty;
|
rect = Rectangle.Empty;
|
||||||
@@ -922,6 +922,7 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
if (result == DragDropEffect.None)
|
if (result == DragDropEffect.None)
|
||||||
{
|
{
|
||||||
UpdateDrawPositioning(ref location);
|
UpdateDrawPositioning(ref location);
|
||||||
|
_tree.DraggedOverNode = this;
|
||||||
|
|
||||||
// Check if mouse is over header
|
// Check if mouse is over header
|
||||||
_isDragOverHeader = TestHeaderHit(ref location);
|
_isDragOverHeader = TestHeaderHit(ref location);
|
||||||
|
|||||||
@@ -706,6 +706,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
{
|
{
|
||||||
DragData data;
|
DragData data;
|
||||||
var tree = ParentTree;
|
var tree = ParentTree;
|
||||||
|
if (tree.Selection.Count == 1)
|
||||||
|
Select();
|
||||||
|
|
||||||
// Check if this node is selected
|
// Check if this node is selected
|
||||||
if (tree.Selection.Contains(this))
|
if (tree.Selection.Contains(this))
|
||||||
@@ -715,6 +717,11 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
for (var i = 0; i < tree.Selection.Count; i++)
|
for (var i = 0; i < tree.Selection.Count; i++)
|
||||||
{
|
{
|
||||||
var e = tree.Selection[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)
|
if (e is ActorTreeNode node && node.ActorNode.CanDrag)
|
||||||
actors.Add(node.ActorNode);
|
actors.Add(node.ActorNode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user