1

I have tow ol.interaction.Select, one to the single click and the other one to double click.

var selectDoubleClick = new ol.interaction.Select({
    multi: true,
    condition: ol.events.condition.doubleClick,
    style: function(feature) {
        //stuff here;
    }
    return feature;
}

selectDoubleClick.on('select',function(event) {
    //stuff here
}

var selectSingleClick = new ol.interaction.Select({
    multi: true,
    condition: ol.events.condition.singleClick,
    style: function(feature) {
        //stuff here
    }
    return feature;
}

selectSingleClick.on('select',function(event) {
    //stuff here
}

But when i want to deselect the double click, i have to click twice in the map. Is any way to deselect in double click with just one click?

0

My solution was simple. First very if exists any getFeature link to this interaction (selectDoubleClick), and then clear this features.

var concludeClickEdit = function(eventListener) {
    if(selectDoubleClick.getFeatures().getLength() !== 0){
             selectDoubleClick.getFeatures().clear();
          }
}

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.