diff --git a/Intersect.Client/Interface/Game/DescriptionWindows/Components/ComponentBase.cs b/Intersect.Client/Interface/Game/DescriptionWindows/Components/ComponentBase.cs index d454a0263..5beb2e8d3 100644 --- a/Intersect.Client/Interface/Game/DescriptionWindows/Components/ComponentBase.cs +++ b/Intersect.Client/Interface/Game/DescriptionWindows/Components/ComponentBase.cs @@ -72,7 +72,8 @@ protected virtual void GenerateComponents() /// /// The X position to move the control to. /// The Y position to move the control to. - public virtual void SetPosition(int x, int y) => mContainer.SetPosition(x, y); + /// The container for the item description. + public virtual void SetPosition(int x, int y, ImagePanel? itemDecriptionContainer = null) => mContainer.SetPosition(x, y); /// /// Sets the control position based on ImagePanel. diff --git a/Intersect.Client/Interface/Game/DescriptionWindows/DescriptionWindowBase.cs b/Intersect.Client/Interface/Game/DescriptionWindows/DescriptionWindowBase.cs index 0a1122bca..f3684029a 100644 --- a/Intersect.Client/Interface/Game/DescriptionWindows/DescriptionWindowBase.cs +++ b/Intersect.Client/Interface/Game/DescriptionWindows/DescriptionWindowBase.cs @@ -129,7 +129,7 @@ protected void FinalizeWindow() } /// - public override void SetPosition(int x, int y) + public override void SetPosition(int x, int y, ImagePanel? itemDecriptionContainer = null) { if (mContainer == null || mContainer.Canvas == null) { @@ -143,7 +143,7 @@ public override void SetPosition(int x, int y) HoveredControlX = InputHandler.HoveredControl.LocalPosToCanvas(new Point(0, 0)).X; HoveredControlY = InputHandler.HoveredControl.LocalPosToCanvas(new Point(0, 0)).Y; newX = HoveredControlX + InputHandler.HoveredControl.Width; - newY = HoveredControlY + InputHandler.HoveredControl.Height; + newY = itemDecriptionContainer != null ? itemDecriptionContainer.Bottom : HoveredControlY + InputHandler.HoveredControl.Height; // Do not allow it to render outside of the screen canvas. if (newX > mContainer.Canvas.Width - mContainer.Width) @@ -153,7 +153,7 @@ public override void SetPosition(int x, int y) if (newY > mContainer.Canvas.Height - mContainer.Height) { - newY = HoveredControlY - mContainer.Height; + newY = itemDecriptionContainer != null ? itemDecriptionContainer.Y - mContainer.Height : HoveredControlY - mContainer.Height; } mContainer.MoveTo(newX, newY); diff --git a/Intersect.Client/Interface/Game/DescriptionWindows/ItemDescriptionWindow.cs b/Intersect.Client/Interface/Game/DescriptionWindows/ItemDescriptionWindow.cs index 23f27c2a2..e13711ffe 100644 --- a/Intersect.Client/Interface/Game/DescriptionWindows/ItemDescriptionWindow.cs +++ b/Intersect.Client/Interface/Game/DescriptionWindows/ItemDescriptionWindow.cs @@ -20,7 +20,7 @@ public partial class ItemDescriptionWindow : DescriptionWindowBase protected string mValueLabel; - protected SpellDescriptionWindow mSpellDescWindow; + protected SpellDescriptionWindow? mSpellDescWindow; public ItemDescriptionWindow( ItemBase item, @@ -45,7 +45,7 @@ public ItemDescriptionWindow( // If a spell, also display the spell description! if (mItem.ItemType == ItemType.Spell) { - mSpellDescWindow = new SpellDescriptionWindow(mItem.SpellId, x, mContainer.Bottom); + mSpellDescWindow = new SpellDescriptionWindow(mItem.SpellId, x, y, mContainer); } } diff --git a/Intersect.Client/Interface/Game/DescriptionWindows/SpellDescriptionWindow.cs b/Intersect.Client/Interface/Game/DescriptionWindows/SpellDescriptionWindow.cs index 63084c054..fe14c1c6a 100644 --- a/Intersect.Client/Interface/Game/DescriptionWindows/SpellDescriptionWindow.cs +++ b/Intersect.Client/Interface/Game/DescriptionWindows/SpellDescriptionWindow.cs @@ -11,13 +11,13 @@ public partial class SpellDescriptionWindow : DescriptionWindowBase { protected SpellBase mSpell; - public SpellDescriptionWindow(Guid spellId, int x, int y) : base(Interface.GameUi.GameCanvas, "DescriptionWindow") + public SpellDescriptionWindow(Guid spellId, int x, int y, ImagePanel? itemDecriptionContainer = null) : base(Interface.GameUi.GameCanvas, "DescriptionWindow") { mSpell = SpellBase.Get(spellId); GenerateComponents(); SetupDescriptionWindow(); - SetPosition(x, y); + SetPosition(x, y, itemDecriptionContainer); } public SpellDescriptionWindow(Guid spellId, ImagePanel _statusIcon) : base(Interface.GameUi.GameCanvas, "DescriptionWindow")