Switch to Model view when dragging items from the file system

- Issue MatterHackers/MCCentral#4781
DragDrop STL from desktop to printing GCode view fails to switch to
model view
This commit is contained in:
John Lewin 2019-01-10 15:21:33 -08:00
parent e75936fe1f
commit 60aaa5abea
4 changed files with 12 additions and 16 deletions

View file

@ -193,6 +193,11 @@ namespace MatterHackers.MatterControl
}
public InsertionGroupObject3D AddToPlate(IEnumerable<ILibraryItem> itemsToAdd)
{
return this.AddToPlate(itemsToAdd, (this.Printer != null) ? this.Printer.Bed.BedCenter : Vector2.Zero, true);
}
public InsertionGroupObject3D AddToPlate(IEnumerable<ILibraryItem> itemsToAdd, Vector2 initialPosition, bool moveToOpenPosition)
{
if (this.Printer != null
&& this.Printer.ViewState.ViewMode != PartViewMode.Model)
@ -211,10 +216,13 @@ namespace MatterHackers.MatterControl
itemsToAdd,
context.View3DWidget,
scene,
(Printer != null) ? Printer.Bed.BedCenter : Vector2.Zero,
initialPosition,
(item, itemsToAvoid) =>
{
PlatingHelper.MoveToOpenPositionRelativeGroup(item, itemsToAvoid);
if (moveToOpenPosition)
{
PlatingHelper.MoveToOpenPositionRelativeGroup(item, itemsToAvoid);
}
}));
});

View file

@ -92,7 +92,6 @@ namespace MatterHackers.MatterControl.DesignTools
var graphics2D = _image.NewGraphics2D();
graphics2D.Clear(Color.White);
graphics2D.DrawString("Bad Load", 100, 100);
}
// we don't want to invalidate on the mesh change

View file

@ -142,7 +142,6 @@ namespace MatterHackers.MatterControl.DesignTools
}
});
if (aabb.ZSize > 0)
{
// If the part was already created and at a height, maintain the height.

View file

@ -999,13 +999,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// Set the hitplane to the bed plane
CurrentSelectInfo.HitPlane = bedPlane;
var insertionGroup = new InsertionGroupObject3D(
items,
this,
Scene,
Vector2.Zero,
null,
trackSourceFiles);
// Add item to scene
var insertionGroup = sceneContext.AddToPlate(items, Vector2.Zero, moveToOpenPosition: false);
// Find intersection position of the mouse with the bed plane
var intersectInfo = GetIntersectPosition(screenSpaceMousePosition);
@ -1020,11 +1015,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.deferEditorTillMouseUp = true;
// Add item to scene and select it
Scene.Children.Modify(list =>
{
list.Add(insertionGroup);
});
Scene.SelectedItem = insertionGroup;
this.DragDropObject = insertionGroup;