Function: pickRotation()
ts
function pickRotation(
image: {
height: number;
width: number;
},
media: MediaDescriptor,
familyDirection: RotateDirection,
override?: 0 | 90 | 270 | "auto" | 180): 0 | 90 | 180 | 270;Pick the rotation value to pass to renderImage / renderMultiPlaneImage.
Pure function — no IO, no driver state. The driver supplies its family-specific rotation direction; this helper combines that with the media's defaultOrientation hint and the caller's optional override to produce a single rotation angle.
Decision table:
overrideis set (and not'auto') → returned verbatim.- media
defaultOrientation === 'horizontal'and image is landscape (width > height) → returnfamilyDirection. - everything else →
0(pass through).
Parameters
| Parameter | Type | Description |
|---|---|---|
image | { height: number; width: number; } | Source image dimensions. |
image.height | number | - |
image.width | number | - |
media | MediaDescriptor | Resolved media descriptor. |
familyDirection? | RotateDirection | Driver family's rotation direction. |
override? | 0 | 90 | 270 | "auto" | 180 | Caller's per-print override. 'auto' means "use the heuristic" (same as omitted). |
Returns
0 | 90 | 180 | 270