예제 #1
0
        public void EditPoint(int x, int y, Cairo.PointD offset)
        {
            int realX = x;
            int realY = y;

            if (!ConvertPointToCanvasPoint(offset, ref realX, ref realY))
            {
                return;
            }

            if (listPoint == null)
            {
                listPoint = new List <BarierPoint>();
            }

            BarierPoint bp       = new BarierPoint(realX, realY);
            BarierPoint nearstBP = BarierPoint.ClosestPoint(bp, listPoint);

            double distance = 999;

            if (nearstBP != null)
            {
                distance = BarierPoint.Distance(bp, nearstBP);
            }

            if (distance < 5.5)
            {
                StartMovingPoint(x, y, offset);
            }
            else
            {
                AddPoint(x, y, offset);
            }
        }
예제 #2
0
        public void StartMovingPoint(int x, int y, Cairo.PointD offset)
        {
            if (!ConvertPointToCanvasPoint(offset, ref x, ref y))
            {
                return;
            }

            if (listPoint == null)
            {
                listPoint = new List <BarierPoint>();
            }

            BarierPoint bp       = new BarierPoint(x, y);
            BarierPoint nearstBP = BarierPoint.ClosestPoint(bp, listPoint);

            if (nearstBP != null)
            {
                movingPoint = nearstBP;
                //GdkWindow.InvalidateRect(new Gdk.Rectangle(drawOffsetX, drawOffsetY, width, height), false);
            }
        }