Simplify ExternalDragOver, pass dependency as param
This commit is contained in:
parent
dc89beeac9
commit
477b422703
4 changed files with 15 additions and 10 deletions
|
|
@ -79,8 +79,6 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ActiveContainer = this.RootLibaryContainer;
|
||||
}
|
||||
|
||||
public ListView ActiveViewWidget { get; internal set; }
|
||||
|
||||
public ILibraryContainer RootLibaryContainer { get; }
|
||||
|
||||
public Dictionary<string, IContentProvider> ContentProviders = new Dictionary<string, IContentProvider>();
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
hitDragThreshold = true;
|
||||
|
||||
// Performs move and possible Scene add in View3DWidget
|
||||
view3DWidget.ExternalDragOver(screenSpaceMousePosition: this.TransformToScreenSpace(mouseEvent.Position));
|
||||
view3DWidget.ExternalDragOver(screenSpaceMousePosition: this.TransformToScreenSpace(mouseEvent.Position), sourceWidget: this.listViewItem.ListView);
|
||||
}
|
||||
|
||||
base.OnMouseMove(mouseEvent);
|
||||
|
|
|
|||
|
|
@ -85,8 +85,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
Border = new BorderDouble(top: 1)
|
||||
};
|
||||
|
||||
ApplicationController.Instance.Library.ActiveViewWidget = libraryView;
|
||||
|
||||
libraryView.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
|
||||
|
||||
ApplicationController.Instance.Library.ContainerChanged += Library_ContainerChanged;
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
/// Provides a View3DWidget specific drag implementation
|
||||
/// </summary>
|
||||
/// <param name="screenSpaceMousePosition">The screen space mouse position.</param>
|
||||
public void ExternalDragOver(Vector2 screenSpaceMousePosition)
|
||||
public void ExternalDragOver(Vector2 screenSpaceMousePosition, GuiWidget sourceWidget)
|
||||
{
|
||||
if (this.HasBeenClosed)
|
||||
{
|
||||
|
|
@ -502,11 +502,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.Printer.ViewState.ViewMode = PartViewMode.Model;
|
||||
}
|
||||
|
||||
// Otherwise begin an externally started DragDropOperation hard-coded to use LibraryView->SelectedItems
|
||||
this.StartDragDrop(
|
||||
IEnumerable<ILibraryItem> selectedItems;
|
||||
|
||||
if (sourceWidget is ListView listView)
|
||||
{
|
||||
// Project from ListViewItem to ILibraryItem
|
||||
ApplicationController.Instance.Library.ActiveViewWidget.SelectedItems.Select(l => l.Model),
|
||||
screenSpaceMousePosition);
|
||||
selectedItems = listView.SelectedItems.Select(l => l.Model);
|
||||
}
|
||||
else// Project from ListViewItem to ILibraryItem
|
||||
{
|
||||
selectedItems = Enumerable.Empty<ILibraryItem>();
|
||||
}
|
||||
|
||||
// Otherwise begin an externally started DragDropOperation hard-coded to use LibraryView->SelectedItems
|
||||
this.StartDragDrop(selectedItems, screenSpaceMousePosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue