MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createCropOptionsMenuItems

Function createCropOptionsMenuItems

apps/desktop/src/components/Cropper.tsx:1561–1588  ·  view source on GitHub ↗
(options: {
	aspect: Ratio | null;
	snapToRatioEnabled: boolean;
	onAspectSet: (aspect: Ratio | null) => void;
	onSnapToRatioSet: (enabled: boolean) => void;
})

Source from the content-addressed store, hash-verified

1559}
1560
1561export 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}

Callers 4

showCropOptionsMenuFunction · 0.90
showCropOptionsMenuFunction · 0.90
showCropOptionsMenuFunction · 0.90
showCropOptionsMenuFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected