robertleeplummerjr / Leaflet.glify

fully functional, ridiculously fast web gl renderer plugin for leaflet
https://robertleeplummerjr.github.io/Leaflet.glify
MIT License
484 stars 86 forks source link

Popup shown very far from line #39

Open Geminium opened 4 years ago

Geminium commented 4 years ago

Hi, I have a LineString with click event for open a popup but the click is triggered very far from the line.

The code

  var map = L.map('map').setView([-21.2406697614406, 55.3425703123866], 16);

   L.tileLayer(
            'https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',
            {
                maxZoom: 16,
                maxNativeZoom: 16
            }).addTo(map);

    L.glify.lines({
      map: map,
      size:1,
      latitudeKey: 1,
      longitudeKey: 0,
      color: function(i, w) {return {"r":0.3333, "g":0.5333, "b":0.9333};},
      opacity: 1,
      click: function (e, feature) {
        L.popup()
          .setLatLng(e.latlng)
          .setContent("You clicked on ")
          .openOn(map);
        console.log(feature);
        console.log(e);
      },
      data: {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"LineString","coordinates":[[55.3425703123866, -21.2406697614406],[55.3425506995657,-21.2406315776287],[55.3416893695914,-21.2401833497794],[55.3408962092064,-21.2397746736981],[55.3404008319187,-21.2394642816416]]}}]}
    });

Screenshot: https://ibb.co/vXLBRMF

Is it possible to manage the distance ?

Thank you

trafficonese commented 4 years ago

Is your problem solved if you include sensitivity: 0.0001 for example?