Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Leaflet.label 0.2.4 is not compliant with leaflet 1.0.2 #166

Open
intersel opened this issue Apr 6, 2017 · 2 comments
Open

Leaflet.label 0.2.4 is not compliant with leaflet 1.0.2 #166

intersel opened this issue Apr 6, 2017 · 2 comments

Comments

@intersel
Copy link

intersel commented Apr 6, 2017

When we call showLabel as in the following example:

var p2 = L.polyline([
   [-37.7612, 175.2756],
   [-37.7612, 175.2950]
  ]).addTo(map);
  
    var label = new LeafletLabel({
   offset: [-12,-15],
  });
    label.setContent("20'-50'");
    label.setLatLng(p2.getBounds().getCenter());
    map.showLabel(label);

We get this following error:

leaflet-src-1.0.2.js:3602 Uncaught TypeError: Cannot read property 'call' of undefined
    at NewClass.whenReady (leaflet-src-1.0.2.js:3602)
    at NewClass.addLayer (leaflet-src-1.0.2.js:4018)
    at NewClass.showLabel (leaflet.label-src.js:544)
    at test.html:65

We change the declaration of Leaflet.label declared as a "L.Class" in line 28 in leaflet.label-src.js as:

var LeafletLabel = L.Layer.extend({ ... });
`
It fixed the problem for us...
But is anyone could confirm if this fix is really the correct one?

@intersel
Copy link
Author

intersel commented Apr 6, 2017

Just found this note somewhere...
NOTE: starting with Leaflet 1.0, L.Label is added to Leaflet core as L.Tooltip and this plugin is deprecrated.
Ok... I will use Tooltip !

@intersel intersel closed this as completed Apr 6, 2017
@intersel intersel reopened this Apr 6, 2017
@intersel
Copy link
Author

intersel commented Apr 6, 2017

Tooltips does not seem to work either... try to have this test working on leaflet 1.0.2 https://github.com/Leaflet/Leaflet/blob/master/debug/map/tooltip.html
and... well... no tooltips...
Same with leaflet 1.0.3 :-(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant