Ejemplo n.º 1
0
        public override void MouseDrag(int x, int y)
        {
            switch (this.EditMode)
            {
            case Samples.EditMode.Select:
            {
                if (this.currentSelectedPath != null)
                {
                    //find xdiff,ydiff
                    int xdiff = x - this.lastMousePosX;
                    int ydiff = y - this.lastMousePosY;
                    this.lastMousePosX = x;
                    this.lastMousePosY = y;
                    //move
                    currentSelectedPath.MoveBy(xdiff, ydiff);
                }
            }
            break;

            case Samples.EditMode.Draw:
            {
                //find diff
                Vector newPoint = new Vector(x, y);
                //find distance

                currentBrushPath.AddPointAtLast((int)newPoint.X, (int)newPoint.Y);
                latestMousePoint = new PixelFarm.Drawing.Point(x, y);
                //
                // currentBrushPath.MakeSmoothPath();
            }
            break;
            }
        }
Ejemplo n.º 2
0
        public override void MouseDrag(int x, int y)
        {
            switch (this.EditMode)
            {
            case Samples.EditMode.Select:
            {
                if (this.currentSelectedPath != null)
                {
                    //find xdiff,ydiff
                    int xdiff = x - this.lastMousePosX;
                    int ydiff = y - this.lastMousePosY;
                    this.lastMousePosX = x;
                    this.lastMousePosY = y;
                    //move
                    currentSelectedPath.MoveBy(xdiff, ydiff);
                }
            }
            break;

            case Samples.EditMode.Draw:
            {
                //find diff
                Vector newPoint = new Vector(x, y);
                //find distance
                Vector oldPoint = new Vector(latestMousePoint.x, latestMousePoint.y);
                Vector delta    = (newPoint - oldPoint) / 2;      // 2,4 etc
                //midpoint
                Vector midPoint = (newPoint + oldPoint) / 2;
                delta = delta.NewLength(5);
                delta.Rotate(90);
                Vector newTopPoint    = midPoint + delta;
                Vector newBottomPoint = midPoint - delta;
                //bottom point
                currentBrushPath.AddPointAtFirst((int)newBottomPoint.X, (int)newBottomPoint.Y);
                currentBrushPath.AddPointAtLast((int)newTopPoint.X, (int)newTopPoint.Y);
                latestMousePoint = new PixelFarm.Drawing.Point(x, y);


                //
                // currentBrushPath.MakeSmoothPath();
            }
            break;
            }
        }