Comments (7)
Since I don't know about your requirements, why don't you add it and send a pull request which we then can discuss?
from leaflet-locatecontrol.
I second this request. I just ran into a need for being able to parse the data that results from the location found event. In my particular case, I'm going to push the resulting lat/long through the mapbox geocoder so i can display country/province/city.
Since Locate is being created with L.Control.extend() then I guess we should see how things like the geocoder enable the .on() function so events like 'found' fire events.
from leaflet-locatecontrol.
@wraybowling in your case, you can just subscribe to the location found even on the map. It sounds like to don't want to change the logic of the locate control.
from leaflet-locatecontrol.
Could you provide an example? I thought I understood what you meant, but then I broke my fiddle. http://jsfiddle.net/rgbk/JgmE3/11/
from leaflet-locatecontrol.
I'm not sure if you figured this out or not. So I will try to help if I can.
You had:
var map = L.mapbox.map('map', mapboxString)
.addControl(
L.mapbox.geocoderControl(mapboxString, {})
.on('select',displayResults)
.on('found',displayResults)
)
.addControl(
L.control.locate().on('found', displayResults)
)
;
I believe you want:
var map = L.mapbox.map('map', mapboxString)
.addControl(
L.mapbox.geocoderControl(mapboxString, {})
.on('select',displayResults)
.on('found',displayResults)
)
.addControl(
L.control.locate()
).on('locationfound', displayResults)
;
This is because the event fires on the map object not the locate control. Hopefully this was helpful.
from leaflet-locatecontrol.
Thanks @gmccrackin. I'm not sure what the right thing is so I fired the events on the map. If that is not the standard, it might be worth changing.
from leaflet-locatecontrol.
Yeah I think firing it on the map is the standard for this.
from leaflet-locatecontrol.
Related Issues (20)
- InitialZoomLevel HOT 3
- Allow to set speed of "flyTo" animation HOT 3
- How can I put compass on the specified location on map HOT 1
- stopFollowing method throws error
- `role="button"` on the control HOT 2
- Icon in dark mode HOT 3
- GPS Altitude HOT 1
- Warning: "listener not found" for leaflet 1.8.0 HOT 1
- ES module support? HOT 1
- flyTo and untilPanOrZoom combination breaks following
- markerClass and LocationMarker HOT 1
- Dropping Mapbox.js support? HOT 2
- calling stopLocate on null
- locateOptions (eg: keepCurrentZoomLevel) Not Working
- Compass displayed even when needing calibration HOT 1
- Not finding location in Chrome & Firefox for Mobile HOT 5
- Display lat, lng, alt in the inner marker popup
- CSS missing if installing with npm HOT 6
- Custom icons no longer support color status indicators
- Request: Add speed and track information HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet-locatecontrol.