0

I'm using OpenLayers-3.8.2. I have modify interaction as follows:

selectedInteraction = ... 
modifyInteraction = new ol.interaction.Modify({
   features: selectInteraction.getFeatures()
});

I want to define an event that when a point of feature change, it fires. Something like this, but NOT for drawing, for modifying.

How do I do?

3
  • The interaction automatically fires an event, if a feature handled by the interaction is modified. Use modifyInteraction.on('modifyend', function (evt) {//your code}); Commented Sep 6, 2015 at 9:19
  • This fire when modify end. But I want to fire when a feature is sketched. Commented Sep 6, 2015 at 10:40
  • I'm afraid, with the modify interaction, you can only work with the modifystart, and modifyend events related to sketching. Commented Sep 11, 2015 at 6:24

2 Answers 2

1

On modifystart you need to listen for change:geometryevent on the feature then on modifyend you remove this listener.

1

there is an event on the select interaction, that fires when you modify a feature and click outside of it:

selectedInteraction.getFeatures().on('add', function(e) {
    e.element.on('change', function(e) {
    //and here e.target is the feature that has been modified
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.