diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 56e1948..e4c55ea 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 56e1948393aa51e0bf16d754292a211f348df161 +Subproject commit e4c55ea4b6f9f5f875d59fc5bba51fc21bc8ef97 diff --git a/src/graphics/train/Train.ts b/src/graphics/train/Train.ts index c8a0be6..53981ab 100644 --- a/src/graphics/train/Train.ts +++ b/src/graphics/train/Train.ts @@ -637,9 +637,10 @@ export class Train extends JlGraphic { } const offset = this.states.headOffset / allLength; // 百分比偏移 let offsetL = totalLength * offset; + // 0.01为保证浮点数计算误差 const indexP = lengths.findIndex((l) => { offsetL -= l; - return offsetL <= 0; + return offsetL <= 0.001; }); const startP = points[indexP]; const endP = points[indexP + 1];