diff --git a/src/jmapNew/shape/Train/ETriangle.js b/src/jmapNew/shape/Train/ETriangle.js index 93f46425a..f7f5f4ebf 100644 --- a/src/jmapNew/shape/Train/ETriangle.js +++ b/src/jmapNew/shape/Train/ETriangle.js @@ -71,7 +71,8 @@ export default class ETriangle extends Group { zlevel: model.zlevel, z: model.z, shape: { - points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]] + // points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]] + points:[[model.point.x, model.point.y], [model.point.x - 10 * right, model.point.y - 6], [model.point.x - 10 * right, model.point.y + 6]] }, style: { stroke:'#00FF00', @@ -88,9 +89,12 @@ export default class ETriangle extends Group { if (this.angle) { const trainRight = right == 1 ? 1 : -1; let data = [ - [model.x + 10 * trainRight, model.y], - [model.x, model.y - 6], - [model.x, model.y + 6] + // [model.x + 10 * trainRight, model.y], + // [model.x, model.y - 6], + // [model.x, model.y + 6] + [model.x, model.y], + [model.x - 10 * trainRight, model.y - 6], + [model.x - 10 * trainRight, model.y + 6] ]; if (this.style.Section.trainPosition.specialShow) { data = [ diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 96588e9a9..40fa92cee 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -143,7 +143,7 @@ export default class Train extends Group { }); oldPoint = 0; this.pointList.forEach(point => { - point.percentStart = oldPoint / this.lineLength; + point.percentStart = (oldPoint / this.lineLength) < 0.001 ? 0 : (oldPoint / this.lineLength); oldPoint += point.length; point.percentEnd = oldPoint / this.lineLength; }); @@ -190,8 +190,10 @@ export default class Train extends Group { if (train.physicalCode && train.offsetp && this.triangle) { this.pointList.forEach(point => { if (train.offsetp > point.percentStart && train.offsetp <= point.percentEnd) { - this.startX = point.pointStart.x + (point.pointEnd.x - point.pointStart.x) * (train.offsetp - point.percentStart); - this.startY = point.pointStart.y + (point.pointEnd.y - point.pointStart.y) * (train.offsetp - point.percentStart); + let offsetp = train.offsetp; + if (train.offsetp > 0.99) { offsetp = 1; } + this.startX = point.pointStart.x + (point.pointEnd.x - point.pointStart.x) * (offsetp - point.percentStart); + this.startY = point.pointStart.y + (point.pointEnd.y - point.pointStart.y) * (offsetp - point.percentStart); } }); const point = { x: this.startX, y: this.startY };