Expose removeVertex_ as removePoint
This commit is contained in:
@@ -252,6 +252,43 @@ describe('ol.interaction.Modify', function() {
|
||||
validateEvents(events, features);
|
||||
});
|
||||
|
||||
it('deletes vertex of a LineString programmatically', function() {
|
||||
var lineFeature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
});
|
||||
features.length = 0;
|
||||
features.push(lineFeature);
|
||||
features.push(lineFeature.clone());
|
||||
|
||||
var first = features[0];
|
||||
var firstRevision = first.getGeometry().getRevision();
|
||||
|
||||
var modify = new ol.interaction.Modify({
|
||||
features: new ol.Collection(features)
|
||||
});
|
||||
map.addInteraction(modify);
|
||||
|
||||
var events = trackEvents(first, modify);
|
||||
|
||||
expect(first.getGeometry().getRevision()).to.equal(firstRevision);
|
||||
expect(first.getGeometry().getCoordinates()).to.have.length(5);
|
||||
|
||||
simulateEvent('pointerdown', 40, 0, false, 0);
|
||||
simulateEvent('pointerup', 40, 0, false, 0);
|
||||
|
||||
modify.removePoint();
|
||||
|
||||
expect(first.getGeometry().getRevision()).to.equal(firstRevision + 1);
|
||||
expect(first.getGeometry().getCoordinates()).to.have.length(4);
|
||||
expect(first.getGeometry().getCoordinates()[3][0]).to.equal(40);
|
||||
expect(first.getGeometry().getCoordinates()[3][1]).to.equal(40);
|
||||
|
||||
validateEvents(events, features);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('boundary modification', function() {
|
||||
|
||||
Reference in New Issue
Block a user