I would like to use a click interaction to select multiple features (I have 2 vector layers) and show their names inside a infobox. What is wrong?na
var selectClick = new ol.interaction.Select({ condition: ol.events.condition.Click, toggleCondition: ol.events.condition.shiftKeyOnly, });var select = selectClick; map.addInteraction(select);var selectedFeaturesClick = select.getFeatures();select.on('add', function(e) { var info = []; selectedFeaturesClick.push(feature); info.push(feature.get('DIVISION')); if (info.length> 0) { infoBox2.innerHTML = info.join(', '); }});
أكثر...
var selectClick = new ol.interaction.Select({ condition: ol.events.condition.Click, toggleCondition: ol.events.condition.shiftKeyOnly, });var select = selectClick; map.addInteraction(select);var selectedFeaturesClick = select.getFeatures();select.on('add', function(e) { var info = []; selectedFeaturesClick.push(feature); info.push(feature.get('DIVISION')); if (info.length> 0) { infoBox2.innerHTML = info.join(', '); }});
أكثر...