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

View file

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

View file

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