From 99f7a9038778595bfe9b4384fcb593a8239a3511 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 27 Jan 2019 14:44:57 +0000 Subject: [PATCH] Fix imagery layers resetting eachother's classes Fixes: - Selecting a bubble then enabling a second imagery layer removes the hovered and selected highlighting - If multiple imagery layers are enabled and you select a bubble it only temporarily becomes highlighted - If multiple imagery layers are enabled and a bubble is highlighted, hovering over another imagery layer's bubble will remove the selected and hovered highlighting Basically these all came down to style updates resetting all layers for cases other than when the viewport was changed (where doing so makes sense because the selected bubble/sequence needs to update as a result). See #5494 --- modules/services/mapillary.js | 3 +++ modules/services/openstreetcam.js | 3 +++ modules/services/streetside.js | 6 +++--- modules/svg/mapillary_images.js | 1 + modules/svg/streetside.js | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index 5e13da7b2..dcd6762ba 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -556,6 +556,9 @@ export default { }, + // Updates the currently highlighted sequence and selected bubble. + // Reset is only necessary when interacting with the viewport because + // this implicitly changes the currently selected bubble/sequence setStyles: function(hovered, reset) { if (reset) { // reset all layers d3_selectAll('.viewfield-group') diff --git a/modules/services/openstreetcam.js b/modules/services/openstreetcam.js index 4f1d180bc..2c683471c 100644 --- a/modules/services/openstreetcam.js +++ b/modules/services/openstreetcam.js @@ -492,6 +492,9 @@ export default { }, + // Updates the currently highlighted sequence and selected bubble. + // Reset is only necessary when interacting with the viewport because + // this implicitly changes the currently selected bubble/sequence setStyles: function(hovered, reset) { if (reset) { // reset all layers d3_selectAll('.viewfield-group') diff --git a/modules/services/streetside.js b/modules/services/streetside.js index a7bdf4eb4..c7908a7ad 100644 --- a/modules/services/streetside.js +++ b/modules/services/streetside.js @@ -925,9 +925,9 @@ export default { }, - /** - * setStyles(). - */ + // Updates the currently highlighted sequence and selected bubble. + // Reset is only necessary when interacting with the viewport because + // this implicitly changes the currently selected bubble/sequence setStyles: function (hovered, reset) { if (reset) { // reset all layers d3_selectAll('.viewfield-group') diff --git a/modules/svg/mapillary_images.js b/modules/svg/mapillary_images.js index 7eda83646..0adc739f9 100644 --- a/modules/svg/mapillary_images.js +++ b/modules/svg/mapillary_images.js @@ -205,6 +205,7 @@ export function svgMapillaryImages(projection, context, dispatch) { .attr('transform', 'scale(1.5,1.5),translate(-8, -13)') .attr('d', viewfieldPath); + function viewfieldPath() { var d = this.parentNode.__data__; if (d.pano) { diff --git a/modules/svg/streetside.js b/modules/svg/streetside.js index 5884ed76d..cf3ddae11 100644 --- a/modules/svg/streetside.js +++ b/modules/svg/streetside.js @@ -122,7 +122,7 @@ export function svgStreetside(projection, context, dispatch) { function mouseover(d) { var service = getService(); _hoveredBubble = d; - if (service) service.setStyles(d, true); + if (service) service.setStyles(d); } /** @@ -131,7 +131,7 @@ export function svgStreetside(projection, context, dispatch) { function mouseout() { var service = getService(); _hoveredBubble = null; - if (service) service.setStyles(null, true); + if (service) service.setStyles(null); } /** @@ -253,7 +253,7 @@ export function svgStreetside(projection, context, dispatch) { if (service) { - service.setStyles(_hoveredBubble, true); + service.setStyles(_hoveredBubble); }