diff --git a/frontend/src/canvas/context-menu-items.ts b/frontend/src/canvas/context-menu-items.ts index f1f581d..a6897e4 100644 --- a/frontend/src/canvas/context-menu-items.ts +++ b/frontend/src/canvas/context-menu-items.ts @@ -157,10 +157,10 @@ export function buildContextMenuItems(ctx: MenuContext): MenuItem[] { { label: '', shortcut: '', onClick: () => {}, divider: true }, // -- Image -- - { label: 'Flip Horizontal', shortcut: 'Alt+Shift+H', onClick: () => { ops.flipHorizontal(selected); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel }, - { label: 'Flip Vertical', shortcut: 'Alt+Shift+V', onClick: () => { ops.flipVertical(selected); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel }, - { label: 'Rotate Clockwise', shortcut: 'R', onClick: () => { ops.rotate90(selected, true); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel }, - { label: 'Rotate Counter-Clockwise', shortcut: 'Shift+R', onClick: () => { ops.rotate90(selected, false); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel }, + { label: 'Flip Horizontal', shortcut: 'Alt+Shift+H', onClick: () => { ops.flipHorizontal(selected); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel || selected.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type)) }, + { label: 'Flip Vertical', shortcut: 'Alt+Shift+V', onClick: () => { ops.flipVertical(selected); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel || selected.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type)) }, + { label: 'Rotate Clockwise', shortcut: 'R', onClick: () => { ops.rotate90(selected, true); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel || selected.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type)) }, + { label: 'Rotate Counter-Clockwise', shortcut: 'Shift+R', onClick: () => { ops.rotate90(selected, false); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel || selected.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type)) }, { label: 'Crop', shortcut: 'C', onClick: () => ctx.startCrop?.(), disabled: selected.length !== 1 || selected[0]?.data.type !== 'image' }, { label: 'Reset Transform', shortcut: 'Ctrl+Shift+T', onClick: () => { ops.resetTransform(selected); selection?.transformBox.update(selected); ctx.onChange(ids); }, disabled: !hasSel }, { label: '', shortcut: '', onClick: () => {}, divider: true }, diff --git a/frontend/src/canvas/shortcut-definitions.ts b/frontend/src/canvas/shortcut-definitions.ts index df9b66b..b2c7a1f 100644 --- a/frontend/src/canvas/shortcut-definitions.ts +++ b/frontend/src/canvas/shortcut-definitions.ts @@ -238,12 +238,20 @@ export const shortcuts: ShortcutDef[] = [ { id: 'flip-h', keys: { key: 'h', alt: true, shift: true }, category: 'image', description: 'Flip horizontal', needsSelection: true, - handler: (ctx) => _opUpdate(ctx, ops.flipHorizontal), + handler: (ctx) => { + const items = ctx.selection.getSelectedItems(); + if (items.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type))) return; + _opUpdate(ctx, ops.flipHorizontal); + }, }, { id: 'flip-v', keys: { key: 'v', alt: true, shift: true }, category: 'image', description: 'Flip vertical', needsSelection: true, - handler: (ctx) => _opUpdate(ctx, ops.flipVertical), + handler: (ctx) => { + const items = ctx.selection.getSelectedItems(); + if (items.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type))) return; + _opUpdate(ctx, ops.flipVertical); + }, }, { id: 'reset-transform', keys: { key: 't', ctrl: true, shift: true }, @@ -316,12 +324,20 @@ export const shortcuts: ShortcutDef[] = [ { id: 'rotate-cw', keys: { key: 'r' }, category: 'image', description: 'Rotate 90° clockwise', needsSelection: true, - handler: (ctx) => _opUpdate(ctx, (items) => ops.rotate90(items, true)), + handler: (ctx) => { + const items = ctx.selection.getSelectedItems(); + if (items.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type))) return; + _opUpdate(ctx, (items) => ops.rotate90(items, true)); + }, }, { id: 'rotate-ccw', keys: { key: 'r', shift: true }, category: 'image', description: 'Rotate 90° counter-clockwise', needsSelection: true, - handler: (ctx) => _opUpdate(ctx, (items) => ops.rotate90(items, false)), + handler: (ctx) => { + const items = ctx.selection.getSelectedItems(); + if (items.some(i => ['pdf-page', 'sticky', 'markdown', 'text'].includes(i.data.type))) return; + _opUpdate(ctx, (items) => ops.rotate90(items, false)); + }, }, // ═══════════════════════════════════════