修改app配置-是否支持删除判断逻辑

This commit is contained in:
walker 2023-07-12 13:04:58 +08:00
parent f89c8eb48d
commit 3612e0fc16
2 changed files with 12 additions and 12 deletions

View File

@ -114,17 +114,17 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
return new TrainData();
}),
],
isSupportDeletion: (g): boolean => {
if (g.type === Signal.Type) {
Notify.create({
type: 'warning',
message: '信号机不支持删除',
timeout: 1000,
});
return false;
}
return true;
},
// isSupportDeletion: (g): boolean => {
// if (g.type === Signal.Type) {
// Notify.create({
// type: 'warning',
// message: '信号机不支持删除',
// timeout: 1000,
// });
// return false;
// }
// return true;
// },
});
// 画布右键菜单

View File

@ -737,7 +737,7 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
deleteGraphics(...graphics: JlGraphic[]): JlGraphic[] {
const dels = graphics.filter((g) => {
if (
this._options?.isSupportDeletion &&
this._options?.isSupportDeletion == undefined ||
this._options.isSupportDeletion(g)
) {
this.doDeleteGraphics(g);