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

pmIgnore check & Opt-In draw Bug #759

Closed
Falke-Design opened this issue Jan 14, 2021 · 2 comments
Closed

pmIgnore check & Opt-In draw Bug #759

Falke-Design opened this issue Jan 14, 2021 · 2 comments
Labels
bug fixed Issues that are fixed in develop or in a PR

Comments

@Falke-Design
Copy link
Collaborator

While drawing and L.PM.setOptIn(true) an error is thrown: layer.pm undefined

_finishLayer(layer){
// add the pm options from drawing to the new layer (edit)
layer.pm.setOptions(this.options);
// set the shape (can be a custom shape)
if(layer.pm) {
layer.pm._shape = this._shape;
}
this._addDrawnLayerProp(layer);
},

Needs to be:

  _finishLayer(layer){
    if(layer.pm) {
      // add the pm options from drawing to the new layer (edit)
      layer.pm.setOptions(this.options);
      // set the shape (can be a custom shape)
      layer.pm._shape = this._shape;
    }
    this._addDrawnLayerProp(layer);
  },

Also layers with pmIgnore: true should not be editable / moveable / deleteable

const isRelevant = layer =>
layer.pm &&
!(layer instanceof L.LayerGroup);

findLayers(map) {
let layers = [];
map.eachLayer(layer => {
if (
layer instanceof L.Polyline ||
layer instanceof L.Marker ||
layer instanceof L.Circle ||
layer instanceof L.CircleMarker ||
layer instanceof L.ImageOverlay
) {
layers.push(layer);
}
});
// filter out layers that don't have the leaflet-geoman instance
layers = layers.filter(layer => !!layer.pm);
// filter out everything that's leaflet-geoman specific temporary stuff
layers = layers.filter(layer => !layer._pmTempLayer);
return layers;
},

@brugsel
Copy link

brugsel commented Mar 22, 2021

Also running into the same problem. Any timeline on when the fix will be released?

@Falke-Design
Copy link
Collaborator Author

@brugsel we want to publish the release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed Issues that are fixed in develop or in a PR
Projects
None yet
Development

No branches or pull requests

2 participants