Skip to content

Commit

Permalink
Fix delete part of multipart. Wrong context methods
Browse files Browse the repository at this point in the history
  • Loading branch information
volterra79 committed Nov 22, 2023
1 parent 1203a9f commit a24c227
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions workflows/steps/tasks/deletepartfrommultigeometriestask.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ proto.run = function(inputs, context) {
source,
style: editingLayer.getStyle()
});

map.addLayer(tempLayer);
map.once('postrender', function(){
map.once('postrender', () => {
let found = false;
this.forEachFeatureAtPixel(pixel, _feature => {
//need to call map.forEachFeatureAtPixel and not this.forEachFeatureAtPixel
//beacuse we use arrow function and it referred this to outside context
map.forEachFeatureAtPixel(pixel, _feature => {
if (!found) {
source.removeFeature(_feature);
if (source.getFeatures().length) {
Expand Down Expand Up @@ -69,7 +72,9 @@ proto.run = function(inputs, context) {
hitTolerance: 1
}
);
this.removeLayer(tempLayer);
//need to call map.forEachFeatureAtPixel and not this.forEachFeatureAtPixel
//beacuse we use arrow function and it referred this to outside context
map.removeLayer(tempLayer);
tempLayer = null;
});
return d.promise()
Expand Down

0 comments on commit a24c227

Please sign in to comment.