MoreScratch
MoreScratch

Reputation: 3083

How to get a Map Control or Interaction

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.

Upvotes: 10

Views: 7534

Answers (1)

Timh
Timh

Reputation: 512

map.getInteractions().forEach(function (interaction) {
  if(interaction instanceof ol.interaction.Select) { ... }
});

Same thing for controls.

Upvotes: 17

Related Questions