private void ResizeRect(RectangleVectorShapeModel rect) { var sizeX = mouseUpPoint.X - mouseDownPoint.X; var sizeY = mouseUpPoint.Y - mouseDownPoint.Y; rect.X = Math.Min(mouseDownPoint.X, mouseUpPoint.X); rect.Y = Math.Min(mouseDownPoint.Y, mouseUpPoint.Y); rect.Width = Math.Abs(sizeX); rect.Height = Math.Abs(sizeY); }
private RectangleVectorShapeModel CreateRect() { var sizeX = mouseUpPoint.X - mouseDownPoint.X; var sizeY = mouseUpPoint.Y - mouseDownPoint.Y; var rect1 = new RectangleVectorShapeModel(Math.Min(mouseDownPoint.X, mouseUpPoint.X), Math.Min(mouseDownPoint.Y, mouseUpPoint.Y), 0, -sizeX, -sizeY, color, layers[0]); Debug.WriteLine("RectSize: " + sizeX + " " + sizeY); vectorShapes.Add(rect1); return(rect1); }