This commit is contained in:
fan 2023-10-08 15:50:00 +08:00
commit 7fbbe51486
2 changed files with 5 additions and 4 deletions

View File

@ -37,8 +37,8 @@ function getDefaultEndPoint() {
};
}
const setNormalPosition: MenuItemOptions = { name: '设置定位' };
const setReversePosition: MenuItemOptions = { name: '设置反位' };
const setNormalPosition: MenuItemOptions = { name: '定操' };
const setReversePosition: MenuItemOptions = { name: '反操' };
const addTrainConfig: MenuItemOptions = {
name: '添加列车',

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;