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);
final zoom = (availableWidth / bounds.width).clamp(minZoom, maxZoom);
return copyWith(center: _aboveReserved(bounds.center, zoom), zoom: zoom);
}