绘制应用添加绘制状态,控制右键结束绘制时不触发画布右键菜单

This commit is contained in:
walker 2023-05-22 09:09:43 +08:00
parent 39d68c8fe0
commit 118e96eed2
2 changed files with 4 additions and 0 deletions

View File

@ -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 = () => {

View File

@ -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);