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?

  • The interaction automatically fires an event, if a feature handled by the interaction is modified. Use modifyInteraction.on('modifyend', function (evt) {//your code}); – Gabor Farkas Sep 6 '15 at 9:19
  • This fire when modify end. But I want to fire when a feature is sketched. – Morteza Malvandi Sep 6 '15 at 10:40
  • I'm afraid, with the modify interaction, you can only work with the modifystart, and modifyend events related to sketching. – Gabor Farkas Sep 11 '15 at 6:24
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
    });
});
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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