This commit is contained in:
fan 2023-07-12 13:59:23 +08:00
commit 76d9ae204b
4 changed files with 16 additions and 13 deletions

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);

View File

@ -191,12 +191,6 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
if (axleCountingPs.y > height.y) { if (axleCountingPs.y > height.y) {
direction = -1; direction = -1;
} }
if (
section.datas.sectionType === SectionType.Logic ||
section.datas.children.includes(refDevice.id)
) {
return;
}
if (refDevice.type == Section.Type || refDevice.type == Turnout.Type) if (refDevice.type == Section.Type || refDevice.type == Turnout.Type)
this.draw( this.draw(
axleCountingPs, axleCountingPs,

View File

@ -74,10 +74,7 @@ export class SeparatorDraw extends GraphicDrawAssistant<
allR.forEach((relation, index) => { allR.forEach((relation, index) => {
const r = relation.getRelationParam(section); const r = relation.getRelationParam(section);
const other = relation.getOtherRelationParam(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))) { if (!rMap.has(setKey(r))) {
rMap.set(setKey(r), { ...r }); rMap.set(setKey(r), { ...r });
} }

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);