From ebca32e6d10062cd6e1e5bf99dab08fd07c9acbe Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Mon, 7 Apr 2025 23:09:21 +0300 Subject: [PATCH] Apply drag and drop styling on refactored WindowDragHelper Reapplies changes from commit 38b00f458c7544037028538174a438413bd37857 --- Source/Editor/GUI/Docking/WindowDragHelper.cs | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Source/Editor/GUI/Docking/WindowDragHelper.cs b/Source/Editor/GUI/Docking/WindowDragHelper.cs index 551488a51..a6c0ee31d 100644 --- a/Source/Editor/GUI/Docking/WindowDragHelper.cs +++ b/Source/Editor/GUI/Docking/WindowDragHelper.cs @@ -183,6 +183,21 @@ namespace FlaxEditor.GUI.Docking return new WindowDragHelper(floatingPanelToMove, dragSourceWindow); } + private sealed class DragVisuals : Control + { + public DragVisuals() + { + AnchorPreset = AnchorPresets.StretchAll; + Offsets = Margin.Zero; + } + + public override void Draw() + { + base.Draw(); + Render2D.DrawRectangle(new Rectangle(Float2.Zero, Size), Style.Current.SelectionBorder); + } + } + private void AddDockHints() { if (_toDock == null) @@ -199,11 +214,9 @@ namespace FlaxEditor.GUI.Docking Control AddHintControl(Float2 pivot) { - Control hintControl = _toDock.AddChild(); - hintControl.AnchorPreset = AnchorPresets.StretchAll; - hintControl.Offsets = Margin.Zero; + DragVisuals hintControl = _toDock.AddChild(); hintControl.Size = new Float2(HintControlSize); - hintControl.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + hintControl.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); hintControl.Pivot = pivot; hintControl.PivotRelative = true; return hintControl; @@ -358,34 +371,34 @@ namespace FlaxEditor.GUI.Docking if (hoveredHintControl != _dockHintDown) { _dockHintDown.Size = new Float2(HintControlSize); - _dockHintDown.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + _dockHintDown.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); } if (hoveredHintControl != _dockHintLeft) { _dockHintLeft.Size = new Float2(HintControlSize); - _dockHintLeft.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + _dockHintLeft.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); } if (hoveredHintControl != _dockHintRight) { _dockHintRight.Size = new Float2(HintControlSize); - _dockHintRight.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + _dockHintRight.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); } if (hoveredHintControl != _dockHintUp) { _dockHintUp.Size = new Float2(HintControlSize); - _dockHintUp.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + _dockHintUp.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); } if (hoveredHintControl != _dockHintCenter) { _dockHintCenter.Size = new Float2(HintControlSize); - _dockHintCenter.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(0.6f); + _dockHintCenter.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f); } if (_toSet != DockState.Float) { if (hoveredHintControl != null) { - hoveredHintControl.BackgroundColor = Style.Current.DragWindow.AlphaMultiplied(1.0f); + hoveredHintControl.BackgroundColor = Style.Current.Selection.AlphaMultiplied(1.0f); hoveredHintControl.Size = hoveredSizeOverride; } }