/// <summary> /// Converts the given rectangle from the view into the world coordinate space. /// </summary> internal static RectD IntermediateToWorldCoordinates(CanvasControl canvas, RectD rect) { var p1 = GetRounded(canvas.IntermediateToWorldCoordinates(rect.GetTopLeft())); var p2 = GetRounded(canvas.IntermediateToWorldCoordinates(rect.GetBottomRight())); return(new RectD(p1.X, p1.Y, (int)Math.Max(0, p2.X - p1.X), (int)Math.Max(0, p2.Y - p1.Y))); }