0

I added two select interactions(on different layers) to the openlayers instance but only the last one seems to work/trigger.

I got it working by giving the condition "click" to the first one and "singleClick" to the second one. This certainly does only work for two interactions since there are only two interaction-conditions triggered by a simple mouse-click. It seems to me that you cannot have two interactions of the same condition on your map, or am i doing something wrong?

var selectDeployment = new ol.interaction.Select({
    layers: [layers["deployments"]]
});
map.addInteraction(selectDeployment);
selectDeployment.on("select", onSelectDeployment);
var selectDevice = new ol.interaction.Select({
    layers: Object.keys(layers).filter(k => k.split("_").length > 1).map((k) => layers[k])
});
map.addInteraction(selectDevice);
selectDevice.on("select", onSelectDevice);
geocodezip
  • 158,664
  • 13
  • 220
  • 245
Patrick
  • 367
  • 1
  • 13
  • see https://github.com/openlayers/openlayers/issues/1988 and https://github.com/openlayers/openlayers/issues/4882 – Mike Sep 02 '19 at 11:01
  • Thanks, I've seen them already and they seem to me more like workarounds then solutions. Furthermore they are on older versions of ol so i was wondering if something had changed since then. In my eyes, this limitation would make sense if you'd use the same interactions on the same layers multiple times but not on a whole map-instance level.. – Patrick Sep 02 '19 at 11:37

0 Answers0