From 0eac0ff862e05919be530a1d340e3909cc4fbf22 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 27 May 2016 22:42:46 -0400 Subject: [PATCH] Don't show thumbnail when hovering over Mapillary markers --- js/id/services/mapillary.js | 4 ++++ js/id/svg/mapillary_images.js | 25 ++++++------------------- js/id/svg/mapillary_signs.js | 26 +++++++------------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/js/id/services/mapillary.js b/js/id/services/mapillary.js index 06e4461a0..f236626c0 100644 --- a/js/id/services/mapillary.js +++ b/js/id/services/mapillary.js @@ -267,11 +267,15 @@ iD.services.mapillary = function() { if (iD.services.mapillary) { iD.services.mapillary.thumb = null; } + d3.select('#content').selectAll('.mapillary-image') .classed('hidden', true); + d3.select('#content').selectAll('.mly-wrapper') .classed('active', false); + d3.selectAll('.layer-mapillary-images .viewfield-group, .layer-mapillary-signs .icon-sign') + .classed('selected', false); }; mapillary.killThumbnail = function() { diff --git a/js/id/svg/mapillary_images.js b/js/id/svg/mapillary_images.js index 0ab0c59a0..8e484fb0b 100644 --- a/js/id/svg/mapillary_images.js +++ b/js/id/svg/mapillary_images.js @@ -158,35 +158,22 @@ iD.svg.MapillaryImages = function(projection, context, dispatch) { .append('g') .attr('class', 'layer-mapillary-images') .style('display', enabled ? 'block' : 'none') - .on('click', function() { // deselect/select + .on('click', function() { var mapillary = getMapillary(); if (!mapillary) return; + var d = d3.event.target.__data__, thumb = mapillary.selectedThumbnail(); - if (thumb && thumb.key === d.key) { - removeThumbnail(); - } else if (_mlyLoading) { + + if (thumb && thumb.key === d.key) return; + + if (_mlyLoading) { showLoading(d); } else { mapillary.selectedThumbnail(d); context.map().centerEase(d.loc); showThumbnail(d, true); } - }) - .on('mouseover', function() { - var mapillary = getMapillary(); - if (!mapillary) return; - showThumbnail(d3.event.target.__data__); - }) - .on('mouseout', function() { - var mapillary = getMapillary(); - if (!mapillary) return; - var thumb = mapillary.selectedThumbnail(); - if (thumb) { - showThumbnail(thumb, true); - } else { - removeThumbnail(); - } }); layer.exit() diff --git a/js/id/svg/mapillary_signs.js b/js/id/svg/mapillary_signs.js index 604c19f43..a5de4efb8 100644 --- a/js/id/svg/mapillary_signs.js +++ b/js/id/svg/mapillary_signs.js @@ -84,28 +84,16 @@ iD.svg.MapillarySigns = function(projection, context, dispatch) { .html(mapillary.signHTML); enter - .on('click', function(d) { // deselect/select + .on('click', function(d) { var mapillary = getMapillary(); if (!mapillary) return; + var thumb = mapillary.selectedThumbnail(); - if (thumb && thumb.key === d.key) { - hideThumbnail(); - } else { - mapillary.selectedThumbnail(d); - context.map().centerEase(d.loc); - showThumbnail(d, true); - } - }) - .on('mouseover', showThumbnail) - .on('mouseout', function() { - var mapillary = getMapillary(); - if (!mapillary) return; - var thumb = mapillary.selectedThumbnail(); - if (thumb) { - showThumbnail(thumb, true); - } else { - hideThumbnail(); - } + if (thumb && thumb.key === d.key) return; + + mapillary.selectedThumbnail(d); + context.map().centerEase(d.loc); + showThumbnail(d, true); }); // Exit