Making support be an object 3D wrapper
Making the selection always be a group
This commit is contained in:
parent
c5029b880e
commit
d3768a268f
13 changed files with 140 additions and 118 deletions
|
|
@ -42,11 +42,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
public class InsertionGroup : Object3D
|
||||
{
|
||||
private View3DWidget view3DWidget;
|
||||
|
||||
public event EventHandler ContentLoaded;
|
||||
|
||||
// TODO: Figure out how best to collapse the InsertionGroup after the load task completes
|
||||
public InsertionGroup(IEnumerable<ILibraryItem> items, View3DWidget view3DWidget, InteractiveScene scene, Func<bool> dragOperationActive)
|
||||
{
|
||||
// Add a temporary placeholder to give us some bounds
|
||||
|
|
@ -96,33 +93,13 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
|
||||
ContentLoaded?.Invoke(this, null);
|
||||
|
||||
if (dragOperationActive())
|
||||
{
|
||||
// Setting the selection group ensures that on lose focus this object will be collapsed
|
||||
this.ItemType = Object3DTypes.SelectionGroup;
|
||||
}
|
||||
else
|
||||
if (!dragOperationActive())
|
||||
{
|
||||
// Drag operation has finished, we need to perform the collapse
|
||||
var loadedItems = this.Children;
|
||||
|
||||
// Collapse our contents into the root of the scene
|
||||
// of the scene when it loses focus
|
||||
scene.Children.Modify(list =>
|
||||
scene.SelectedItem.Children.Modify(list =>
|
||||
{
|
||||
this.CollapseInto(list, Object3DTypes.Any);
|
||||
this.CollapseInto(list, Object3DTypes.Default);
|
||||
});
|
||||
|
||||
if (scene.SelectedItem == this
|
||||
&& loadedItems.Count > 0)
|
||||
{
|
||||
scene.ClearSelection();
|
||||
|
||||
foreach (var item in loadedItems)
|
||||
{
|
||||
scene.AddToSelection(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view3DWidget.PartHasBeenChanged();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue