Exemplo n.º 1
0
        public virtual void LoadMouseEvent(MouseButtons button, PointF location, MouseType type)
        {
            PointF pf = location;

            if (IsVector)
            {
                pf = Calculation.GetInvertPos(((IDrawVector)this).Matrix, location);
            }

            switch (type)
            {
            case MouseType.Down:
                OnMouseDown(button, pf.X - Rect.X, pf.Y - Rect.Y);
                break;

            case MouseType.Up:
                OnMouseUp(button, pf.X - Rect.X, pf.Y - Rect.Y);
                break;

            case MouseType.Move:
                OnMouseMove(button, pf.X - Rect.X, pf.Y - Rect.Y);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        public void MoveNode(PointF point, int pos)
        {
            PointF p     = Calculation.GetInvertPos(DataBk.Matrix, point);
            PointF mouse = Calculation.GetInvertPos(DataBk.Matrix, DataBk.MousePos);
            PointF off   = new PointF(p.X - mouse.X, p.Y - mouse.Y);

            int index = _opers[pos].Index;

            PointF[] ps       = (PointF[])_pointsBk.Clone();
            byte[]   ts       = _types;
            int      sign     = ts[index] & 0x0F;
            PointF   value    = ps[index];
            int      nextSign = -1;

            if (index + 1 < ps.Length)
            {
                nextSign = ts[index + 1] & 0x0F;
            }
            int preSign = -1;

            if (index - 1 > 0)
            {
                preSign = ts[index - 1] & 0x0F;
            }

            value.X += off.X;
            value.Y += off.Y;

            switch (sign)
            {
            case 0x00:
            case 0x01:
                if (nextSign == 3)
                {
                    MoveBezierPoint(ps[index], ref ps[index + 1], ref ps[index + 2], ps[index + 3],
                                    value, true);
                }
                break;

            case 0x03:
                if (preSign == 3)
                {
                    MoveBezierPoint(ps[index - 3], ref ps[index - 2], ref ps[index - 1], ps[index],
                                    value, false);
                }
                if (nextSign == 3)
                {
                    MoveBezierPoint(ps[index], ref ps[index + 1], ref ps[index + 2], ps[index + 3],
                                    value, true);
                }
                break;
            }
            ps[index] = value;
            OffsetDatas(ps, CalculateNodeOffset(ps));

            _points = (PointF[])ps.Clone();
            InitializeNode();
            LoadGeneratePathEvent();
        }