Port shortcut definitions from Fabric.js to PixiJS SceneManager/SelectionManager
Replace all Fabric.js Canvas references with SceneManager, SelectionManager, UndoManager, and Viewport. Remove withBreak/breakSelection helper (no longer needed without ActiveSelection). Implement z-swap layer ordering for ] and [ keys, clone-based paste/duplicate via SceneManager._createItem, and direct history.undo()/redo() calls instead of undoRef indirection.
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
* Actual shortcut definitions live in shortcut-definitions.ts.
|
||||
*/
|
||||
|
||||
import { Canvas, FabricObject } from 'fabric';
|
||||
import type { SceneManager, SceneItem } from './SceneManager';
|
||||
import type { SelectionManager } from './SelectionManager';
|
||||
import type { UndoManager } from './history';
|
||||
import type { Viewport } from 'pixi-viewport';
|
||||
import { ToolType } from './tools';
|
||||
|
||||
export interface ShortcutKeys {
|
||||
@@ -24,17 +27,15 @@ export interface ShortcutDef {
|
||||
}
|
||||
|
||||
export interface ShortcutContext {
|
||||
canvas: Canvas;
|
||||
getActiveObjects: () => FabricObject[];
|
||||
getActiveObject: () => FabricObject | null;
|
||||
clipboardRef: React.MutableRefObject<FabricObject[]>;
|
||||
cloneFabricObject: (obj: any, dx: number, dy: number) => Promise<any>;
|
||||
writeCanvasToClipboard: (objects?: FabricObject[]) => Promise<void>;
|
||||
onCanvasChange: () => void;
|
||||
scene: SceneManager;
|
||||
selection: SelectionManager;
|
||||
history: UndoManager;
|
||||
viewport: Viewport;
|
||||
onChange: () => void;
|
||||
clipboardRef: React.MutableRefObject<SceneItem[]>;
|
||||
showToast: (msg: string) => void;
|
||||
fitAll: () => void;
|
||||
setActiveTool: (tool: ToolType) => void;
|
||||
undoRef: React.MutableRefObject<any>;
|
||||
setCanUndo: (v: boolean) => void;
|
||||
setCanRedo: (v: boolean) => void;
|
||||
refreshLayers: () => void;
|
||||
@@ -42,6 +43,7 @@ export interface ShortcutContext {
|
||||
handleUngroup: () => void;
|
||||
toggleGrid: () => void;
|
||||
toggleShowHelp: () => void;
|
||||
writeCanvasToClipboard: (items?: SceneItem[]) => Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user