From 7d314a589e8d910a626ac4ef1dcc30ca046e5b94 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 16 Dec 2023 21:37:49 +0100 Subject: [PATCH] improved Element ToString --- MLEM.Ui/Elements/Element.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index 3daa80d..45eb7cf 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -1236,12 +1236,13 @@ namespace MLEM.Ui.Elements { /// public override string ToString() { - var ret = this.GetType().ToString(); - // elements will contain their path up to the root (Paragraph@Panel@...@RootName) + var ret = this.GetType().Name; + // 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) { - ret += $"@{this.Parent}"; + ret += $" {this.Parent.Children.IndexOf(this)} @ {this.Parent}"; } else if (this.Root?.Element == this) { - ret += $"@{this.Root.Name}"; + ret += $" {this.Root.Name}"; } return ret; }