diff --git a/src/drawApp/index.ts b/src/drawApp/index.ts index 13db706..a00aff1 100644 --- a/src/drawApp/index.ts +++ b/src/drawApp/index.ts @@ -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); diff --git a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts index 7ac26b5..9c96200 100644 --- a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts +++ b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts @@ -191,12 +191,6 @@ export class AxleCountingDraw extends GraphicDrawAssistant< if (axleCountingPs.y > height.y) { direction = -1; } - if ( - section.datas.sectionType === SectionType.Logic || - section.datas.children.includes(refDevice.id) - ) { - return; - } if (refDevice.type == Section.Type || refDevice.type == Turnout.Type) this.draw( axleCountingPs, diff --git a/src/graphics/separator/SeparatorDrawAssistant.ts b/src/graphics/separator/SeparatorDrawAssistant.ts index d1a1453..54482cd 100644 --- a/src/graphics/separator/SeparatorDrawAssistant.ts +++ b/src/graphics/separator/SeparatorDrawAssistant.ts @@ -74,10 +74,7 @@ export class SeparatorDraw extends GraphicDrawAssistant< allR.forEach((relation, index) => { const r = relation.getRelationParam(section); const other = relation.getOtherRelationParam(section); - if (!section.datas.children.includes(other.g.id)) { - // 排除物理区段和自身逻辑区段的关联关系 - port.push(r.param); - } + port.push(r.param); if (!rMap.has(setKey(r))) { rMap.set(setKey(r), { ...r }); } diff --git a/src/jl-graphic/app/JlGraphicApp.ts b/src/jl-graphic/app/JlGraphicApp.ts index 4be56ea..5cf08f3 100644 --- a/src/jl-graphic/app/JlGraphicApp.ts +++ b/src/jl-graphic/app/JlGraphicApp.ts @@ -737,7 +737,7 @@ export class GraphicApp extends EventEmitter { deleteGraphics(...graphics: JlGraphic[]): JlGraphic[] { const dels = graphics.filter((g) => { if ( - this._options?.isSupportDeletion && + this._options?.isSupportDeletion == undefined || this._options.isSupportDeletion(g) ) { this.doDeleteGraphics(g);