mouseover handler change in preparation for ais tooltips

This commit is contained in:
Matthias Wirth
2024-05-06 00:22:12 +02:00
parent 31d02a8fc5
commit fd7d79eb02
2 changed files with 21 additions and 8 deletions

View File

@@ -2375,9 +2375,7 @@ function ol_map_init() {
});
// show the hover box
if (!globeIndex && zoomLvl > 5.5 && enableMouseover) {
OLMap.on('pointermove', onPointermove);
}
checkPointermove();
}
// Initalizes the map and starts up our timers to call various functions
@@ -5499,17 +5497,32 @@ function onPointermove(evt) {
}
function highlight(evt) {
const hex = evt.map.forEachFeatureAtPixel(evt.pixel,
const feature = evt.map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature.hex;
return feature;
},
{
layerFilter: function(layer) {
return (layer == iconLayer || layer == webglLayer);
return (layer == iconLayer || layer == webglLayer || layer == g.aiscatcherLayer);
},
hitTolerance: 5 * globalScale,
}
);
if (!feature) {
HighlightedPlane = null;
refreshHighlighted();
return;
}
const hex = feature.hex;
const values = feature.values_;
const mmsi = values ? values.mmsi : null;
if (hex) {
//console.log(hex);
}
if (mmsi) {
//console.log(mmsi);
}
if (HighlightedPlane && hex == HighlightedPlane.icao)
return;