mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
add the ability for elements to override the position that children will be auto-anchored to
This commit is contained in:
parent
a9593ccb74
commit
15b468bab4
1 changed files with 5 additions and 1 deletions
|
@ -275,7 +275,7 @@ namespace MLEM.Ui.Elements {
|
||||||
if (this.Anchor >= Anchor.AutoLeft) {
|
if (this.Anchor >= Anchor.AutoLeft) {
|
||||||
var previousChild = this.GetPreviousChild(false);
|
var previousChild = this.GetPreviousChild(false);
|
||||||
if (previousChild != null) {
|
if (previousChild != null) {
|
||||||
var prevArea = previousChild.Area;
|
var prevArea = previousChild.GetAreaForAutoAnchors();
|
||||||
switch (this.Anchor) {
|
switch (this.Anchor) {
|
||||||
case Anchor.AutoLeft:
|
case Anchor.AutoLeft:
|
||||||
case Anchor.AutoCenter:
|
case Anchor.AutoCenter:
|
||||||
|
@ -325,6 +325,10 @@ namespace MLEM.Ui.Elements {
|
||||||
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Floor());
|
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Floor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Rectangle GetAreaForAutoAnchors() {
|
||||||
|
return this.Area;
|
||||||
|
}
|
||||||
|
|
||||||
protected Element GetPreviousChild(bool hiddenAlso) {
|
protected Element GetPreviousChild(bool hiddenAlso) {
|
||||||
if (this.Parent == null)
|
if (this.Parent == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue