mirror of
https://github.com/Spythere/pragotron-td2.git
synced 2026-05-04 22:18:15 +00:00
hotfixy
This commit is contained in:
+26
-12
@@ -163,6 +163,8 @@ export default defineComponent({
|
|||||||
currentRouteIndex: 0,
|
currentRouteIndex: 0,
|
||||||
currentDateDigitIndex: 0,
|
currentDateDigitIndex: 0,
|
||||||
|
|
||||||
|
currentRowAnimating: 0,
|
||||||
|
|
||||||
stationAbbrevs: stationAbbrevs as { [key: string]: string },
|
stationAbbrevs: stationAbbrevs as { [key: string]: string },
|
||||||
selectedCheckpointName: '',
|
selectedCheckpointName: '',
|
||||||
}),
|
}),
|
||||||
@@ -171,18 +173,14 @@ export default defineComponent({
|
|||||||
await this.fetchSceneryInfo();
|
await this.fetchSceneryInfo();
|
||||||
this.selectDefaultCheckpoint();
|
this.selectDefaultCheckpoint();
|
||||||
|
|
||||||
window.addEventListener('resize', (e) => {
|
window.addEventListener('resize', () => {
|
||||||
const elRef = this.$refs['pragotron'] as HTMLElement;
|
this.resizeTable();
|
||||||
if (!elRef) return;
|
|
||||||
|
|
||||||
const scale = Math.min(window.innerWidth / elRef.clientWidth, window.innerHeight / elRef.clientHeight);
|
|
||||||
if (scale > 1) return;
|
|
||||||
|
|
||||||
elRef.style.transform = `scale(${scale})`;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
|
this.resizeTable();
|
||||||
|
|
||||||
this.selectDefaultCheckpoint();
|
this.selectDefaultCheckpoint();
|
||||||
this.shuffleRoutes();
|
this.shuffleRoutes();
|
||||||
this.fetchDepartureList();
|
this.fetchDepartureList();
|
||||||
@@ -327,6 +325,15 @@ export default defineComponent({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resizeTable() {
|
||||||
|
const elRef = this.$refs['pragotron'] as HTMLElement;
|
||||||
|
if (!elRef) return;
|
||||||
|
|
||||||
|
const scale = Math.min(window.innerWidth / elRef.clientWidth, window.innerHeight / elRef.clientHeight, 1);
|
||||||
|
|
||||||
|
elRef.style.transform = `scale(${scale})`;
|
||||||
|
},
|
||||||
|
|
||||||
selectDefaultCheckpoint() {
|
selectDefaultCheckpoint() {
|
||||||
this.selectedCheckpointName = this.selectedStation?.stationCheckpoints[0] || this.stationName;
|
this.selectedCheckpointName = this.selectedStation?.stationCheckpoints[0] || this.stationName;
|
||||||
},
|
},
|
||||||
@@ -352,7 +359,15 @@ export default defineComponent({
|
|||||||
// d = 0 -> time = time
|
// d = 0 -> time = time
|
||||||
// d = time -> time2 = time2-time
|
// d = time -> time2 = time2-time
|
||||||
updateTableRows() {
|
updateTableRows() {
|
||||||
this.departureTable.forEach((dep, i) => {
|
// const isAnimating =
|
||||||
|
// dep.tableValues.routeTo.toLowerCase() != dep.routeTo.toLowerCase() ||
|
||||||
|
// dep.tableValues.routeVia.toLowerCase() != dep.routeVia.toLowerCase() ||
|
||||||
|
// !dep.tableValues.dateDigits.every((dd, i) => dd == dep.dateDigits[i]);
|
||||||
|
// console.log(isAnimating);
|
||||||
|
|
||||||
|
for (let i = 0; i < this.departureTable.length; i++) {
|
||||||
|
const dep = this.departureTable[i];
|
||||||
|
|
||||||
if (dep.tableValues.routeTo.toLowerCase() != dep.routeTo.toLowerCase()) {
|
if (dep.tableValues.routeTo.toLowerCase() != dep.routeTo.toLowerCase()) {
|
||||||
dep.tableValues.routeTo = this.departureRoutes[dep.tableValues.currentRowIndexes[0]];
|
dep.tableValues.routeTo = this.departureRoutes[dep.tableValues.currentRowIndexes[0]];
|
||||||
|
|
||||||
@@ -374,15 +389,13 @@ export default defineComponent({
|
|||||||
(dep.tableValues.currentRowIndexes[j + 2] + 1) % this.dateDigits.length;
|
(dep.tableValues.currentRowIndexes[j + 2] + 1) % this.dateDigits.length;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
shuffleRoutes() {
|
shuffleRoutes() {
|
||||||
for (let i = 0; i < 25; i++) {
|
for (let i = 0; i < 25; i++) {
|
||||||
const randIndex = Math.floor(Math.random() * routeValues.length);
|
const randIndex = Math.floor(Math.random() * routeValues.length);
|
||||||
const randRoute = routeValues[randIndex];
|
const randRoute = routeValues[randIndex];
|
||||||
|
|
||||||
// this.departureRoutes.push(randRoute);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.departureRoutes.sort(() => Math.random() - 0.5);
|
this.departureRoutes.sort(() => Math.random() - 0.5);
|
||||||
@@ -432,6 +445,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
.pragotron {
|
.pragotron {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filters {
|
.filters {
|
||||||
|
|||||||
Reference in New Issue
Block a user