mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd9af9a630 | |||
| 2188dbdf9b | |||
| c4576d7802 | |||
| 86cb4cff4d | |||
| 0534848677 | |||
| c5d116e2db | |||
| 3dce5ec7c0 | |||
| 956ff8afd7 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pojazdownik",
|
||||
"version": "1.7.1",
|
||||
"version": "1.7.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -35,5 +35,13 @@ export default defineComponent({
|
||||
color: $textColor;
|
||||
font-size: 1em;
|
||||
padding: 1em 0.5em;
|
||||
|
||||
@media screen and (max-width: $breakpointMd) {
|
||||
font-size: calc(0.7rem + 0.75vw);
|
||||
}
|
||||
|
||||
@media screen and (orientation: landscape) and (max-width: $breakpointMd) {
|
||||
font-size: calc(0.75rem + 0.4vw);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
|
||||
<div class="generator_cargo">
|
||||
<button
|
||||
v-for="(cargoArray, cargoName) in store.stockData?.generator.cargo"
|
||||
:key="cargoName"
|
||||
v-for="cargo in computedCargoData"
|
||||
:key="cargo.name"
|
||||
class="btn"
|
||||
:data-chosen="chosenCargoTypes.includes(cargoName.toString())"
|
||||
@click="toggleCargoChosen(cargoName.toString(), cargoArray)"
|
||||
:data-chosen="chosenCargoTypes.includes(cargo.name)"
|
||||
@click="toggleCargoChosen(cargo.name, cargo.cargoList)"
|
||||
>
|
||||
{{ $t(`cargo.${cargoName}`) }}
|
||||
{{ $t(`cargo.${cargo.name}`) }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -129,6 +129,19 @@ export default defineComponent({
|
||||
computedChosenCarTypes() {
|
||||
return new Set<string>(this.chosenCarTypes.slice().sort((c1, c2) => (c1 > c2 ? 1 : -1)));
|
||||
},
|
||||
|
||||
computedCargoData() {
|
||||
if (!this.store.stockData?.generator.cargo) return [];
|
||||
|
||||
const cargoGeneratorData = this.store.stockData.generator.cargo;
|
||||
|
||||
return Object.keys(cargoGeneratorData)
|
||||
.sort((v1, v2) => this.$t(`cargo.${v1}`).localeCompare(this.$t(`cargo.${v2}`)))
|
||||
.map((v) => ({
|
||||
name: v,
|
||||
cargoList: cargoGeneratorData[v],
|
||||
}));
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
<template>
|
||||
<div class="stock_thumbnails" ref="thumbnailsRef">
|
||||
<div class="stock-thumbnails" ref="thumbnailsRef">
|
||||
<div
|
||||
class="thumbnail-item"
|
||||
v-for="(stock, stockIndex) in store.stockList"
|
||||
:key="stockIndex"
|
||||
:data-selected="store.chosenStockListIndex == stockIndex"
|
||||
:data-sponsor="stock.isSponsorsOnly"
|
||||
draggable="true"
|
||||
@dragstart="onDragStart(stockIndex)"
|
||||
@drop="onDrop($event, stockIndex)"
|
||||
@dragover="allowDrop"
|
||||
@click="onListItemClick(stockIndex)"
|
||||
>
|
||||
<span @click="onListItemClick(stockIndex)" :key="stock.id">
|
||||
<b :class="{ sponsor: stock.isSponsorsOnly }">
|
||||
{{ stock.type }}
|
||||
</b>
|
||||
<b>
|
||||
{{ stock.type }}
|
||||
</b>
|
||||
|
||||
<span>
|
||||
<img
|
||||
draggable="false"
|
||||
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stock.type}.png`"
|
||||
:alt="stock.type"
|
||||
:title="stock.type"
|
||||
@error="stockImageError($event, stock)"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<img
|
||||
draggable="false"
|
||||
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stock.type}.png`"
|
||||
:alt="stock.type"
|
||||
:title="stock.type"
|
||||
@error="stockImageError($event, stock)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -87,41 +86,45 @@ const allowDrop = (e: DragEvent) => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.stock_thumbnails {
|
||||
.stock-thumbnails {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
background-color: #353a57;
|
||||
}
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
cursor: pointer;
|
||||
min-height: 100px;
|
||||
.thumbnail-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&[data-selected='true'] {
|
||||
background-color: rebeccapurple;
|
||||
}
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
|
||||
> span {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
padding: 0.5em 0;
|
||||
padding-top: 0.5em;
|
||||
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
min-height: 100px;
|
||||
font-size: 0.85em;
|
||||
|
||||
font-size: 0.85em;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
}
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
&[data-selected='true'] {
|
||||
background-color: rebeccapurple;
|
||||
}
|
||||
|
||||
b {
|
||||
color: #ccc;
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
&[data-sponsor='true'] > b {
|
||||
color: salmon;
|
||||
}
|
||||
|
||||
img {
|
||||
max-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
.sponsor {
|
||||
color: salmon;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,6 +5,10 @@ export type SpeedLimitLocoType = keyof typeof speedLimits;
|
||||
export type MassLimitLocoType = keyof typeof massLimits;
|
||||
|
||||
export function calculateSpeedLimit(locoType: SpeedLimitLocoType, stockMass: number, isTrainPassenger: boolean) {
|
||||
console.log(speedLimits[locoType]);
|
||||
|
||||
if (speedLimits[locoType] === undefined) return 0;
|
||||
|
||||
const speedTable = speedLimits[locoType][isTrainPassenger ? 'passenger' : 'cargo'];
|
||||
|
||||
if (!speedTable) return undefined;
|
||||
@@ -16,7 +20,7 @@ export function calculateSpeedLimit(locoType: SpeedLimitLocoType, stockMass: num
|
||||
}
|
||||
|
||||
export function calculateMassLimit(locoType: MassLimitLocoType, isTrainPassenger: boolean) {
|
||||
if(massLimits[locoType] === undefined) return 0;
|
||||
|
||||
if (massLimits[locoType] === undefined) return 0;
|
||||
|
||||
return massLimits[locoType][isTrainPassenger ? 0 : 1] || 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user