diff --git a/Source/Editor/Surface/ResizableSurfaceNode.cs b/Source/Editor/Surface/ResizableSurfaceNode.cs
index ea9ceec82..26c64c382 100644
--- a/Source/Editor/Surface/ResizableSurfaceNode.cs
+++ b/Source/Editor/Surface/ResizableSurfaceNode.cs
@@ -23,10 +23,15 @@ namespace FlaxEditor.Surface
///
private const float BorderWidth = 15f;
- private readonly VisjectSurface Surface;
+ private readonly VisjectSurface _surface;
private Float2 _surfaceMouseLocation;
private Float2 startResizingSize;
+ ///
+ /// Wether to ignore the surface index in parent when updating the cursor type. Set to false for nodes that have order like .
+ ///
+ internal bool IgnoreSurfaceIndex = true;
+
///
/// The resizable node that this controls.
///
@@ -67,10 +72,14 @@ namespace FlaxEditor.Surface
}
}
- ///
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The surface.
+ /// The this controls.
public ResizeBorder(VisjectSurface surface, ResizableSurfaceNode resizableNode)
{
- Surface = surface;
+ _surface = surface;
ResizableNode = resizableNode;
}
@@ -87,7 +96,7 @@ namespace FlaxEditor.Surface
private void UpdateSurfaceMouseLocation()
{
- _surfaceMouseLocation = Surface.PointFromScreen(Input.MouseScreenPosition);
+ _surfaceMouseLocation = _surface.PointFromScreen(Input.MouseScreenPosition);
}
private void UpdateResizeFlags(Float2 mouseLocation)
@@ -122,18 +131,10 @@ namespace FlaxEditor.Surface
{
var emptySize = ResizableNode.CalculateNodeSize(0, 0);
ResizableNode.SizeValue = ResizableNode.Size - emptySize;
- Surface.MarkAsEdited(false);
+ _surface.MarkAsEdited(false);
}
}
- ///
- public override void OnMouseLeave()
- {
- Cursor = CursorType.Default;
- IsMouseOverResizeBorder = false;
- base.OnMouseLeave();
- }
-
///
public override void OnMouseMove(Float2 location)
{
@@ -147,7 +148,7 @@ namespace FlaxEditor.Surface
var resizeAxisPos = Float2.Clamp(ResizeDirection, Float2.Zero, Float2.One);
var resizeAxisNeg = Float2.Clamp(-ResizeDirection, Float2.Zero, Float2.One);
- var currentSurfaceMouse = Surface.PointFromScreen(Input.MouseScreenPosition);
+ var currentSurfaceMouse = _surface.PointFromScreen(Input.MouseScreenPosition);
var delta = currentSurfaceMouse - _surfaceMouseLocation;
// TODO: scale/size snapping?
@@ -159,8 +160,6 @@ namespace FlaxEditor.Surface
var emptySize = ResizableNode.CalculateNodeSize(0, 0);
- // TODO: Fix: Can't move comments anymore
-
// TODO: If resize is blocked by min size and the user tries to increase the size again, wait until !blocked by min size to apply delta again
// To do this, just record pos when starting to block by min size and if (cursorLocation > min) { ResizeAgain() }
@@ -168,23 +167,26 @@ namespace FlaxEditor.Surface
ResizableNode.Size = new Float2(Mathf.Max(ResizableNode.Size.X, ResizableNode.sizeMin.X), Mathf.Max(ResizableNode.Size.Y, ResizableNode.sizeMin.Y));
ResizableNode.Location += uiControlDelta * resizeAxisNeg;
- // Only move if size wasn't clamped
-
-
- //Debug.Log($"OLD: {oldSize} NEW: {ResizableNode.Size}");
-
ResizableNode.SizeValue = ResizableNode.Size - emptySize;
ResizableNode.SizeValue = new Float2(Mathf.Max(ResizableNode.SizeValue.X, ResizableNode.sizeMin.X), Mathf.Max(ResizableNode.SizeValue.Y, ResizableNode.sizeMin.Y));
+
ResizableNode.CalculateNodeSize(ResizableNode.Size.X, ResizableNode.Size.Y);
UpdateSurfaceMouseLocation();
MatchResizableNode(ResizableNode.Size, ResizableNode.Location);
}
- if (IsMouseOverResizeBorder)
- Cursor = CursorType;
- else
- Cursor = CursorType.Default;
+ // Update the cursor shape
+ if (_surface.resizeableNodeIndexInParent <= IndexInParent || IgnoreSurfaceIndex)
+ {
+ if (!IgnoreSurfaceIndex)
+ _surface.resizeableNodeIndexInParent = IndexInParent;
+
+ if (IsMouseOverResizeBorder)
+ Cursor = CursorType;
+ else
+ Cursor = CursorType.Default;
+ }
base.OnMouseMove(location);
}
@@ -196,6 +198,15 @@ namespace FlaxEditor.Surface
base.OnMouseEnter(location);
}
+ ///
+ public override void OnMouseLeave()
+ {
+ Cursor = CursorType.Default;
+ IsMouseOverResizeBorder = false;
+ _surface.resizeableNodeIndexInParent = -1; // Will get updated by MouseMove again to match current index
+ base.OnMouseLeave();
+ }
+
///
public override bool OnMouseDown(Float2 location, MouseButton button)
{
@@ -291,10 +302,10 @@ namespace FlaxEditor.Surface
base.OnLocationChanged();
}
- ///
+ ///
public override void OnSurfaceLoaded(SurfaceNodeActions action)
{
- // Reapply the curve node size
+ // Reapply the node size
var size = SizeValue;
if (Surface != null && Surface.GridSnappingEnabled)
size = Surface.SnapToGrid(size, true);
diff --git a/Source/Editor/Surface/SurfaceComment.cs b/Source/Editor/Surface/SurfaceComment.cs
index 73f280d48..4966c83b3 100644
--- a/Source/Editor/Surface/SurfaceComment.cs
+++ b/Source/Editor/Surface/SurfaceComment.cs
@@ -65,6 +65,8 @@ namespace FlaxEditor.Surface
EndEditOnClick = false, // We have to handle this ourselves, otherwise the textbox instantly loses focus when double-clicking the header
HorizontalAlignment = TextAlignment.Center,
};
+
+ ResizeBorderControl.IgnoreSurfaceIndex = false;
}
///
diff --git a/Source/Editor/Surface/VisjectSurface.cs b/Source/Editor/Surface/VisjectSurface.cs
index 69c44ab98..352bc1ebe 100644
--- a/Source/Editor/Surface/VisjectSurface.cs
+++ b/Source/Editor/Surface/VisjectSurface.cs
@@ -62,6 +62,7 @@ namespace FlaxEditor.Surface
private int _selectedConnectionIndex;
internal int _isUpdatingBoxTypes;
+ internal int resizeableNodeIndexInParent = -1;
///
/// True if surface supports implicit casting of the FlaxEngine.Object types into Boolean value (as simple validate check).