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

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, GraphicApp,
GraphicData, GraphicData,
JlDrawApp, JlDrawApp,
JlGraphic,
KeyListener, KeyListener,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
@ -77,6 +78,7 @@ import {
LogicSectionTemplate, LogicSectionTemplate,
} from 'src/graphics/logicSection/LogicSection'; } from 'src/graphics/logicSection/LogicSection';
import { LogicSectionData } from './graphics/LogicSectionInteraction'; import { LogicSectionData } from './graphics/LogicSectionInteraction';
import { Notify } from 'quasar';
// export function fromStoragePoint(p: graphicData.Point): Point { // export function fromStoragePoint(p: graphicData.Point): Point {
// return new Point(p.x, p.y); // return new Point(p.x, p.y);
@ -233,8 +235,18 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
]; ];
DrawSignalInteraction.init(app); DrawSignalInteraction.init(app);
} }
const isSupportDeletion = (g: JlGraphic) => {
app.setOptions({ drawAssistants: drawAssistants }); 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); app.registerMenu(DefaultCanvasMenu);