Esempio n. 1
0
        public override void MouseDrag(int x, int y)
        {
            //find diff
            Vector newPoint = new Vector(x, y);
            //find distance
            Vector oldPoint = new Vector(latestMousePoint.x, latestMousePoint.y);
            var    delta    = (newPoint - oldPoint) / 2; // 2,4 etc
            //midpoint
            var midPoint = (newPoint + oldPoint) / 2;

            //find angle
            var topPoint    = delta; //create top point
            var bottomPoint = delta; //bottom point

            topPoint.Rotate(90);
            bottomPoint.Rotate(-90);

            var newTopPoint    = midPoint + topPoint;
            var newBottomPoint = midPoint + bottomPoint;


            //bottom point
            currentBrushPath.AddPointFirst((int)newBottomPoint.X, (int)newBottomPoint.Y);
            currentBrushPath.AddPointLast((int)newTopPoint.X, (int)newTopPoint.Y);

            latestMousePoint = new Point(x, y);
        }
Esempio n. 2
0
        public override void MouseDrag(int x, int y)
        {
            //find diff
            Vector newPoint = new Vector(x, y);
            //find distance
            Vector oldPoint = new Vector(latestMousePoint.x, latestMousePoint.y);
            var    delta    = (newPoint - oldPoint) / 2; // 2,4 etc
            //midpoint
            var midPoint = (newPoint + oldPoint) / 2;

            delta = delta.NewLength(5);
            delta.Rotate(90);

            var newTopPoint    = midPoint + delta;
            var newBottomPoint = midPoint - delta;


            //bottom point
            currentBrushPath.AddPointFirst((int)newBottomPoint.X, (int)newBottomPoint.Y);
            currentBrushPath.AddPointLast((int)newTopPoint.X, (int)newTopPoint.Y);

            latestMousePoint = new Point(x, y);
        }