0

Im trying to handle Rotation and Zoom interactions. Is it possible to create one listener for all interactions created by DragRotateAndZoom?

https://openlayers.org/en/latest/apidoc/module-ol_interaction_DragRotateAndZoom-DragRotateAndZoom.html

...
      interactions: defaultInteractions().extend([
        new DragRotateAndZoom()
      ]),
...

Is there any way to use something like

    this.map.on('rotate', (e) => {
      console.log(e);
    });

OR

    this.map.on('zoom', (e) => {
      console.log(e);
    });

found an solution for an old version (7 years old!) -> Javascript OpenLayers before zoom event listener

N33D
  • 135
  • 1
  • 7
  • 2
    Use `this.map.getView().on('change:resolution', ...)` and `this.map.getView().on('change:rotation', ...)` https://openlayers.org/en/latest/apidoc/module-ol_View-View.html – Mike Nov 26 '19 at 12:45
  • 1
    If you want to have the same callback, this also works: `this.map.getView().on(['change:resolution', 'change:rotation'], (e) => {})` – Rob Nov 26 '19 at 14:39

0 Answers0