forWidth method
This camera fitted to the width of bounds.
Implementation
DiagramCameraState forWidth(DiagramRect bounds, {double padding = 48}) {
if (bounds.width <= 0 || viewportSize.width <= 0) return this;
final availableWidth = math.max(1, viewportSize.width - padding * 2);
return copyWith(
center: bounds.center,
zoom: (availableWidth / bounds.width).clamp(minZoom, maxZoom),
);
}