internal static void TranslateSelection(PathEditorTarget pathEditorTarget, ICollection <PathPart> pathParts, Vector offset) { List <BitArray> list = new List <BitArray>(pathEditorTarget.PathGeometry.Figures.Count); for (int index = 0; index < pathEditorTarget.PathGeometry.Figures.Count; ++index) { list.Add(new BitArray(PathFigureUtilities.PointCount(pathEditorTarget.PathGeometry.Figures[index]), false)); } foreach (PathPart pathPart in (IEnumerable <PathPart>)pathParts) { PathPoint pathPoint = pathPart as PathPoint; if ((PathPart)pathPoint != (PathPart)null) { if (pathPoint.PartIndex < list[pathPoint.FigureIndex].Count) { list[pathPoint.FigureIndex][pathPoint.PartIndex] = true; } } else { PathSegment pathSegment = pathPart as PathSegment; if ((PathPart)pathSegment != (PathPart)null) { list[pathSegment.FigureIndex][pathSegment.PartIndex] = true; PathFigure pathFigure = pathEditorTarget.PathGeometry.Figures[pathPart.FigureIndex]; if (pathFigure.IsClosed && pathPart.PartIndex == 0) { int num1 = PathFigureUtilities.PointCount(pathFigure); int num2 = 1; if (PathFigureUtilities.IsCloseSegmentDegenerate(pathFigure)) { num2 = PathSegmentUtilities.GetPointCount(pathFigure.Segments[pathFigure.Segments.Count - 1]); } list[pathSegment.FigureIndex][num1 - num2] = true; } else { int segmentIndex; int segmentPointIndex; PathFigureUtilities.GetSegmentFromPointIndex(pathFigure, pathPart.PartIndex, out segmentIndex, out segmentPointIndex); int pointCount = PathSegmentUtilities.GetPointCount(pathFigure.Segments[segmentIndex]); int index = pathSegment.PartIndex - pointCount; if (index >= 0) { list[pathSegment.FigureIndex][index] = true; } } } } } for (int figureIndex = 0; figureIndex < pathEditorTarget.PathGeometry.Figures.Count; ++figureIndex) { BitArray bitArray = list[figureIndex]; PathFigureEditor pathFigureEditor = new PathFigureEditor(pathEditorTarget.PathGeometry.Figures[figureIndex], pathEditorTarget.PathDiffChangeList, figureIndex); int num = PathFigureUtilities.PointCount(pathFigureEditor.PathFigure); for (int index = 0; index < num; ++index) { if (bitArray[index]) { pathFigureEditor.MovePoint(index, offset + pathFigureEditor.GetPoint(index)); } } } }
private void MoveSelection() { Matrix matrixToAdornerLayer = this.pathPartAdorner.PathAdornerSet.GetTransformMatrixToAdornerLayer(); Point pointInAdornerLayer = this.GetSnappedPointInAdornerLayer(); PathTangentAdorner pathTangentAdorner = this.pathPartAdorner as PathTangentAdorner; PathEditContext pathEditContext = new PathEditContext(this.pathPartAdorner.FigureIndex, this.pathPartAdorner.PartIndex); if (pathTangentAdorner != null) { this.EnsureEditTransaction(); this.pathEditorTarget.BeginEditing(); if (!this.HasMouseMovedAfterDown) { this.startRootPoint = PathFigureUtilities.GetPoint(this.pathEditorTarget.PathGeometry.Figures[pathEditContext.FigureIndex], pathEditContext.PartIndex, false); this.correspondingPoint = PathFigureUtilities.GetPoint(this.pathEditorTarget.PathGeometry.Figures[pathEditContext.FigureIndex], pathEditContext.PartIndex, true); } Point point = this.IsShiftDown ? this.correspondingPoint : this.startRootPoint; Vector correspondingVector = ElementUtilities.GetCorrespondingVector(pointInAdornerLayer - point * matrixToAdornerLayer, matrixToAdornerLayer, this.IsShiftDown ? this.axisConstraint : (AxisConstraint)null); new PathFigureEditor(pathEditContext.GetPathFigure(this.pathEditorTarget.PathGeometry)).MoveTangent(pathEditContext.PartIndex, point + correspondingVector, this.isEnforcingSmoothness); this.ActiveView.AdornerLayer.InvalidateAdornerVisuals(this.EditingElement); } else { this.EnsureEditTransaction(); PathPointAdorner pathPointAdorner = this.pathPartAdorner as PathPointAdorner; PathSegmentAdorner pathSegmentAdorner = this.pathPartAdorner as PathSegmentAdorner; this.pathPartAdorner.PathAdornerSet.PathEditorTarget.BeginEditing(); if (!this.HasMouseMovedAfterDown) { Point point; if (pathPointAdorner != null) { point = PathFigureUtilities.GetPoint(pathEditContext.GetPathFigure(this.pathEditorTarget.PathGeometry), pathEditContext.PartIndex); } else { PathFigureEditor pathFigureEditor = new PathFigureEditor(pathEditContext.GetPathFigure(this.pathEditorTarget.PathGeometry)); int segmentIndex; int segmentPointIndex; PathFigureUtilities.GetSegmentFromPointIndex(pathEditContext.GetPathFigure(this.pathEditorTarget.PathGeometry), pathEditContext.PartIndex, out segmentIndex, out segmentPointIndex); point = pathFigureEditor.Evaluate(segmentIndex, segmentPointIndex, this.pathSegmentParameter) * pathSegmentAdorner.PathGeometryTransformMatrix; } this.startRootPoint = point; this.previousRootPoint = this.startRootPoint; } Vector correspondingVector = ElementUtilities.GetCorrespondingVector(pointInAdornerLayer - this.startRootPoint * matrixToAdornerLayer, matrixToAdornerLayer, this.IsShiftDown ? this.axisConstraint : (AxisConstraint)null); double zoom = this.ActiveView.Artboard.Zoom; Vector rootToArtboardScale = this.ActiveView.Artboard.ViewRootToArtboardScale; correspondingVector.X /= zoom * rootToArtboardScale.X; correspondingVector.Y /= zoom * rootToArtboardScale.Y; Vector vector = this.startRootPoint - this.previousRootPoint + correspondingVector; this.previousRootPoint = this.startRootPoint + correspondingVector; Vector deltaOffset = matrixToAdornerLayer.Transform(vector); PathPartSelectionSet partSelectionSet = this.ActiveSceneViewModel.PathPartSelectionSet; if (partSelectionSet == null) { return; } foreach (BaseFrameworkElement sceneElement in (IEnumerable <SceneElement>)partSelectionSet.SelectedPaths) { this.MovePathParts(partSelectionSet, sceneElement, PathEditMode.ScenePath, deltaOffset); this.MovePathParts(partSelectionSet, sceneElement, PathEditMode.MotionPath, deltaOffset); this.MovePathParts(partSelectionSet, sceneElement, PathEditMode.ClippingPath, deltaOffset); } } }