From 6d5222ceb450daaaa842a6ae65136b071d80f4a1 Mon Sep 17 00:00:00 2001 From: Nikola Plesa Date: Fri, 31 Jul 2020 16:37:05 +0200 Subject: [PATCH] fix: fix warnings and update detection tags --- modules/services/mapillary.js | 20 ++++++++++---------- modules/svg/mapillary_images.js | 1 - modules/svg/mapillary_map_features.js | 7 ++++++- modules/svg/mapillary_position.js | 4 ++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index 2011d0469..cafde4f5f 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -47,7 +47,6 @@ var _mlyClicks; var _mlySelectedImage; var _mlySelectedImageKey; var _mlyViewer; -var _mlyViewerFilter = ['all']; var _mlyHighlightedDetection; var _mlyShowFeatureDetections = false; var _mlyShowSignDetections = false; @@ -523,7 +522,7 @@ export default { if (imageKey) { hash.photo = imageKey; } else { - delete hash.photo + delete hash.photo; } window.location.replace('#' + utilQsString(hash, true)); } @@ -750,7 +749,7 @@ export default { loadData('image_detections', url) .then(() => { showDetections(_mlyCache.image_detections.forImageKey[imageKey] || []); - }) + }); } else { showDetections(_mlyCache.image_detections.forImageKey[imageKey]); } @@ -769,18 +768,19 @@ export default { var valueParts = data.value.split('--'); if (!valueParts.length) return; - var text = valueParts[1]; - if (text === 'flat' || text === 'discrete' || text === 'sign' || text === 'traffic-light') { - text = valueParts[2]; - } - text = text.replace(/-/g, ' '); - text = text.charAt(0).toUpperCase() + text.slice(1) + var tag; - + var text; var color = 0xffffff; if (_mlyHighlightedDetection === data.key) { color = 0xffff00; + text = valueParts[1]; + if (text === 'flat' || text === 'discrete' || text === 'sign' || text === 'traffic-light') { + text = valueParts[2]; + } + text = text.replace(/-/g, ' '); + text = text.charAt(0).toUpperCase() + text.slice(1); _mlyHighlightedDetection = null; } diff --git a/modules/svg/mapillary_images.js b/modules/svg/mapillary_images.js index 07c1af1db..0bd7f4233 100644 --- a/modules/svg/mapillary_images.js +++ b/modules/svg/mapillary_images.js @@ -154,7 +154,6 @@ export function svgMapillaryImages(projection, context, dispatch) { var showViewfields = (z >= minViewfieldZoom); var service = getService(); - var selectedKey = service && service.getSelectedImageKey(); var sequences = (service ? service.sequences(projection) : []); var images = (service && showMarkers ? service.images(projection) : []); diff --git a/modules/svg/mapillary_map_features.js b/modules/svg/mapillary_map_features.js index d31300bfa..b69ca9403 100644 --- a/modules/svg/mapillary_map_features.js +++ b/modules/svg/mapillary_map_features.js @@ -68,10 +68,15 @@ export function svgMapillaryMapFeatures(projection, context, dispatch) { d.detections.forEach(function(detection) { if (!imageKey || selectedImageKey === detection.image_key) { imageKey = detection.image_key; - highlightedDetection = detection + highlightedDetection = detection; } }); + if (imageKey === selectedImageKey) { + service + .highlightDetection(highlightedDetection) + .selectImage(context, imageKey); + } service .highlightDetection(highlightedDetection) .updateViewer(context, imageKey) diff --git a/modules/svg/mapillary_position.js b/modules/svg/mapillary_position.js index a606cd3c5..1b003331f 100644 --- a/modules/svg/mapillary_position.js +++ b/modules/svg/mapillary_position.js @@ -5,7 +5,7 @@ import { svgPointTransform } from './helpers'; import { services } from '../services'; -export function svgMapillaryPosition(projection, context, dispatch) { +export function svgMapillaryPosition(projection, context) { var throttledRedraw = _throttle(function () { update(); }, 1000); var minZoom = 12; var minViewfieldZoom = 18; @@ -157,7 +157,7 @@ export function svgMapillaryPosition(projection, context, dispatch) { } - drawImages.enabled = function(_) { + drawImages.enabled = function() { update(); return this; };