Skip to content
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

Draggable Marker not moving #32

Closed
eduboxgithub opened this issue Dec 11, 2018 · 7 comments
Closed

Draggable Marker not moving #32

eduboxgithub opened this issue Dec 11, 2018 · 7 comments

Comments

@eduboxgithub
Copy link

When a add a marker and set the property "draggable=true" the marker does not move when I'm testing on the device (Android).

import * as MapboxGLOffline from 'mapbox-gl-cordova-offline';

let marker = new MapboxGLOffline.Marker( { draggable: true })
                     .setLngLat(new MapboxGLOffline.LngLat(+coords.lng, +coords.lat))
                     .addTo(map);

Do I need to do something special?

Is it because the mapbox version?
It it possible to update it to the latest version 0.51?

@eduboxgithub
Copy link
Author

Don't know if this is correct but reading the changelog https://github.com/mapbox/mapbox-gl-js/blob/master/CHANGELOG.md the ability to drag markers was only introduced in 0.46.0:

mapbox/mapbox-gl-js#6687

How can we update the Mapbox version dependency?

@oscarfonts
Copy link
Owner

Have you tried to update the mapbox dependency and build the project?
A PR if succeeded, or any feedback in case of problems will be kindly appreciated. :)

@eduboxgithub
Copy link
Author

I was trying to make a few changes to update to 0.52, but I noticed there's already an PR with that change.

#36 (comment)

@michogar
Copy link
Collaborator

michogar commented Feb 5, 2019

Hi @eduboxgithub

yes, for a project I needed to update the library with a more updated version of Mapbox. Mapbox has changed a method in ajax.jx and now it cans load files using window.fetch api when this api is available In our case, Cordova webview has this API and Mapbox tries to use it. But the problem is that this API doesn't allow load files using protocol file:// which is used to load sprites and glyphs in this library. To avoid this I made a workaround setting the window.fetch = undefined but this is a very ugly and heavy hack because maybe another library could use this api and this change could break these other libraries.

I have made a fork of this repo and I have updated the library to use 0.52 mapbox version. You can test it here, the version updated is the v0.2.1

https://github.com/northings/mapbox-gl-cordova-offline

The inclusion of the use of window.fetchis from mapbox 0.49.version, so, if you couldn't include this ugly hack in your app you shouldn't update to a higher version of Mapbox.

There is a branch updated until mapbox 0.49 version here:

https://github.com/northings/mapbox-gl-cordova-offline/tree/feature/mapbox.v0.49.0

I am still thinking which could be the best way to avoid the problem with the use of window.fetch, but I haven't found an elegant solution yet.

Cheers!!.

@eduboxgithub
Copy link
Author

eduboxgithub commented Feb 11, 2019

@michogar Hello, thank you so much for your feedback.

I was doing some extra testing with the forks you provided, and I noticed a new version of mapbox was release (v0.53). I was reading their changelog and I think they fixed the issue regarding the fetch/file:// problem.

https://github.com/mapbox/mapbox-gl-js/blob/master/CHANGELOG.md

Allow file:// protocol in XHR requests for Cordova/Ionic/etc (#7818)

mapbox/mapbox-gl-js#7818

@michogar
Copy link
Collaborator

Cool!!, these are good news. I'll try to test the library with that version of Mapbox ASAP. If you advance in the integration of the latest Mapbox version, please, maybe could you make a PR?.

Thank you very much, and enjoy mapbox-gl-cordova-offline!!

@michogar
Copy link
Collaborator

Hi @eduboxgithub

I've just updated the library with the latest Mapbox GL JS version, 0.53.1. Please check if problems with markers disappear and we can closing the issue.

Best.

@michogar michogar closed this as completed May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants