代码调整

This commit is contained in:
joylink_cuiweidong 2020-03-12 15:13:18 +08:00
parent 56126bdbf3
commit 6c7bb150fb

View File

@ -19,6 +19,7 @@ export default class Train extends Group {
this.size = 0; this.size = 0;
this.section = null; this.section = null;
this.nextPointIndex = 1; this.nextPointIndex = 1;
this.currentAdd = 0;
this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat; this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat;
@ -116,7 +117,6 @@ export default class Train extends Group {
this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y); this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y);
// 算出折线的长度 // 算出折线的长度
this.lineLength = 0; this.lineLength = 0;
this.currentAdd = 0;
let oldPoint = null; let oldPoint = null;
oldmodel.points.forEach((point)=>{ oldmodel.points.forEach((point)=>{
if (oldPoint) { if (oldPoint) {
@ -203,7 +203,6 @@ export default class Train extends Group {
// Math.pow(points[this.nextPointIndex - 1].y - points[this.nextPointIndex].y, 2), // Math.pow(points[this.nextPointIndex - 1].y - points[this.nextPointIndex].y, 2),
// ); // );
// } // }
debugger;
const rate = (this.lineLength * train.offsetp - this.currentAdd) / targetDistance; const rate = (this.lineLength * train.offsetp - this.currentAdd) / targetDistance;
this.startX = points[this.nextPointIndex - 1].x + (points[this.nextPointIndex].x - points[this.nextPointIndex - 1].x) * rate; this.startX = points[this.nextPointIndex - 1].x + (points[this.nextPointIndex].x - points[this.nextPointIndex - 1].x) * rate;
this.startY = points[this.nextPointIndex - 1].y + (points[this.nextPointIndex].y - points[this.nextPointIndex - 1].y) * rate; this.startY = points[this.nextPointIndex - 1].y + (points[this.nextPointIndex].y - points[this.nextPointIndex - 1].y) * rate;