Search code examples
openlayersopenlayers-3openlayers-6angular-openlayers

how to deactivate zoom on double-click using setActive(false)


i would like to modify the below code in a such way that it only deactivate the zoom on double-click event please.

i tried the below posted code, but it disabled all the interactions including the mouse-wheel

code

this.map.getInteractions().forEach(x => x.setActive(false));

Solution

  • i solved it as shown in the follwoing code:

    code:

    import interactionDoubleClickZoom from 'ol/interaction/DoubleClickZoom';
    
        this.map.getInteractions().forEach(x => {
        if (x instanceof interactionDoubleClickZoom) {
            x.setActive(false)
        }
    });