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);
}
}));
});