skylarkdrones / pyqtlet

pyqtlet brings Leaflet maps to PyQt5.
Other
30 stars 8 forks source link

Pyqtlet map messes up the drawn polygon when the user creates it with 6 or more points #18

Open hari0603 opened 5 years ago

hari0603 commented 5 years ago

When the user clicks on 6 or more points,

samhattangady commented 5 years ago

I have looked into this, and have been able to reproduce it. I will have to check whether the bug exists in leafletdraw as well. Based on that, I can either update to the latest leafletdraw, or post a bug report in that module, and update once we're fixed.

samhattangady commented 5 years ago

I created a simple web example. It doesn't seem to have the same bug. Now I will have to update the leaflet.draw version to the latest in pyqtlet, and see if the bug is still present.

samhattangady commented 5 years ago

I have updated the versions of leaflet and leaflet.draw. These changes have been pushed to release 0.3.3. This has fixed the bug. I'm going to consider this issue solved.

samhattangady commented 5 years ago

The threshhold seems to have increased to 10 points. Needs further investigation.

samhattangady commented 5 years ago

Steps for further investigation:

  1. Run the example with just PyQtWebEngineWidget and see if the bug still persists. If it doesn't then the problem is with pyqtlet, otherwise it is either in PyQt or Qt itself.
  2. Run the example with just Qt to narrow down further. Report bug accordingly.

Minimal complete verifiable web example:

<html>
  <body>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet-src.js'></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.css"/>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw-src.css"/>
    <div>Map test</div>
    <div id='map' style='height:600px'></div>
  <script>
    let map = L.map('map').setView([12, 77], 13);
    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);
    let drawnItems = new L.FeatureGroup();
    map.addLayer(drawnItems);
    let drawControl = new L.Control.Draw({
      edit: {
        featureGroup: drawnItems
      }
    });
    map.addControl(drawControl);
    map.on(L.Draw.Event.CREATED, function (e) {
       var type = e.layerType,
           layer = e.layer;
       drawnItems.addLayer(layer);
    });
  </script>
  </body>
</html>
samhattangady commented 5 years ago

Ran the example with just PyQtWebEngineView, the bug does not appear. This means that the bug lies inside of pyqtlet somewhere. I am not entirely certain how to go about finding it... =/

samhattangady commented 5 years ago

One idea is that I will print all the runJavaScript calls, and create a web project that uses just that Js, and see if the bug persists.