I want to save the geometry data after I modify it, so I need an event that fire after I finish to modify the feature.
I use the following from this post:
listener modify interaction
var selected_features = select.getFeatures();
// when a feature is selected...
selected_features.on('add', function (event) {
// get the feature
var feature = event.element;
feature.on("change", function (event) {
logStatus(feature.getId() + " has been changed!\n");
});
});
But this listener fires too many times in a single modification, and if I am using 'once' instead of 'on' its fires only the first little change and no more, so its not saving the real change.
I need something like "changeend" or "modifyend" that will fire when I will finish to modify the feature, what can i use?
Best Answer
If you need a modifyend event why dont you use it within the modify interaction.(I guess you use a modify interaction) check this
This event is available in the latest versions of ol3. In my code snip, I assume you only modify one fetaure at once (getArray()[0]) . If you use more than one fetaure to modify at once then get the fetaures array and add a loop for further manipulation. Like so: