Reinstate selecting aircraft by clicking on their icons.

This commit is contained in:
Oliver Jowett 2016-07-02 17:11:33 +01:00
parent 90f5a7d4e3
commit fc95719f2e
2 changed files with 20 additions and 0 deletions

View file

@ -404,6 +404,7 @@ PlaneObject.prototype.updateMarker = function(moved) {
} }
} else { } else {
this.marker = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(this.position))); this.marker = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(this.position)));
this.marker.hex = this.icao;
this.marker.setStyle(this.markerStyle); this.marker.setStyle(this.markerStyle);
PlaneIconFeatures.push(this.marker); PlaneIconFeatures.push(this.marker);

View file

@ -390,6 +390,25 @@ function initialize_map() {
localStorage['ZoomLvl'] = OLMap.getView().getZoom(); 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 // Add home marker if requested
if (SitePosition) { if (SitePosition) {
console.log("setting up site position"); console.log("setting up site position");