Exemplo n.º 1
0
        private static ISceneInsertionPoint ComputeNewInsertionPoint(SceneViewModel viewModel, ISceneInsertionPoint insertionPoint, PastePackage pastePackage)
        {
            if (pastePackage.Elements.Count == 0 || viewModel.ElementSelectionSet.Count == 0 || !viewModel.ElementSelectionSet.PrimarySelection.IsAncestorOf((SceneNode)insertionPoint.SceneElement))
            {
                return(insertionPoint);
            }
            string copyElementToken = pastePackage.ClipboardCopyElementToken;

            if (!string.IsNullOrEmpty(copyElementToken) && copyElementToken.Equals(PastePackage.GlobalCopyElementToken))
            {
                SceneElement parentElement = viewModel.ElementSelectionSet.PrimarySelection.ParentElement;
                if (parentElement != null && parentElement.IsViewObjectValid && (viewModel.ActiveEditingContainer.IsAncestorOf((SceneNode)parentElement) && !ElementUtilities.HasVisualTreeAncestorOfType(parentElement.ViewObject.PlatformSpecificObject as DependencyObject, typeof(Viewport2DVisual3D))))
                {
                    insertionPoint = parentElement.DefaultInsertionPoint;
                }
            }
            return(insertionPoint);
        }