remove dispatched changes and re-order layers

ref #5587
This commit is contained in:
Max Grossman
2018-12-19 11:54:39 -05:00
parent 3755951009
commit 399e7781c1
3 changed files with 7 additions and 10 deletions
+3 -6
View File
@@ -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;
};
+2 -2
View File
@@ -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) }
];
+2 -2
View File
@@ -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;
});
});