Beispiel #1
0
 protected override bool OnButtonDownOverNonAdorner(Point pointerPosition)
 {
     this.IsProjectedInsertionPoint = Adorner.NonAffineTransformInParentStack(this.ActiveSceneInsertionPoint.SceneElement);
     if (!this.IsProjectedInsertionPoint)
     {
         this.pointList.Clear();
         this.pointList.Add(pointerPosition);
         this.vpFitter.Clear();
         this.vpFitter.Add(pointerPosition, 0L);
         this.vpFitter.CurveTolerance = Tolerances.CurveFittingDistanceTolerance(this.ActiveView.Zoom) * Tolerances.CurveFittingDistanceTolerance(this.ActiveView.Zoom);
     }
     return(true);
 }
Beispiel #2
0
 protected override bool OnDragEnd(Point dragStartPosition, Point dragEndPosition)
 {
     if (!this.IsProjectedInsertionPoint)
     {
         SceneView      activeView = this.ActiveView;
         SceneViewModel viewModel  = activeView.ViewModel;
         bool           flag       = false;
         if (this.pointList.Count >= 4)
         {
             Point point1 = this.pointList[0];
             Point point2 = this.pointList[this.pointList.Count - 1];
             if (Tolerances.DoPointsHit(point1, point2, activeView.Zoom))
             {
                 this.pointList[this.pointList.Count - 1] = point1;
                 flag = true;
             }
         }
         PropertyManager   propertyManager   = (PropertyManager)this.ToolBehaviorContext.PropertyManager;
         BezierCurveFitter bezierCurveFitter = new BezierCurveFitter();
         PathGeometry      pathGeometry      = !DebugVariables.Instance.EnableRealTimeFitting ? (!flag ? bezierCurveFitter.OpenFit(this.pointList, true, Tolerances.CurveFitCornerThreshold, Tolerances.CurveFittingDistanceTolerance(activeView.Zoom), true) : bezierCurveFitter.ClosedFit(this.pointList, true, Tolerances.CurveFitCornerThreshold, Tolerances.CurveFittingDistanceTolerance(activeView.Zoom), true)) : this.vpFitter.Path;
         try
         {
             this.EnsureEditTransaction();
             Matrix transformFromRoot = activeView.GetComputedTransformFromRoot(this.ActiveSceneInsertionPoint.SceneElement);
             new PathFigureEditor(pathGeometry.Figures[0]).ApplyTransform(transformFromRoot);
             viewModel.ElementSelectionSet.Clear();
             this.CreatePathElement();
             this.UpdateEditTransaction();
             if (this.EditingElement.IsViewObjectValid)
             {
                 using (ScenePathEditorTarget pathEditorTarget = new ScenePathEditorTarget((PathElement)this.EditingElement))
                 {
                     pathEditorTarget.BeginEditing();
                     pathEditorTarget.PathGeometry = pathGeometry;
                     pathEditorTarget.EndEditing(true);
                 }
             }
             this.CommitEditTransaction();
             this.Tool.RebuildAdornerSets();
         }
         finally
         {
             this.CancelEditTransaction();
             this.ClearFeedback();
             this.PreviewInsertionPoint = (ISceneInsertionPoint)null;
         }
     }
     return(true);
 }