diff --git a/modules/svg/geolocate.js b/modules/svg/geolocate.js index 22ec4092f..f5ca10f97 100644 --- a/modules/svg/geolocate.js +++ b/modules/svg/geolocate.js @@ -5,7 +5,6 @@ import { geoMetersToLat } from '../geo'; import _throttle from 'lodash-es/throttle'; export function svgGeolocate(projection, context, dispatch) { - var throttledRedraw = _throttle(function () { dispatch.call('change'); }, 1000); var layer = d3_select(null); var _position; @@ -22,12 +21,10 @@ export function svgGeolocate(projection, context, dispatch) { function hideLayer() { - throttledRedraw.cancel(); layer .transition() .duration(250) - .style('opacity', 0) - .on('end', function () { }); + .style('opacity', 0); } function layerOn() { @@ -53,7 +50,8 @@ export function svgGeolocate(projection, context, dispatch) { projectedTangent = projection(tangentLoc), projectedLoc = projection([loc[0], loc[1]]); - return Math.round(projectedLoc[1] - projectedTangent[1]).toString(); // more south point will have higher pixel value... + // southern most point will have higher pixel value... + return Math.round(projectedLoc[1] - projectedTangent[1]).toString(); } function update() { @@ -131,7 +129,6 @@ export function svgGeolocate(projection, context, dispatch) { } else { hideLayer(); } - // dispatch.call('change'); return this; }; diff --git a/modules/svg/layers.js b/modules/svg/layers.js index b5663d778..4d0b9f7d2 100644 --- a/modules/svg/layers.js +++ b/modules/svg/layers.js @@ -33,8 +33,8 @@ export function svgLayers(projection, context) { { id: 'mapillary-signs', layer: svgMapillarySigns(projection, context, dispatch) }, { id: 'openstreetcam-images', layer: svgOpenstreetcamImages(projection, context, dispatch) }, { id: 'debug', layer: svgDebug(projection, context, dispatch) }, - { id: 'touch', layer: svgTouch(projection, context, dispatch) }, - { id: 'geolocate', layer: svgGeolocate(projection, context, dispatch) } + { id: 'geolocate', layer: svgGeolocate(projection, context, dispatch) }, + { id: 'touch', layer: svgTouch(projection, context, dispatch) } ]; diff --git a/test/spec/svg/layers.js b/test/spec/svg/layers.js index 46c2bfdbb..f2277229c 100644 --- a/test/spec/svg/layers.js +++ b/test/spec/svg/layers.js @@ -35,8 +35,8 @@ describe('iD.svgLayers', function () { expect(d3.select(nodes[5]).classed('mapillary-signs')).to.be.true; expect(d3.select(nodes[6]).classed('openstreetcam-images')).to.be.true; expect(d3.select(nodes[7]).classed('debug')).to.be.true; - expect(d3.select(nodes[8]).classed('touch')).to.be.true; - expect(d3.select(nodes[9]).classed('geolocate')).to.be.true; + expect(d3.select(nodes[8]).classed('geolocate')).to.be.true; + expect(d3.select(nodes[9]).classed('touch')).to.be.true; }); });