mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +01:00
improved Element ToString
This commit is contained in:
parent
b935bd0a61
commit
7d314a589e
1 changed files with 5 additions and 4 deletions
|
@ -1236,12 +1236,13 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
var ret = this.GetType().ToString();
|
var ret = this.GetType().Name;
|
||||||
// elements will contain their path up to the root (Paragraph@Panel@...@RootName)
|
// elements will contain their path up to the root and their index in each parent
|
||||||
|
// eg Paragraph 2 @ Panel 3 @ ... @ Group RootName
|
||||||
if (this.Parent != null) {
|
if (this.Parent != null) {
|
||||||
ret += $"@{this.Parent}";
|
ret += $" {this.Parent.Children.IndexOf(this)} @ {this.Parent}";
|
||||||
} else if (this.Root?.Element == this) {
|
} else if (this.Root?.Element == this) {
|
||||||
ret += $"@{this.Root.Name}";
|
ret += $" {this.Root.Name}";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue