diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 92b0f9b..9a4d556 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -404,6 +404,7 @@ PlaneObject.prototype.updateMarker = function(moved) { } } else { this.marker = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(this.position))); + this.marker.hex = this.icao; this.marker.setStyle(this.markerStyle); PlaneIconFeatures.push(this.marker); diff --git a/public_html/script.js b/public_html/script.js index d68a7df..ea9de91 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -390,6 +390,25 @@ function initialize_map() { localStorage['ZoomLvl'] = OLMap.getView().getZoom(); }); + OLMap.addInteraction(new ol.interaction.Pointer({ + handleDownEvent: function(evt) { + console.log("down event"); + var hex = evt.map.forEachFeatureAtPixel(evt.pixel, + function(feature, layer) { + return feature.hex; + }, + null, + function(layer) { + return (layer === iconsLayer); + }, + null); + if (hex) { + selectPlaneByHex(hex); + } + return false; + } + })); + // Add home marker if requested if (SitePosition) { console.log("setting up site position");