-
Notifications
You must be signed in to change notification settings - Fork 141
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
map pin bound to dynamic coordinates is not updating its position #33
Comments
Hi! You need to change the ref of
|
Hi @Wykks thanks for the quick reply, I'm not sure I'm understanding though. Are you able to make a modification to my code to explain? EDIT
I'm now trying to figure out how to combine mglDraggable with this so I can have both click and drag to move the marker around, however there's no documentation (that I can find) on mglDraggable. This may not be something to discuss here so feel free to close this. |
You can't just mutate the object. By changing the ref, I mean that you have to create a new object. For example like that in es6 :
https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/ But it's doesn't work well (that's why it's undocumented). (mapbox/mapbox-gl-js#5187) Draggin a Marker seems a better option that dragging a layer (also see mapbox/mapbox-gl-js#3087) You should be able to implement that yourself. Just listen to 'mouseenter' => 'mousedown' => 'mousemove' and update the coord of the marker at 'mouseup' or 'mousemove'. |
Ok I understand now, thanks so much for the explanation! |
Most of the event are the |
|
The title describes fairly accurately what I'm experiencing. I would like to be able to click on a map and have a map marker move to that location.
Here's my template:
Here's the important bits from my controller:
When I click on the map the object coordinates property is being updated, this can be confirmed by seeing the template binding
{{pickerLocation.geometry.coordinates}}
updating, however the markers position isn't changing at all.I've tried replacing the mgl-marker data source to a plain array or object, instead of a Feature. However this is having the same effect (the pin doesn't move on click).
The text was updated successfully, but these errors were encountered: