Exemplo n.º 1
0
        public void UpdateCurveTarget(string id, Element target, ThumbPosition thumbPosition)
        {
            var curves = Children.OfType<Path>();
            curves.Count().ToString();

            foreach (Path curve in Curves.Values.Where(curve => curve.Name.StartsWith(id)))
            {
                Point thumbLocation = target.GetCanvasThumbPosition(thumbPosition);
                PathGeometry curveGeometry = (PathGeometry)curve.Data;
                PathFigure curveFigure = curveGeometry.Figures[0];
                BezierSegment bezierSegment = (BezierSegment)curveFigure.Segments[0];
                bezierSegment.Point2 = ComputeBezierSegmentPoint(thumbPosition, thumbLocation);
                bezierSegment.Point3 = thumbLocation;
            }
        }
Exemplo n.º 2
0
        public void LinkCurve(string curveId, Element source, ThumbPosition sourcePosition, Element target, ThumbPosition targetPosition)
        {
            foreach (Path curve in Curves.Values.Where(curve => curve.Name.StartsWith(curveId)))
            {
                Point thumbLocation = target.GetCanvasThumbPosition(targetPosition);
                PathGeometry curveGeometry = (PathGeometry)curve.Data;
                PathFigure curveFigure = curveGeometry.Figures[0];
                BezierSegment bezierSegment = (BezierSegment)curveFigure.Segments[0];

                bezierSegment.Point2 = ComputeBezierSegmentPoint(targetPosition, thumbLocation);
                bezierSegment.Point3 = thumbLocation;
            }
        }