Fixed tsc errors and warnings.

This commit is contained in:
Fabio Manganiello 2025-02-26 03:21:26 +01:00
parent a833d43586
commit 2e642775df
Signed by: blacklight
GPG key ID: D90FBA7F76362774
3 changed files with 19 additions and 6 deletions
frontend/src

View file

@ -50,7 +50,7 @@
<div class="timeline">
<Timeline :loading="loading"
:points="gpsPoints"
@point-hover="highlightPoint(pointsLayer, $event)" />
@point-hover="onTimelinePointHover" />
</div>
</div>
</main>
@ -227,6 +227,14 @@ export default {
this.locationQuery.minId = null
this.locationQuery.maxId = null
},
onTimelinePointHover(point: GPSPoint) {
if (!this.pointsLayer) {
return
}
this.highlightPoint(this.pointsLayer as VectorLayer, point)
},
},
watch: {

View file

@ -12,6 +12,7 @@
import {
CategoryScale,
Chart as ChartJS,
type ChartOptions,
LineElement,
LinearScale,
PointElement,
@ -68,7 +69,7 @@ export default {
}
},
graphOptions() {
graphOptions(): any {
return {
responsive: true,
maintainAspectRatio: false,

View file

@ -41,8 +41,8 @@ export default {
data() {
return {
metersTolerance: 20,
highlightedPointId: null,
highlightedFeature: null,
highlightedPointId: null as number | null,
highlightedFeature: null as Feature | null,
}
},
@ -170,8 +170,12 @@ export default {
})
},
highlightPoint(layer: VectorLayer, point: GPSPoint) {
const feature = layer.getSource().getClosestFeatureToCoordinate([point.longitude, point.latitude])
highlightPoint(layer: VectorLayer | null, point: GPSPoint) {
if (!layer) {
return
}
const feature = layer.getSource()?.getClosestFeatureToCoordinate([point.longitude, point.latitude])
if (feature) {
if (point.id === this.highlightedPointId) {
return