修改代码

This commit is contained in:
zyy 2019-07-18 16:11:48 +08:00
parent e82c7fb5af
commit 2138dab1a6

View File

@ -120,13 +120,32 @@ export default class Section extends Group {
let tempx = x;
let tempy = y;
if (style.Section.sectionTextPosition == 1) {
tempy = tempy - style.textFontSize;
} else if (style.Section.sectionTextPosition == -1) {
tempy = tempy + style.textFontSize;
} else if (style.Section.sectionTextPosition == 0) {
// 根据列车上下行进行坐标偏移
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
if (model.trainPosType === '01') {
tempy -= (style.Section.sectionWidth * 1.5);
if (model.type === '01') {
tempy += traingle.getCos(style.textFontSize * 0.8 + style.nameDistance) - style.textFontSize * 2;
}
} else {
tempy += (style.Section.sectionWidth * 1.5);
if (model.type === '01') {
tempy -= traingle.getCos(style.textFontSize * 0.8 + style.nameDistance) - style.textFontSize * 2;
}
}
}
if (model.type !== '03') {
// 计算文字和物理区段的距离
// 如果不是逻辑区段,让名称和区段保持点距离
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
if (model.type === '01') {
tempx += traingle.getSin(style.textFontSize * 0.8 + style.nameDistance);
tempy += traingle.getCos(style.textFontSize * 0.8 + style.nameDistance) - style.textFontSize * 2;
}
}