Skip to content

Commit acba654

Browse files
committed
highlight onclick-target only if not onclick=false
1 parent 08452c6 commit acba654

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

app/javascript/maplibre/animations.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { map, mapProperties } from 'maplibre/map'
2-
import { resetControls } from 'maplibre/controls/shared'
3-
import { highlightFeature } from 'maplibre/feature'
4-
import * as functions from 'helpers/functions'
5-
import { status } from 'helpers/status'
6-
import { length } from "@turf/length"
7-
import { point } from "@turf/helpers"
8-
import distance from "@turf/distance"
91
import { along } from "@turf/along"
102
import { centroid } from "@turf/centroid"
11-
import { getFeatureSource } from 'maplibre/layers/layers'
3+
import distance from "@turf/distance"
4+
import { point } from "@turf/helpers"
5+
import { length } from "@turf/length"
6+
import * as functions from 'helpers/functions'
7+
import { status } from 'helpers/status'
8+
import { resetControls } from 'maplibre/controls/shared'
9+
import { highlightFeature } from 'maplibre/feature'
1210
import { renderGeoJSONLayers } from 'maplibre/layers/geojson'
11+
import { getFeatureSource } from 'maplibre/layers/layers'
12+
import { map, mapProperties } from 'maplibre/map'
1313

1414
export class AnimationManager {
1515
constructor () {
@@ -76,7 +76,7 @@ export class AnimatePointAnimation extends AnimationManager {
7676

7777
export class AnimateLineAnimation extends AnimationManager {
7878
run = (line, follow = true, steps=750) => {
79-
79+
8080
const lineLength = length(line, { units: "kilometers" })
8181
const stepLength = lineLength / (steps - 1)
8282
console.log('Line length: ' + lineLength + ' km, step length: ' + stepLength + ' km')
@@ -162,7 +162,9 @@ export function flyToFeature(feature) {
162162
console.log('Fly to: ' + feature.id + ' ' + center.geometry.coordinates)
163163
resetControls()
164164
map.once('moveend', function () {
165-
highlightFeature(feature, true, source)
165+
if (feature.properties?.onclick !== false) {
166+
highlightFeature(feature, true, source)
167+
}
166168
})
167169
map.flyTo({
168170
center: center.geometry.coordinates,

0 commit comments

Comments
 (0)