From f002df54936e7892d9a4265b3f90cb2ea53b3b9d Mon Sep 17 00:00:00 2001 From: Nikola Plesa Date: Mon, 3 Aug 2020 14:30:51 +0200 Subject: [PATCH] feat: traffic sign highlighting --- modules/services/mapillary.js | 2 +- modules/svg/mapillary_map_features.js | 9 +++++---- modules/svg/mapillary_signs.js | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index cafde4f5f..91c581757 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -776,7 +776,7 @@ export default { if (_mlyHighlightedDetection === data.key) { color = 0xffff00; text = valueParts[1]; - if (text === 'flat' || text === 'discrete' || text === 'sign' || text === 'traffic-light') { + if (text === 'flat' || text === 'discrete' || text === 'sign') { text = valueParts[2]; } text = text.replace(/-/g, ' '); diff --git a/modules/svg/mapillary_map_features.js b/modules/svg/mapillary_map_features.js index 13e2bcdf8..f171db129 100644 --- a/modules/svg/mapillary_map_features.js +++ b/modules/svg/mapillary_map_features.js @@ -76,11 +76,12 @@ export function svgMapillaryMapFeatures(projection, context, dispatch) { service .highlightDetection(highlightedDetection) .selectImage(context, imageKey); + } else { + service + .highlightDetection(highlightedDetection) + .updateViewer(context, imageKey) + .showViewer(context); } - service - .highlightDetection(highlightedDetection) - .updateViewer(context, imageKey) - .showViewer(context); } diff --git a/modules/svg/mapillary_signs.js b/modules/svg/mapillary_signs.js index d46615d26..0c7d2e978 100644 --- a/modules/svg/mapillary_signs.js +++ b/modules/svg/mapillary_signs.js @@ -62,19 +62,26 @@ export function svgMapillarySigns(projection, context, dispatch) { var selectedImageKey = service.getSelectedImageKey(); var imageKey; - + var highlightedDetection; // Pick one of the images the sign was detected in, // preference given to an image already selected. d.detections.forEach(function(detection) { if (!imageKey || selectedImageKey === detection.image_key) { imageKey = detection.image_key; + highlightedDetection = detection; } }); - service - .highlightDetection(d) - .updateViewer(context, imageKey) - .showViewer(context); + if (imageKey === selectedImageKey) { + service + .highlightDetection(highlightedDetection) + .selectImage(context, imageKey); + } else { + service + .highlightDetection(highlightedDetection) + .updateViewer(context, imageKey) + .showViewer(context); + } }