Skip to content

Commit

Permalink
Merge pull request #59 from milieuinfo/feature/filter-for-delete-action
Browse files Browse the repository at this point in the history
Introduceer de mogelijkheid om de delete action te filteren op basis van feature
  • Loading branch information
Lucas Sledsens authored Mar 22, 2022
2 parents 664826e + be88811 commit af0802e
Show file tree
Hide file tree
Showing 7 changed files with 3,455 additions and 3,152 deletions.
3 changes: 2 additions & 1 deletion bamboo-specs/bamboo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plan:

triggers:
- polling: 130
- cron: "0 30 2 * * ?"

variables:
release_version: patch
Expand All @@ -25,7 +26,7 @@ Build:
tasks:
- clean
- script: |
#!/usr/env/bin bash
#!/bin/bash
set -e
export browserstack_username="${bamboo_browserstack_username}"
export browserstack_password="${bamboo_browserstack_password}"
Expand Down
2 changes: 1 addition & 1 deletion dist/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vl-mapactions.js

Large diffs are not rendered by default.

6,581 changes: 3,437 additions & 3,144 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/style.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/vl-mapactions-delete-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Fill, Stroke, Style, Circle} from 'ol/style';
import {VlBoxSelectAction} from './vl-mapactions-box-select-action';

export class VlDeleteAction extends VlBoxSelectAction {
constructor(layer, onDelete, options) {
constructor(layer, onDelete, options = {}) {
const defaultStyle = new Style({
fill: new Fill({
color: 'rgba(241, 174, 174, 0.26)',
Expand All @@ -23,8 +23,6 @@ export class VlDeleteAction extends VlBoxSelectAction {
}),
});

const style = options ? options.style || defaultStyle : defaultStyle;

const removeFeature = (feature) => {
if (feature && (feature.getId() == null || layer.getSource().getFeatureById(feature.getId()) === feature)) {
layer.getSource().removeFeature(feature);
Expand All @@ -51,7 +49,8 @@ export class VlDeleteAction extends VlBoxSelectAction {
clearAndRender();
}
}, {
style: style,
style: options.style || defaultStyle,
filter: options.filter
});
}
}
10 changes: 10 additions & 0 deletions test/unit/vl-mapactions-delete-action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,14 @@ describe('delete action', () => {
deleteAction.dragBoxInteraction.dispatchEvent('boxend');
expect(deleteAction.map.render.called).to.be.true;
});

it('de feature filter zal doorgegeven worden aan de select action', () => {
const layers = {};
const filter = () => {};
const options = {
filter: filter,
};
const action = new VlDeleteAction(layers, null, options);
expect(action.filter).to.equal(filter);
});
});

0 comments on commit af0802e

Please sign in to comment.