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

View File

@ -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,

View File

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

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