修改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(); return new TrainData();
}), }),
], ],
isSupportDeletion: (g): boolean => { // isSupportDeletion: (g): boolean => {
if (g.type === Signal.Type) { // if (g.type === Signal.Type) {
Notify.create({ // Notify.create({
type: 'warning', // type: 'warning',
message: '信号机不支持删除', // message: '信号机不支持删除',
timeout: 1000, // timeout: 1000,
}); // });
return false; // return false;
} // }
return true; // return true;
}, // },
}); });
// 画布右键菜单 // 画布右键菜单

View File

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