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

TimeDimension compatibility with Leaflet 1.0 beta 1 #5

Closed
ClaudioCas opened this issue Sep 4, 2015 · 3 comments
Closed

TimeDimension compatibility with Leaflet 1.0 beta 1 #5

ClaudioCas opened this issue Sep 4, 2015 · 3 comments

Comments

@ClaudioCas
Copy link

Dear developer,
thanks a lot for your great plugin.
Do you plan to add support for Leaflet 1.0 beta 1 to TimeDimension?
I try to upgrade the js in your example but I give an "callback not define" error in javascript into the main leaflet code.
Thanks a lot
Claudio

@bielfrontera
Copy link
Contributor

Hi Claudio,
thanks for your comment.

I've checked the plugin with leaflet-1.0.0-b1, and I get the same error, provoked because the custom layer implemented in TimeDimension does not have the method _layerAdd. According to the new documentation, now custom layers should extend L.Layer instead of L.Class.

So, I've changed

L.TimeDimension.Layer = L.Class.extend({

by

var baseClass = L.Layer || L.Class;
L.TimeDimension.Layer = baseClass.extend({

in https://github.com/socib/Leaflet.TimeDimension/blob/master/src/leaflet.timedimension.layer.js#L8, and our examples seem to work fine with leaflet-1.0.0-b1 and leaflet-0.7.3.

I will commit the changes in a few days, but I'm not sure this is the best solution to work with old and new releases of Leaflet. @mourner, could you give us some advice? Thanks!

@mourner
Copy link

mourner commented Sep 6, 2015

(L.Layer || L.Class).extend(...) is how I did this in my own plugins :)

@ClaudioCas
Copy link
Author

Thanks a lot. The patch works great and thanks for update the library!

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