(options: {
aspect: Ratio | null;
snapToRatioEnabled: boolean;
onAspectSet: (aspect: Ratio | null) => void;
onSnapToRatioSet: (enabled: boolean) => void;
})
| 1559 | } |
| 1560 | |
| 1561 | export function createCropOptionsMenuItems(options: { |
| 1562 | aspect: Ratio | null; |
| 1563 | snapToRatioEnabled: boolean; |
| 1564 | onAspectSet: (aspect: Ratio | null) => void; |
| 1565 | onSnapToRatioSet: (enabled: boolean) => void; |
| 1566 | }) { |
| 1567 | return [ |
| 1568 | { |
| 1569 | text: "Free", |
| 1570 | checked: !options.aspect, |
| 1571 | action: () => options.onAspectSet(null), |
| 1572 | } satisfies CheckMenuItemOptions, |
| 1573 | ...COMMON_RATIOS.map( |
| 1574 | (ratio) => |
| 1575 | ({ |
| 1576 | text: `${ratio[0]}:${ratio[1]}`, |
| 1577 | checked: options.aspect === ratio, |
| 1578 | action: () => options.onAspectSet(ratio), |
| 1579 | }) satisfies CheckMenuItemOptions, |
| 1580 | ), |
| 1581 | { item: "Separator" } satisfies PredefinedMenuItemOptions, |
| 1582 | { |
| 1583 | text: "Snap to ratios", |
| 1584 | checked: options.snapToRatioEnabled, |
| 1585 | action: () => options.onSnapToRatioSet(!options.snapToRatioEnabled), |
| 1586 | } satisfies CheckMenuItemOptions, |
| 1587 | ]; |
| 1588 | } |
no outgoing calls
no test coverage detected