From a4082934b8cb443d872ea3fee4d70b334df76ccf Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 16 Mar 2025 23:06:08 +0100 Subject: [PATCH] Update Editor UI to use empty Pivot after fa68a5f5722edbfece6fd8ddbe145fad88a8ffb8 #3031 --- Source/Editor/CustomEditors/CustomEditorPresenter.cs | 1 + Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs | 1 + Source/Editor/CustomEditors/Editors/CollectionEditor.cs | 6 ++++++ .../Editor/CustomEditors/Elements/Container/GroupElement.cs | 1 + .../Elements/Container/HorizontalPanelElement.cs | 6 +++++- .../Elements/Container/VerticalPanelElement.cs | 6 +++++- Source/Editor/GUI/ItemsListContextMenu.cs | 1 + Source/Editor/GUI/Timeline/Timeline.cs | 1 + Source/Editor/Surface/ContextMenu/VisjectCM.cs | 3 +++ Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs | 1 + Source/Editor/Tools/Foliage/FoliageTypesTab.cs | 1 + Source/Editor/Tools/Foliage/PaintTab.cs | 1 + Source/Editor/Utilities/Utils.cs | 1 + Source/Editor/Windows/DebugLogWindow.cs | 1 + Source/Editor/Windows/PluginsWindow.cs | 3 +++ Source/Editor/Windows/Profiler/Assets.cs | 1 + Source/Editor/Windows/Profiler/CPU.cs | 1 + Source/Editor/Windows/Profiler/GPU.cs | 1 + Source/Editor/Windows/Profiler/Memory.cs | 3 ++- Source/Editor/Windows/Profiler/MemoryGPU.cs | 1 + Source/Editor/Windows/Profiler/Network.cs | 1 + Source/Editor/Windows/Profiler/Overall.cs | 1 + Source/Editor/Windows/Profiler/Physics.cs | 1 + Source/Editor/Windows/SceneTreeWindow.RenameWindow.cs | 1 + Source/Engine/UI/GUI/Common/Dropdown.cs | 1 + Source/Engine/UI/UICanvas.cs | 3 ++- 26 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Source/Editor/CustomEditors/CustomEditorPresenter.cs b/Source/Editor/CustomEditors/CustomEditorPresenter.cs index 703c3f51b..a5d041a97 100644 --- a/Source/Editor/CustomEditors/CustomEditorPresenter.cs +++ b/Source/Editor/CustomEditors/CustomEditorPresenter.cs @@ -79,6 +79,7 @@ namespace FlaxEditor.CustomEditors _presenter = presenter; AnchorPreset = AnchorPresets.StretchAll; Offsets = Margin.Zero; + Pivot = Float2.Zero; IsScrollable = true; } diff --git a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs index ea41f91e9..d82d6ecf7 100644 --- a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs @@ -56,6 +56,7 @@ namespace FlaxEditor.CustomEditors.Dedicated var bottomLeftCell = new VerticalPanel { + Pivot = Float2.Zero, Spacing = 0, TopMargin = 0, BottomMargin = 0, diff --git a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs index 5497d085f..f76bd4d89 100644 --- a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs +++ b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs @@ -232,6 +232,7 @@ namespace FlaxEditor.CustomEditors.Editors public void Setup(CollectionEditor editor, int index, bool canReorder = true) { + Pivot = Float2.Zero; HeaderHeight = 18; _canReorder = canReorder; EnableDropDownIcon = true; @@ -884,6 +885,11 @@ namespace FlaxEditor.CustomEditors.Editors set => _pickerValidator.FileExtension = value; } + public DragAreaControl() + { + Pivot = Float2.Zero; + } + /// public override void Draw() { diff --git a/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs b/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs index 972f64ba6..2d43e34c3 100644 --- a/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs +++ b/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs @@ -18,6 +18,7 @@ namespace FlaxEditor.CustomEditors.Elements /// public readonly DropPanel Panel = new DropPanel { + Pivot = Float2.Zero, ArrowImageClosed = new SpriteBrush(Style.Current.ArrowRight), ArrowImageOpened = new SpriteBrush(Style.Current.ArrowDown), EnableDropDownIcon = true, diff --git a/Source/Editor/CustomEditors/Elements/Container/HorizontalPanelElement.cs b/Source/Editor/CustomEditors/Elements/Container/HorizontalPanelElement.cs index f78a1eac1..4f6b9436f 100644 --- a/Source/Editor/CustomEditors/Elements/Container/HorizontalPanelElement.cs +++ b/Source/Editor/CustomEditors/Elements/Container/HorizontalPanelElement.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. +using FlaxEngine; using FlaxEngine.GUI; namespace FlaxEditor.CustomEditors.Elements @@ -13,7 +14,10 @@ namespace FlaxEditor.CustomEditors.Elements /// /// The panel. /// - public readonly HorizontalPanel Panel = new HorizontalPanel(); + public readonly HorizontalPanel Panel = new HorizontalPanel + { + Pivot = Float2.Zero, + }; /// public override ContainerControl ContainerControl => Panel; diff --git a/Source/Editor/CustomEditors/Elements/Container/VerticalPanelElement.cs b/Source/Editor/CustomEditors/Elements/Container/VerticalPanelElement.cs index d1b0039cf..3d15d1526 100644 --- a/Source/Editor/CustomEditors/Elements/Container/VerticalPanelElement.cs +++ b/Source/Editor/CustomEditors/Elements/Container/VerticalPanelElement.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. +using FlaxEngine; using FlaxEngine.GUI; namespace FlaxEditor.CustomEditors.Elements @@ -13,7 +14,10 @@ namespace FlaxEditor.CustomEditors.Elements /// /// The panel. /// - public readonly VerticalPanel Panel = new VerticalPanel(); + public readonly VerticalPanel Panel = new VerticalPanel + { + Pivot = Float2.Zero, + }; /// public override ContainerControl ContainerControl => Panel; diff --git a/Source/Editor/GUI/ItemsListContextMenu.cs b/Source/Editor/GUI/ItemsListContextMenu.cs index 23f493c65..696e57a36 100644 --- a/Source/Editor/GUI/ItemsListContextMenu.cs +++ b/Source/Editor/GUI/ItemsListContextMenu.cs @@ -276,6 +276,7 @@ namespace FlaxEditor.GUI Parent = _scrollPanel, AnchorPreset = AnchorPresets.HorizontalStretchTop, IsScrollable = true, + Pivot = Float2.Zero, }; } diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs index 8dabba251..1575a82d5 100644 --- a/Source/Editor/GUI/Timeline/Timeline.cs +++ b/Source/Editor/GUI/Timeline/Timeline.cs @@ -833,6 +833,7 @@ namespace FlaxEditor.GUI.Timeline { AutoFocus = false, AnchorPreset = AnchorPresets.HorizontalStretchTop, + Pivot = Float2.Zero, Offsets = Margin.Zero, IsScrollable = true, BottomMargin = 40.0f, diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index f31f1245a..b81145ae3 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -235,6 +235,7 @@ namespace FlaxEditor.Surface.ContextMenu { Parent = panel1, AnchorPreset = AnchorPresets.HorizontalStretchTop, + Pivot = Float2.Zero, IsScrollable = true, }; _groupsPanel = panel2; @@ -292,6 +293,7 @@ namespace FlaxEditor.Surface.ContextMenu X = 8, Width = Width * 0.5f - 16, AutoSize = true, + Pivot = Float2.Zero, }; _descriptionOutputPanel = new VerticalPanel() @@ -300,6 +302,7 @@ namespace FlaxEditor.Surface.ContextMenu X = Width * 0.5f + 8, Width = Width * 0.5f - 16, AutoSize = true, + Pivot = Float2.Zero, }; } diff --git a/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs b/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs index d794d1642..08dd8e6fd 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs @@ -43,6 +43,7 @@ namespace FlaxEditor.Surface.ContextMenu /// The group archetype. public VisjectCMGroup(VisjectCM cm, GroupArchetype archetype) { + Pivot = Float2.Zero; ContextMenu = cm; Archetypes.Add(archetype); Name = archetype.Name; diff --git a/Source/Editor/Tools/Foliage/FoliageTypesTab.cs b/Source/Editor/Tools/Foliage/FoliageTypesTab.cs index f7a9d1ed3..93dc05de8 100644 --- a/Source/Editor/Tools/Foliage/FoliageTypesTab.cs +++ b/Source/Editor/Tools/Foliage/FoliageTypesTab.cs @@ -352,6 +352,7 @@ namespace FlaxEditor.Tools.Foliage { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = new Margin(4, 4, 4, 0), + Pivot = Float2.Zero, IsScrollable = true, Parent = splitPanel.Panel1 }; diff --git a/Source/Editor/Tools/Foliage/PaintTab.cs b/Source/Editor/Tools/Foliage/PaintTab.cs index d1ff4cd81..29af974e8 100644 --- a/Source/Editor/Tools/Foliage/PaintTab.cs +++ b/Source/Editor/Tools/Foliage/PaintTab.cs @@ -204,6 +204,7 @@ namespace FlaxEditor.Tools.Foliage { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = new Margin(4, 4, 4, 0), + Pivot = Float2.Zero, IsScrollable = true, Parent = splitPanel.Panel1 }; diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 22aa2015e..66cdc1c44 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -1211,6 +1211,7 @@ namespace FlaxEditor.Utilities { Parent = panel1, AnchorPreset = AnchorPresets.HorizontalStretchTop, + Pivot = Float2.Zero, IsScrollable = true, }; tree = new Tree(false) diff --git a/Source/Editor/Windows/DebugLogWindow.cs b/Source/Editor/Windows/DebugLogWindow.cs index 6eddcb81c..eaf5b792f 100644 --- a/Source/Editor/Windows/DebugLogWindow.cs +++ b/Source/Editor/Windows/DebugLogWindow.cs @@ -390,6 +390,7 @@ namespace FlaxEditor.Windows _entriesPanel = new VerticalPanel { AnchorPreset = AnchorPresets.HorizontalStretchTop, + Pivot = Float2.Zero, Offsets = Margin.Zero, IsScrollable = true, Parent = _split.Panel1, diff --git a/Source/Editor/Windows/PluginsWindow.cs b/Source/Editor/Windows/PluginsWindow.cs index 25dfb773c..282c1dfe9 100644 --- a/Source/Editor/Windows/PluginsWindow.cs +++ b/Source/Editor/Windows/PluginsWindow.cs @@ -162,11 +162,13 @@ namespace FlaxEditor.Windows { AnchorPreset = AnchorPresets.StretchAll, Offsets = Margin.Zero, + Pivot = Float2.Zero, Parent = this, }; var panel = new VerticalPanel { AnchorPreset = AnchorPresets.HorizontalStretchTop, + Pivot = Float2.Zero, Offsets = Margin.Zero, IsScrollable = true, Parent = scroll, @@ -187,6 +189,7 @@ namespace FlaxEditor.Windows var vp = new Panel { AnchorPreset = AnchorPresets.StretchAll, + Offsets = Margin.Zero, Parent = this, }; _addPluginProjectButton = new Button diff --git a/Source/Editor/Windows/Profiler/Assets.cs b/Source/Editor/Windows/Profiler/Assets.cs index 159392138..3fbb7269a 100644 --- a/Source/Editor/Windows/Profiler/Assets.cs +++ b/Source/Editor/Windows/Profiler/Assets.cs @@ -67,6 +67,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/CPU.cs b/Source/Editor/Windows/Profiler/CPU.cs index ca3c9963f..c2be480f4 100644 --- a/Source/Editor/Windows/Profiler/CPU.cs +++ b/Source/Editor/Windows/Profiler/CPU.cs @@ -87,6 +87,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/GPU.cs b/Source/Editor/Windows/Profiler/GPU.cs index 7b837768f..27b5ede59 100644 --- a/Source/Editor/Windows/Profiler/GPU.cs +++ b/Source/Editor/Windows/Profiler/GPU.cs @@ -64,6 +64,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/Memory.cs b/Source/Editor/Windows/Profiler/Memory.cs index 8ab279fb8..41e98600d 100644 --- a/Source/Editor/Windows/Profiler/Memory.cs +++ b/Source/Editor/Windows/Profiler/Memory.cs @@ -1,6 +1,6 @@ // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. -using System; +using FlaxEngine; using FlaxEngine.GUI; namespace FlaxEditor.Windows.Profiler @@ -28,6 +28,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/MemoryGPU.cs b/Source/Editor/Windows/Profiler/MemoryGPU.cs index dd3c6d6ea..54e029127 100644 --- a/Source/Editor/Windows/Profiler/MemoryGPU.cs +++ b/Source/Editor/Windows/Profiler/MemoryGPU.cs @@ -68,6 +68,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/Network.cs b/Source/Editor/Windows/Profiler/Network.cs index 2c064351a..3fbc19068 100644 --- a/Source/Editor/Windows/Profiler/Network.cs +++ b/Source/Editor/Windows/Profiler/Network.cs @@ -61,6 +61,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/Overall.cs b/Source/Editor/Windows/Profiler/Overall.cs index e2db8f584..141396a10 100644 --- a/Source/Editor/Windows/Profiler/Overall.cs +++ b/Source/Editor/Windows/Profiler/Overall.cs @@ -32,6 +32,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/Profiler/Physics.cs b/Source/Editor/Windows/Profiler/Physics.cs index ec80a6633..579877dbc 100644 --- a/Source/Editor/Windows/Profiler/Physics.cs +++ b/Source/Editor/Windows/Profiler/Physics.cs @@ -32,6 +32,7 @@ namespace FlaxEditor.Windows.Profiler { AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = Margin.Zero, + Pivot = Float2.Zero, IsScrollable = true, Parent = panel, }; diff --git a/Source/Editor/Windows/SceneTreeWindow.RenameWindow.cs b/Source/Editor/Windows/SceneTreeWindow.RenameWindow.cs index 6278a5f3b..fff8bcb04 100644 --- a/Source/Editor/Windows/SceneTreeWindow.RenameWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.RenameWindow.cs @@ -92,6 +92,7 @@ namespace FlaxEditor.Windows Parent = this, AnchorPreset = AnchorPresets.StretchAll, Offset = Vector2.Zero, + Pivot = Float2.Zero, AutoSize = false, Bounds = Rectangle.Empty }; diff --git a/Source/Engine/UI/GUI/Common/Dropdown.cs b/Source/Engine/UI/GUI/Common/Dropdown.cs index e23bca199..537463e97 100644 --- a/Source/Engine/UI/GUI/Common/Dropdown.cs +++ b/Source/Engine/UI/GUI/Common/Dropdown.cs @@ -473,6 +473,7 @@ namespace FlaxEngine.GUI { AnchorPreset = AnchorPresets.StretchAll, BackgroundColor = Color.Transparent, + Pivot = Float2.Zero, IsScrollable = true, AutoSize = true, Parent = popup.MainPanel, diff --git a/Source/Engine/UI/UICanvas.cs b/Source/Engine/UI/UICanvas.cs index c92b618a9..96443dd74 100644 --- a/Source/Engine/UI/UICanvas.cs +++ b/Source/Engine/UI/UICanvas.cs @@ -314,7 +314,8 @@ namespace FlaxEngine { _guiRoot = new CanvasRootControl(this) { - IsLayoutLocked = false + IsLayoutLocked = false, + Pivot = Float2.Zero, }; }