Skip to content

Commit 8eddfc0

Browse files
committed
fixed dropdown dest rect and auto-placing sibling items
1 parent 5a3e34e commit 8eddfc0

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

GeonBit.UI/GeonBit.UI/Entities/Dropdown.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ override protected void DoOnValueChange()
225225
base.DoOnValueChange();
226226
}
227227

228+
/// <summary>
229+
/// Return the actual dest rect for auto-anchoring purposes.
230+
/// This is useful for things like DropDown, that when opened they take a larger part of the screen, but we don't
231+
/// want it to push down other entities.
232+
/// </summary>
233+
override protected Rectangle GetDestRectForAutoAnchors()
234+
{
235+
_selectedTextPanel.UpdateDestinationRectsIfDirty();
236+
return _selectedTextPanel.GetActualDestRect();
237+
}
238+
228239
/// <summary>
229240
/// Get actual destination rect for positioning, which is the size of the DropDown entity when list is closed.
230241
/// </summary>

GeonBit.UI/GeonBit.UI/Entities/Entity.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ virtual public Rectangle CalcDestRect()
13301330
}
13311331

13321332
// align y
1333-
ret.Y = prevEntity.GetActualDestRect().Bottom + (int)(offset.Y +
1333+
ret.Y = prevEntity.GetDestRectForAutoAnchors().Bottom + (int)(offset.Y +
13341334
prevEntity._scaledSpaceAfter.Y +
13351335
_scaledSpaceBefore.Y);
13361336
}
@@ -1376,6 +1376,16 @@ virtual public Rectangle GetActualDestRect()
13761376
return _destRect;
13771377
}
13781378

1379+
/// <summary>
1380+
/// Return the actual dest rect for auto-anchoring purposes.
1381+
/// This is useful for things like DropDown, that when opened they take a larger part of the screen, but we don't
1382+
/// want it to push down other entities.
1383+
/// </summary>
1384+
virtual protected Rectangle GetDestRectForAutoAnchors()
1385+
{
1386+
return GetActualDestRect();
1387+
}
1388+
13791389
/// <summary>
13801390
/// Remove this entity from its parent.
13811391
/// </summary>

0 commit comments

Comments
 (0)