列车调整

This commit is contained in:
dong 2023-10-08 13:28:28 +08:00
parent c2a1a2edfe
commit da2c50675c

View File

@ -418,8 +418,9 @@ export class Train extends JlGraphic {
const px = startP.x + Math.round(offset * (endP.x - startP.x));
const py = startP.y + Math.round(offset * (endP.y - startP.y));
let angle = Math.atan2(endP.y - startP.y, endP.x - startP.x);
if (-Math.PI / 2 > angle) {
angle = -(angle + Math.PI);
const exact = Math.PI / 16;
if (-Math.PI / 2 - exact > angle) {
angle = angle + Math.PI;
}
if (Math.PI / 2 <= angle) {
angle = angle - Math.PI;