公里表显示调整

This commit is contained in:
joylink_fanyuhong 2024-11-14 14:46:13 +08:00
parent 0da7654efa
commit 41e59960ee

View File

@ -195,6 +195,7 @@ export class Station extends JlGraphic {
codeGraph.anchor.set(0.5); codeGraph.anchor.set(0.5);
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678; const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
if (Math.floor(kilometerCode * 1000).toString().length > 3) { if (Math.floor(kilometerCode * 1000).toString().length > 3) {
if (Number(kilometerCode) > 0) {
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString(); const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
kilometerGraph.text = kilometerGraph.text =
'K' + 'K' +
@ -203,6 +204,17 @@ export class Station extends JlGraphic {
( (
Number(kilometerCode.toString().substring(kiloBit.length)) / 1000 Number(kilometerCode.toString().substring(kiloBit.length)) / 1000
).toFixed(3); ).toFixed(3);
} else {
const fuKilometerCode = Number(kilometerCode) * -1;
const kiloBit = Math.floor(fuKilometerCode / 1000000).toString();
kilometerGraph.text =
'K-' +
kiloBit +
'-' +
(
Number(kilometerCode.toString().substring(kiloBit.length)) / 1000
).toFixed(3);
}
} else { } else {
kilometerGraph.text = (kilometerCode * 1000).toFixed(3); kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
} }