How does one get a specific ol.control or ol.interaction from ol.Map? I have several dynamically added maps on a single page and I want to be able to access the ol.interaction.Select.
How to get a Map Control or Interaction
Asked Answered
map.getInteractions().forEach(function (interaction) {
if(interaction instanceof ol.interaction.Select) { ... }
});
Same thing for controls.
Thank you very much. I was doing (interaction.constructor.name === "DragZoom"). It was working in dev mode but not in production mode with webpack. –
Penrod
© 2022 - 2024 — McMap. All rights reserved.
map.getInteractions()
ormap.getControls()
github.com/openlayers/ol3/blob/… – Galatea