列车方向调整

This commit is contained in:
dong 2023-10-07 14:47:01 +08:00
parent 07174d8fc8
commit c89f7bde68

View File

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