Turns out we don't need an interaction to catch feature clicks.

This commit is contained in:
Oliver Jowett 2016-07-02 18:11:05 +01:00
parent 54dc91adc5
commit 986c910a73

View file

@ -397,24 +397,21 @@ function initialize_map() {
localStorage['ZoomLvl'] = OLMap.getView().getZoom(); localStorage['ZoomLvl'] = OLMap.getView().getZoom();
}); });
OLMap.addInteraction(new ol.interaction.Pointer({ OLMap.on(['click', 'dblclick'], function(evt) {
handleDownEvent: function(evt) { var hex = evt.map.forEachFeatureAtPixel(evt.pixel,
console.log("down event"); function(feature, layer) {
var hex = evt.map.forEachFeatureAtPixel(evt.pixel, return feature.hex;
function(feature, layer) { },
return feature.hex; null,
}, function(layer) {
null, return (layer === iconsLayer);
function(layer) { },
return (layer === iconsLayer); null);
}, if (hex) {
null); selectPlaneByHex(hex, (evt.type === 'dblclick'));
if (hex) { evt.stopPropagation();
selectPlaneByHex(hex);
}
return false;
} }
})); });
// Add home marker if requested // Add home marker if requested
if (SitePosition) { if (SitePosition) {