From f5eb4d2a519756aaec7755a8a7bec888fa45d549 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 15 Apr 2025 18:13:52 +0200 Subject: [PATCH] don't de-select map feature when clicking on a street level photo --- CHANGELOG.md | 1 + modules/behavior/select.js | 8 ++++++++ modules/services/kartaview.js | 1 + modules/services/mapilio.js | 1 + modules/services/mapillary.js | 3 +++ modules/services/panoramax.js | 1 + modules/services/streetside.js | 1 + modules/services/vegbilder.js | 1 + modules/svg/local_photos.js | 1 + 9 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78d333476..1a4d56191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :scissors: Operations #### :camera: Street-Level * Keep photo viewer open when disabling Panoramax overlay ([#10966]) +* Don't de-select map feature when clicking on a street level photo #### :white_check_mark: Validation * Show unchanged tags of a [deprecation rule](https://github.com/ideditor/schema-builder?tab=readme-ov-file#deprecations) explicitly in the validation warning ([#10104]) #### :bug: Bugfixes diff --git a/modules/behavior/select.js b/modules/behavior/select.js index 025c8bea7..ed90b1701 100644 --- a/modules/behavior/select.js +++ b/modules/behavior/select.js @@ -215,6 +215,11 @@ export function behaviorSelect(context) { } var targetDatum = lastEvent.target.__data__; + if (targetDatum === 0 && lastEvent.target.parentNode.__data__) { + // some targets (like markers of the street level photo + // layers) have the data bound to the parent node + targetDatum = lastEvent.target.parentNode.__data__; + } var multiselectEntityId; @@ -350,6 +355,9 @@ export function behaviorSelect(context) { .selectedErrorID(datum.id) .enter(modeSelectError(context, datum.id, datum.service)); + } else if (datum.service === 'photo') { + // street level photo was selected: + // don't change mode and selection } else { // targeting nothing context.selectedNoteID(null); diff --git a/modules/services/kartaview.js b/modules/services/kartaview.js index da289c0c4..359abc592 100644 --- a/modules/services/kartaview.js +++ b/modules/services/kartaview.js @@ -100,6 +100,7 @@ function loadNextTilePage(which, currZoom, url, tile) { if (which === 'images') { d = { + service: 'photo', loc: loc, key: item.id, ca: +item.heading, diff --git a/modules/services/mapilio.js b/modules/services/mapilio.js index f25a381f8..10582aff3 100644 --- a/modules/services/mapilio.js +++ b/modules/services/mapilio.js @@ -140,6 +140,7 @@ function loadTileDataToCache(data, tile) { let isPano = sourceWidth % sourceHeight === 0; const d = { + service: 'photo', loc: loc, capture_time: feature.properties.capture_time, id: feature.properties.id, diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index 8e0c2fe32..595a244a4 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -105,6 +105,7 @@ function loadTileDataToCache(data, tile, which) { feature = layer.feature(i).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]); loc = feature.geometry.coordinates; d = { + service: 'photo', loc: loc, captured_at: feature.properties.captured_at, ca: feature.properties.compass_angle, @@ -147,6 +148,7 @@ function loadTileDataToCache(data, tile, which) { loc = feature.geometry.coordinates; d = { + service: 'photo', loc: loc, id: feature.properties.id, first_seen_at: feature.properties.first_seen_at, @@ -172,6 +174,7 @@ function loadTileDataToCache(data, tile, which) { loc = feature.geometry.coordinates; d = { + service: 'photo', loc: loc, id: feature.properties.id, first_seen_at: feature.properties.first_seen_at, diff --git a/modules/services/panoramax.js b/modules/services/panoramax.js index ae5e8755d..214acc3ae 100644 --- a/modules/services/panoramax.js +++ b/modules/services/panoramax.js @@ -178,6 +178,7 @@ function loadTileDataToCache(data, tile, zoom) { loc = feature.geometry.coordinates; d = { + service: 'photo', loc: loc, capture_time: feature.properties.ts, capture_time_parsed: new Date(feature.properties.ts), diff --git a/modules/services/streetside.js b/modules/services/streetside.js index de6ac61fd..d5102a318 100644 --- a/modules/services/streetside.js +++ b/modules/services/streetside.js @@ -120,6 +120,7 @@ function loadNextTilePage(which, url, tile) { bubble.lat || bubble.latitude ]; const d = { + service: 'photo', loc: loc, key: bubbleId, imageUrl: bubble.imageUrl diff --git a/modules/services/vegbilder.js b/modules/services/vegbilder.js index 9506fa659..8f5355997 100644 --- a/modules/services/vegbilder.js +++ b/modules/services/vegbilder.js @@ -142,6 +142,7 @@ async function loadTile(cache, typename, tile) { const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10); const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward; const data = { + service: 'photo', loc, key, ca, diff --git a/modules/svg/local_photos.js b/modules/svg/local_photos.js index a1406e191..fb8e97f95 100644 --- a/modules/svg/local_photos.js +++ b/modules/svg/local_photos.js @@ -271,6 +271,7 @@ export function svgLocalPhotos(projection, context, dispatch) { try { const exifData = await exifr.parse(file); // eslint-disable-line no-await-in-loop const photo = { + service: 'photo', id: _idAutoinc++, name: file.name, getSrc: () => readFileAsDataURL(file),