Fixed Typescript errors

This commit is contained in:
Fabio Manganiello 2025-03-10 02:33:16 +01:00
parent b5b1e03e35
commit 89d2e83298
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -133,7 +133,7 @@ export default {
queryInitialized: false, queryInitialized: false,
refreshPoints: 0, refreshPoints: 0,
routesLayer: null as Optional<VectorLayer>, routesLayer: null as Optional<VectorLayer>,
selectedFeature: null as Optional<Point>, selectedFeature: null as Optional<Feature>,
selectedPoint: null as Optional<GPSPoint>, selectedPoint: null as Optional<GPSPoint>,
showControls: false, showControls: false,
showMetrics: new TimelineMetricsConfiguration(), showMetrics: new TimelineMetricsConfiguration(),
@ -181,7 +181,7 @@ export default {
try { try {
this.deletePoints([this.pointToRemove]) this.deletePoints([this.pointToRemove])
if (this.selectedFeature) { if (this.selectedFeature) {
const routeFeatures = this.routesLayer?.getSource().getFeatures().filter((f: Feature) => { const routeFeatures = this.routesLayer?.getSource()?.getFeatures()?.filter((f: Feature) => {
const [start, end] = (f.getGeometry() as any).getCoordinates() const [start, end] = (f.getGeometry() as any).getCoordinates()
return ( return (
( (
@ -194,11 +194,11 @@ export default {
) )
}) })
if (routeFeatures.length) { if (routeFeatures?.length) {
this.routesLayer?.getSource().removeFeatures(routeFeatures) this.routesLayer?.getSource()?.removeFeatures(routeFeatures)
} }
this.pointsLayer?.getSource().removeFeature(this.selectedFeature) this.pointsLayer?.getSource()?.removeFeature(this.selectedFeature)
} }
this.gpsPoints = this.gpsPoints.filter((p: GPSPoint) => p.id !== this.pointToRemove?.id) this.gpsPoints = this.gpsPoints.filter((p: GPSPoint) => p.id !== this.pointToRemove?.id)
@ -213,7 +213,6 @@ export default {
onRemove(point: GPSPoint) { onRemove(point: GPSPoint) {
this.pointToRemove = point this.pointToRemove = point
this.$emit('remove', this.point)
}, },
fetchNextPage() { fetchNextPage() {
@ -273,7 +272,7 @@ export default {
const feature = map.forEachFeatureAtPixel(event.pixel, (feature) => feature) const feature = map.forEachFeatureAtPixel(event.pixel, (feature) => feature)
if (feature) { if (feature) {
this.selectedFeature = feature this.selectedFeature = feature as Feature
const point = this.gpsPoints.find((gps: GPSPoint) => { const point = this.gpsPoints.find((gps: GPSPoint) => {
const [longitude, latitude] = (feature.getGeometry() as any).getCoordinates() const [longitude, latitude] = (feature.getGeometry() as any).getCoordinates()
return gps.longitude === longitude && gps.latitude === latitude return gps.longitude === longitude && gps.latitude === latitude