当前选中的逻辑区段不能删除

This commit is contained in:
dong 2023-07-12 13:20:16 +08:00
parent 1a74406d05
commit 28dc36b679

View File

@ -9,6 +9,7 @@ import {
GraphicApp,
GraphicData,
JlDrawApp,
JlGraphic,
KeyListener,
} from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
@ -77,6 +78,7 @@ import {
LogicSectionTemplate,
} from 'src/graphics/logicSection/LogicSection';
import { LogicSectionData } from './graphics/LogicSectionInteraction';
import { Notify } from 'quasar';
// export function fromStoragePoint(p: graphicData.Point): Point {
// return new Point(p.x, p.y);
@ -233,8 +235,18 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
];
DrawSignalInteraction.init(app);
}
app.setOptions({ drawAssistants: drawAssistants });
const isSupportDeletion = (g: JlGraphic) => {
if (g.type === LogicSection.Type && g.selected) {
Notify.create({
type: 'warning',
message: '逻辑区段不支持删除',
timeout: 1000,
});
return false;
}
return true;
};
app.setOptions({ drawAssistants: drawAssistants, isSupportDeletion });
// 画布右键菜单
app.registerMenu(DefaultCanvasMenu);