-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5587 - make geolocation show geolocation #5629
Conversation
looks good! Just reorder the layers and I can merge 👍 |
.remove(); | ||
|
||
var layerEnter = layer.enter() | ||
.append('g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than just appending it here, I think it might make more sense to insert it before the touch layer, so that clicks on osm objects will still work. something like: insert('g', '.data-layer.touch')
Forget what I said here.. If layer-geolocate
is before layer-touch
you can append the circle to it.
modules/svg/geolocate.js
Outdated
import _throttle from 'lodash-es/throttle'; | ||
|
||
export function svgGeolocate(projection, context, dispatch) { | ||
var throttledRedraw = _throttle(function () { dispatch.call('change'); }, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure but I don't think this code should ever need to dispatch change
.. This forces everything to redraw. Maybe this code could maintain its own timer to refresh the location circle sometimes.
modules/svg/layers.js
Outdated
@@ -32,7 +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: 'touch', layer: svgTouch(projection, context, dispatch) }, | |||
{ id: 'geolocate', layer: svgGeolocate(projection, context, dispatch) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool I see now.. Yeah geolocate should be before touch I think, so it doesn't steal the user's mouse clicks.
test/spec/svg/layers.js
Outdated
@@ -36,6 +36,7 @@ describe('iD.svgLayers', function () { | |||
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
Thanks @maxgrossman 👍 |
the 'puck' radius is geolocation response's accuracy (in meters)
closes #5587