diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index 55a6ea24b8..5f41a90f0a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly WorldRenderer worldRenderer; readonly EditorActorLayer editorActorLayer; readonly EditorViewportControllerWidget editor; - readonly ContainerWidget actorSelectBorder; readonly BackgroundWidget actorEditPanel; readonly LabelWidget typeLabel; readonly TextFieldWidget actorIDField; @@ -41,6 +40,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly int editPanelPadding; // Padding between right edge of actor and the edit panel. readonly long scrollVisibleTimeout = 100; // Delay after scrolling map before edit widget becomes visible again. long lastScrollTime = 0; + int2 lastScrollPosition = int2.Zero; ActorIDStatus actorIDStatus = ActorIDStatus.Normal; ActorIDStatus nextActorIDStatus = ActorIDStatus.Normal; @@ -74,7 +74,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.worldRenderer = worldRenderer; editorActorLayer = world.WorldActor.Trait(); editor = widget.Parent.Get("MAP_EDITOR"); - actorSelectBorder = editor.Get("ACTOR_SELECT_BORDER"); actorEditPanel = editor.Get("ACTOR_EDIT_PANEL"); typeLabel = actorEditPanel.Get("ACTOR_TYPE_LABEL"); @@ -101,10 +100,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic closeButton.OnClick = Close; deleteButton.OnClick = Delete; - actorSelectBorder.IsVisible = () => CurrentActor != null + actorEditPanel.IsVisible = () => CurrentActor != null && editor.CurrentBrush == editor.DefaultBrush && Game.RunTime > lastScrollTime + scrollVisibleTimeout; - actorEditPanel.IsVisible = actorSelectBorder.IsVisible; actorIDField.OnEscKey = () => { @@ -172,11 +170,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic var actor = editor.DefaultBrush.SelectedActor; if (actor != null) { - var origin = worldRenderer.Viewport.WorldToViewPx(new int2(actor.Bounds.X, actor.Bounds.Y)); + var origin = worldRenderer.Viewport.WorldToViewPx(new int2(actor.Bounds.Right, actor.Bounds.Top)); // If we scrolled, hide the edit box for a moment - if (actorSelectBorder.Bounds.X != origin.X || actorSelectBorder.Bounds.Y != origin.Y) + if (lastScrollPosition.X != origin.X || lastScrollPosition.Y != origin.Y) + { lastScrollTime = Game.RunTime; + lastScrollPosition = origin; + } // If we changed actor, move widgets if (CurrentActor != actor) @@ -191,8 +192,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic typeLabel.Text = truncatedType; actorIDField.CursorPosition = actor.ID.Length; - actorSelectBorder.Bounds.Width = actor.Bounds.Width * 2; - actorSelectBorder.Bounds.Height = actor.Bounds.Height * 2; nextActorIDStatus = ActorIDStatus.Normal; // Remove old widgets @@ -286,11 +285,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic buttonContainer.Bounds.Y += initContainer.Bounds.Height - oldInitHeight; } - actorSelectBorder.Bounds.X = origin.X; - actorSelectBorder.Bounds.Y = origin.Y; - // Set the edit panel to the right of the selection border. - actorEditPanel.Bounds.X = origin.X + actorSelectBorder.Bounds.Width / 2 + editPanelPadding; + actorEditPanel.Bounds.X = origin.X + editPanelPadding; actorEditPanel.Bounds.Y = origin.Y; } else @@ -313,7 +309,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic { actorIDField.YieldKeyboardFocus(); editor.DefaultBrush.SelectedActor = null; - actorSelectBorder.Visible = false; CurrentActor = null; } } diff --git a/mods/cnc/chrome/editor.yaml b/mods/cnc/chrome/editor.yaml index c4a1127725..3b3eb9fdfb 100644 --- a/mods/cnc/chrome/editor.yaml +++ b/mods/cnc/chrome/editor.yaml @@ -224,11 +224,6 @@ Container@EDITOR_WORLD_ROOT: Visible: false ActorPreview@DRAG_ACTOR_PREVIEW: Visible: false - Container@ACTOR_SELECT_BORDER: - X: 32 - Y: 32 - Width: 32 - Height: 32 Background@ACTOR_EDIT_PANEL: Background: panel-black Width: 269 diff --git a/mods/common/chrome/editor.yaml b/mods/common/chrome/editor.yaml index 7a35490218..136e1f83fe 100644 --- a/mods/common/chrome/editor.yaml +++ b/mods/common/chrome/editor.yaml @@ -215,11 +215,6 @@ Container@EDITOR_WORLD_ROOT: Visible: false Sprite@DRAG_LAYER_PREVIEW: Visible: false - Container@ACTOR_SELECT_BORDER: - X: 32 - Y: 32 - Width: 32 - Height: 32 Background@ACTOR_EDIT_PANEL: X: 32 Y: 32