Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/data-management/src/components/Maps/OpenLayersMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ let selectedThingTransitionId = 0
let activeFlyId = 0
const vectorSource = new VectorSource<Feature>()
const markerLayer = ref<WebGLVectorLayer>()
const DEFAULT_MARKER_OPACITY = 0.85

// ── Browse-style selection (only used when `selectable`) ──
const detailThing = ref<MapThing>()
Expand Down Expand Up @@ -272,6 +273,7 @@ const createFeature = (thing: MapThingWithColor) => {
geometry: new Point(fromLonLat([longitude, latitude])),
})
f.set('markerColor', thing?.color?.background || '#D32F2F')
f.set('markerOpacity', DEFAULT_MARKER_OPACITY)
f.set('thing', thing)
return f
}
Expand Down Expand Up @@ -354,6 +356,12 @@ const animateSelectionScale = (from: number, to: number, duration = 180) => {

const updateSelectionMarker = (thingId?: string | null) => {
selectionSource.clear()
// The enlarged selection marker replaces the base marker instead of
// stacking on top of its semi-opaque pixels.
vectorSource.getFeatures().forEach((feature) => {
const isSelected = getFeatureThing(feature)?.id === thingId
feature.set('markerOpacity', isSelected ? 0 : DEFAULT_MARKER_OPACITY)
})
if (!thingId) {
selectedSiteLabel.value = ''
selectionLabelOverlay?.setPosition(undefined)
Expand Down Expand Up @@ -610,7 +618,7 @@ const initializeMap = () => {
'icon-height': ['interpolate', ['linear'], ['zoom'], 1, 4, 8, 32, 16, 48],
'icon-anchor': [0.5, 1],
'icon-color': ['get', 'markerColor'],
'icon-opacity': 0.85,
'icon-opacity': ['get', 'markerOpacity'],
},
})

Expand Down Expand Up @@ -648,6 +656,7 @@ const initializeMap = () => {
vectorSource.clear()
const single = new Feature(new Point(evt.coordinate))
single.set('markerColor', '#D32F2F')
single.set('markerOpacity', DEFAULT_MARKER_OPACITY)
vectorSource.addFeature(single)

const [lon, lat] = toLonLat(evt.coordinate)
Expand Down
Loading