geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Question: Does geoman still have known issues for circleMarker? (specifically firing pm:enable) #684

Closed henrikmaa closed 4 years ago

henrikmaa commented 4 years ago

Hi, im having an issue using Geoman with React.

I tested with a jsfiddle and there it works fine.

My issue is: When enabling editing on a circleMarker from geojson it works fine. But when I start to drag the circleMarker it fires pm:enable on all geojson layers. So all layers starts editing.

I do not expect a solution for this, but if anyone know any known issues regarding circleMarker?

Part of my code for reference:

new L.GeoJSON(getGeoJson(), {
      pointToLayer: PoIstile,
      onEachFeature: function (feature, layer) {
        layer.on('click', onLayerClick);
        layer.on('pm:enable', onLayerEditingStart);
        layer.on('pm:disable', onLayerEditingDisable);
        layer.on('pm:update', onLayerEdited);
      }
    }).addTo(features).setStyle({weight: 8});
function PoIstile(feature, latlng) {
    switch(feature.properties["objectType"]) {

      case "TettstedInngangBygg":
        return L.circleMarker(latlng, {color: '#0FF00F', fill: true, stroke: false, fillColor: '#0FF00F', fillOpacity: 1});

      case "FriluftBaderampe":
        let FriluftBaderampe = L.icon({
          iconUrl: FriluftBaderampeIkon,
          iconSize:     [30, 30], // size of the icon
          iconAnchor:   [22, 22], // point of the icon which will correspond to marker's location
          popupAnchor:  [-3, -26] // point from which the popup should open relative to the iconAnchor
        });
        return L.marker(latlng, {icon: FriluftBaderampe});
  }

Im guessing this is not a problem with geoman, but maybe the combination with geoman and markercluster, but i dont see any reason why markercluster would stop this from working when everything else works fine except circleMarkers.

Falke-Design commented 4 years ago

I tested with a jsfiddle and there it works fine.

It would be very nice if you create a demo, else we can't help ...

henrikmaa commented 4 years ago

I dont think this is a problem of geoman. By putting the circle marker in edit mode on the fiddle it works fine, but that is without markercluster. I Guess this is an issue in myself code somewhere. Or a combination of React, markercluster and geoman. Here is a fiddle for reference what i mean https://jsfiddle.net/a9gf8kzy/4/

Closing this due to it is not possible to get an answer for this.