Switch back to ID
This commit is contained in:
parent
70008db70c
commit
46f5f70d42
2 changed files with 20 additions and 43 deletions
|
|
@ -106,7 +106,6 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
// We need to serialize this so we can remove the arrange and get back to the objects before arranging
|
||||
public List<Aabb> OriginalChildrenBounds = new List<Aabb>();
|
||||
private SelectedChildren _selectedChild = new SelectedChildren();
|
||||
|
||||
public AlignObject3D()
|
||||
{
|
||||
|
|
@ -172,34 +171,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
[ShowAsList]
|
||||
[DisplayName("Anchor")]
|
||||
public SelectedChildren SelectedChild
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Children.Count > 0)
|
||||
{
|
||||
if (_selectedChild.Count != 1)
|
||||
{
|
||||
_selectedChild.Clear();
|
||||
_selectedChild.Add(Children.First().Name);
|
||||
}
|
||||
|
||||
if (!this.Children.Any(c => c.Name == _selectedChild[0]))
|
||||
{
|
||||
// we don't have an name of any of our current children
|
||||
_selectedChild.Clear();
|
||||
_selectedChild.Add(Children.First().Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedChild.Clear();
|
||||
}
|
||||
|
||||
return _selectedChild;
|
||||
}
|
||||
set => _selectedChild = value;
|
||||
}
|
||||
public SelectedChildren SelectedChild { get; set; } = new SelectedChildren();
|
||||
|
||||
public bool Advanced { get; set; } = false;
|
||||
|
||||
|
|
@ -260,7 +232,12 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
get
|
||||
{
|
||||
return this.Children.Where(c => c.Name == SelectedChild[0]).FirstOrDefault();
|
||||
if (SelectedChild.Count > 0)
|
||||
{
|
||||
return this.Children.Where(c => c.ID == SelectedChild[0]).FirstOrDefault();
|
||||
}
|
||||
|
||||
return this.Children.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +343,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
this.Children.Modify((Action<List<IObject3D>>)((List<IObject3D> list) =>
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
if (list.Count == 0)
|
||||
{
|
||||
|
|
@ -455,7 +432,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
i++;
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Matrix));
|
||||
|
|
|
|||
|
|
@ -54,20 +54,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
// Enum keyed on name to friendly name
|
||||
List<(string key, string value)> names = null;
|
||||
var selectedName = "";
|
||||
string selectedID = "";
|
||||
if (property.Source is AlignObject3D item)
|
||||
{
|
||||
names = item.Children.Select(child => (child.Name, child.Name)).ToList();
|
||||
names = item.Children.Select(child => (child.ID, child.Name)).ToList();
|
||||
if (item.SelectedChild.Count == 1)
|
||||
{
|
||||
var selectedKey = item.SelectedChild[0];
|
||||
foreach (var (key, value) in names)
|
||||
{
|
||||
if (key == selectedKey)
|
||||
{
|
||||
selectedName = value;
|
||||
}
|
||||
}
|
||||
selectedID = item.SelectedChild[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +79,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
};
|
||||
}
|
||||
|
||||
dropDownList.SelectedLabel = selectedName;
|
||||
if (!string.IsNullOrWhiteSpace(selectedID))
|
||||
{
|
||||
dropDownList.SelectedValue = selectedID;
|
||||
}
|
||||
else if (dropDownList.MenuItems.Count > 0)
|
||||
{
|
||||
dropDownList.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
this.Content = dropDownList;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue