import React from 'react'; interface SelectionToolbarProps { /** Screen-space position of the selection's top-center */ x: number; y: number; count: number; onAlignLeft: () => void; onAlignCenterH: () => void; onAlignRight: () => void; onAlignTop: () => void; onAlignCenterV: () => void; onAlignBottom: () => void; onDistributeH: () => void; onDistributeV: () => void; onPack: () => void; onGrid: () => void; onRow: () => void; onColumn: () => void; onStack: () => void; onFlipH: () => void; onFlipV: () => void; onGroup: () => void; onNormSize: () => void; } // Tiny SVG icons for each action function IcoAlignL() { return ; } function IcoAlignCH() { return ; } function IcoAlignR() { return ; } function IcoAlignT() { return ; } function IcoAlignCV() { return ; } function IcoAlignB() { return ; } function IcoDistH() { return ; } function IcoDistV() { return ; } function IcoPack() { return ; } function IcoGrid() { return ; } function IcoRow() { return ; } function IcoCol() { return ; } function IcoStack() { return ; } function IcoFlipH() { return ; } function IcoFlipV() { return ; } function IcoGroup() { return ; } function IcoNormSize() { return ; } interface BtnDef { icon: React.FC; label: string; shortcut: string; onClick: () => void; minItems?: number; } export default function SelectionToolbar(props: SelectionToolbarProps) { const { x, y, count } = props; const groups: { label: string; items: BtnDef[] }[] = [ { label: 'Align', items: [ { icon: IcoAlignL, label: 'Align left', shortcut: 'Ctrl+\u2190', onClick: props.onAlignLeft }, { icon: IcoAlignCH, label: 'Align center H', shortcut: 'Ctrl+Alt+H', onClick: props.onAlignCenterH }, { icon: IcoAlignR, label: 'Align right', shortcut: 'Ctrl+\u2192', onClick: props.onAlignRight }, { icon: IcoAlignT, label: 'Align top', shortcut: 'Ctrl+\u2191', onClick: props.onAlignTop }, { icon: IcoAlignCV, label: 'Align center V', shortcut: 'Ctrl+Alt+V', onClick: props.onAlignCenterV }, { icon: IcoAlignB, label: 'Align bottom', shortcut: 'Ctrl+\u2193', onClick: props.onAlignBottom }, ], }, { label: 'Distribute', items: [ { icon: IcoDistH, label: 'Distribute H', shortcut: 'Ctrl+Shift+H', onClick: props.onDistributeH, minItems: 3 }, { icon: IcoDistV, label: 'Distribute V', shortcut: 'Ctrl+Shift+V', onClick: props.onDistributeV, minItems: 3 }, ], }, { label: 'Arrange', items: [ { icon: IcoPack, label: 'Pack', shortcut: 'Ctrl+Shift+P', onClick: props.onPack }, { icon: IcoGrid, label: 'Grid', shortcut: '', onClick: props.onGrid }, { icon: IcoRow, label: 'Row', shortcut: '', onClick: props.onRow }, { icon: IcoCol, label: 'Column', shortcut: '', onClick: props.onColumn }, { icon: IcoStack, label: 'Stack', shortcut: 'Ctrl+Alt+S', onClick: props.onStack }, ], }, { label: 'Transform', items: [ { icon: IcoFlipH, label: 'Flip H', shortcut: 'Alt+Shift+H', onClick: props.onFlipH }, { icon: IcoFlipV, label: 'Flip V', shortcut: 'Alt+Shift+V', onClick: props.onFlipV }, { icon: IcoGroup, label: 'Group', shortcut: 'Ctrl+G', onClick: props.onGroup }, { icon: IcoNormSize, label: 'Same size', shortcut: '', onClick: props.onNormSize }, ], }, ]; return (