Plate at bed center, use InsertionGroup for load handling

This commit is contained in:
John Lewin 2017-09-29 13:49:14 -07:00
parent f5301220ea
commit 9eda55bdae
3 changed files with 43 additions and 5 deletions

View file

@ -44,9 +44,14 @@ namespace MatterHackers.MatterControl.PrintLibrary
{
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
this.Mesh = MeshContentProvider.placeHolderMesh;
Task.Run(async () =>
{
var newItemOffset = Vector2.Zero;
@ -67,6 +72,12 @@ namespace MatterHackers.MatterControl.PrintLibrary
object3D.Parent = this;
this.Children.Add(object3D);
// Dump the temporary placeholder
if (this.Mesh != null)
{
this.Mesh = null;
}
// Position at accumulating offset
object3D.Matrix *= Matrix4X4.CreateTranslation(newItemOffset.x, newItemOffset.y, 0);
@ -81,6 +92,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
}
}
ContentLoaded?.Invoke(this, null);
if (dragOperationActive())
{
// Setting the selection group ensures that on lose focus this object will be collapsed