diff --git a/src/examples/app/index.ts b/src/examples/app/index.ts index 9677f78..39b7897 100644 --- a/src/examples/app/index.ts +++ b/src/examples/app/index.ts @@ -100,6 +100,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { // 画布右键菜单 app.registerMenu(DefaultCanvasMenu); app.canvas.on('_rightclick', (e) => { + if (app._drawing) return; UndoOptions.disabled = !app.opRecord.hasUndo; RedoOptions.disabled = !app.opRecord.hasRedo; UndoOptions.handler = () => { diff --git a/src/jlgraphic/app/JlDrawApp.ts b/src/jlgraphic/app/JlDrawApp.ts index bcc53c4..cf49b2e 100644 --- a/src/jlgraphic/app/JlDrawApp.ts +++ b/src/jlgraphic/app/JlDrawApp.ts @@ -80,6 +80,7 @@ export abstract class GraphicDrawAssistant< } bind(): void { + this.app._drawing = true; const canvas = this.canvas; canvas.addChild(this.container); canvas.on('mousedown', this.onLeftDown, this); @@ -113,6 +114,7 @@ export abstract class GraphicDrawAssistant< this.app.removeKeyboardListener(this.escListener); this.app.viewport.plugins.remove('drag'); + this.app._drawing = false; } onLeftDown(e: FederatedMouseEvent) {} @@ -220,6 +222,7 @@ export class JlDrawApp extends GraphicApp { }); drawAssistants: DrawAssistant[] = []; + _drawing = false; constructor(dom: HTMLElement) { super(dom);