private void ExecuteMouseMove(InternalCanvas canvas) { // See how much the mouse has moved. Point point = Mouse.GetPosition(canvas); double offset_x = point.X - mousePosition.X; double offset_y = point.Y - mousePosition.Y; // Get the rectangle's current position. Point newPosition = GetNewLocationAndSize(canvas, offset_x, offset_y); // Don't use negative width or height. if ((newWidth > 0) && (newHeight > 0)) { // Update the rectangle. shapeComponent.Move(new MoveVisitor(new Point(newPosition.X - newLocation.X, newPosition.Y - newLocation.Y))); //canvas.SetNewShape(shapeComponent, newPosition.X, newPosition.Y); canvas.SetNewShape(shapeComponent, shapeComponent.Location.X, shapeComponent.Location.Y); shapeComponent.Resize(new ResizeVisitor(((offset_x + shapeComponent.ActualWidth) / shapeComponent.ActualWidth), ((offset_y + shapeComponent.ActualHeight) / shapeComponent.ActualHeight), shapeComponent.MousePosition)); //shapeComponent.Width = newWidth; //shapeComponent.Height = newHeight; // Save the mouse's new location. mousePosition = point; } newLocation = canvas.GetPositionOfShapeInCanvas(shapeComponent); shapeComponent.Location = newLocation; //SetMouseCursor(shape); }
public override void Move(MoveVisitor visitor) { visitor.Visit(this); ShapeComponent.Move(visitor); }