Expose 'Copy Path' while editing components

This commit is contained in:
John Lewin 2018-08-02 15:16:43 -07:00
parent fd2c880704
commit 7957eed0db

View file

@ -174,6 +174,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
}
if (selectedItem.Ancestors().OfType<ComponentObject3D>().FirstOrDefault() is ComponentObject3D componentAncestor
&& !componentAncestor.Finalized)
{
var button = popupMenu.CreateMenuItem("Copy Path".Localize());
button.Click += (s, e) =>
{
var selector = "$." + string.Join(".", selectedItem.AncestorsAndSelf().TakeWhile(o => !(o is ComponentObject3D)).Select(o => $"Children<{o.GetType().Name.ToString()}>").Reverse().ToArray());
Clipboard.Instance.SetText(selector);
};
}
}
return popupMenu;