Get pixel data

This commit is contained in:
Tim Schaub
2022-02-06 16:46:01 -07:00
parent cd45663996
commit eb4d5e0784
23 changed files with 721 additions and 101 deletions

View File

@@ -47,9 +47,7 @@ map.on('pointermove', function (evt) {
if (evt.dragging) {
return;
}
const pixel = map.getEventPixel(evt.originalEvent);
const hit = map.forEachLayerAtPixel(pixel, function () {
return true;
});
const data = wmsLayer.getData(evt.pixel);
const hit = data && data[3] > 0; // transparent pixels have zero for data[3]
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
});