chore: added hiding rolling stock preview on hover

This commit is contained in:
2026-03-15 23:18:36 +01:00
parent dc0b0315e0
commit f7499fe431
5 changed files with 15 additions and 8 deletions
@@ -63,7 +63,7 @@
</div> </div>
</transition> </transition>
<StockList :trainStockList="chosenTrain.stockList" :key="chosenTrain.id" /> <StockList :trainStockList="chosenTrain.stockList" :key="chosenTrain.id" :showPreviews="true" />
<TrainSchedule :train="chosenTrain" /> <TrainSchedule :train="chosenTrain" />
</div> </div>
</template> </template>
+3 -1
View File
@@ -7,6 +7,7 @@
:vehicle-string="vehicleString" :vehicle-string="vehicleString"
:images="images" :images="images"
:image-fallbacks="imagesFallbacks" :image-fallbacks="imagesFallbacks"
:show-previews="showPreviews"
/> />
</li> </li>
</ul> </ul>
@@ -23,7 +24,8 @@ export default defineComponent({
props: { props: {
trainStockList: { type: Array as PropType<string[]>, required: true }, trainStockList: { type: Array as PropType<string[]>, required: true },
tractionOnly: { type: Boolean, required: false } tractionOnly: { type: Boolean, required: false },
showPreviews: { type: Boolean }
}, },
data() { data() {
+9 -5
View File
@@ -11,7 +11,8 @@
:src="`https://stacjownik.spythere.eu/static/thumbnails/${thumbnailImage}.png`" :src="`https://stacjownik.spythere.eu/static/thumbnails/${thumbnailImage}.png`"
height="70" height="70"
loading="lazy" loading="lazy"
data-tooltip-type="VehiclePreviewTooltip" :data-crosshair-cursor="showPreviews"
:data-tooltip-type="showPreviews ? 'VehiclePreviewTooltip' : ''"
:data-tooltip-content="vehicleString" :data-tooltip-content="vehicleString"
@error="onImageError($event, imageFallbacks[imageIndex])" @error="onImageError($event, imageFallbacks[imageIndex])"
@load="onImageLoad" @load="onImageLoad"
@@ -20,13 +21,14 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType, Ref, ref } from 'vue'; import { computed, PropType, Ref, ref } from 'vue';
const props = defineProps({ const props = defineProps({
vehicleString: { type: String, required: true }, vehicleString: { type: String, required: true },
images: { type: Object as PropType<string[]>, required: true }, images: { type: Object as PropType<string[]>, required: true },
imageFallbacks: { type: Object as PropType<string[]>, required: true } imageFallbacks: { type: Object as PropType<string[]>, required: true },
showPreviews: { type: Boolean }
}); });
const thumbRef = ref(null) as Ref<HTMLElement | null>; const thumbRef = ref(null) as Ref<HTMLElement | null>;
@@ -74,8 +76,10 @@ function onImageLoad() {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: flex-end; align-items: flex-end;
cursor: crosshair;
padding: 0.5em 0; padding: 0.5em 0;
&[data-crosshair-cursor='true'] {
cursor: crosshair;
}
} }
</style> </style>
@@ -129,6 +129,7 @@
: stockHistory[currentHistoryIndex].stockString : stockHistory[currentHistoryIndex].stockString
).split(';') ).split(';')
" "
:showPreviews="true"
/> />
</div> </div>
</div> </div>
+1 -1
View File
@@ -4,7 +4,7 @@
<TrainInfo :train="train" /> <TrainInfo :train="train" />
<div class="train-stats"> <div class="train-stats">
<StockList :trainStockList="train.stockList" :tractionOnly="true" /> <StockList :trainStockList="train.stockList" :tractionOnly="true" :showPreviews="true" />
<div> <div>
<span>{{ train.speed }}km/h</span> <span>{{ train.speed }}km/h</span>