public bool IsEnter(Point point)
        {
            var points = ReferenceCreator.GetPoints(Reference);

            var targetPoint = points.Last();

            var oppositePoint = points[2];

            if (targetPoint.X == oppositePoint.X && targetPoint.Y == oppositePoint.Y)
            {
                throw new Exception("Arrow can be only vertical or horizontal");
            }

            var center = new Point()
            {
                X = (targetPoint.X + oppositePoint.X) / 2,
                Y = (targetPoint.Y + oppositePoint.Y) / 2
            };

            var delta = center - point;

            if (Math.Abs(delta.X) <= ReferenceCreator.ArrowLength / 2 &&
                Math.Abs(delta.Y) <= ReferenceCreator.ArrowLength / 2)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public PathGeometry Create(ICanvasElement element)
        {
            var reference = (ReferenceCanvas)element;

            var arrowGeometry = new PathGeometry();

            IList <Point> points = ReferenceCreator.GetPoints(element);

            foreach (var figure in _ArrowCreate(reference.View.type, points[2], points[3]))
            {
                arrowGeometry.Figures.Add(figure);
            }

            return(arrowGeometry);
        }