Skip to content

Commit

Permalink
fix(ol-map-adapter): do not emit map mouse events with no coords
Browse files Browse the repository at this point in the history
  • Loading branch information
rendrom committed Apr 17, 2024
1 parent 9acfa17 commit a3fa11c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/ol-map-adapter/src/OlMapAdapter.ts
Expand Up @@ -416,12 +416,15 @@ export class OlMapAdapter implements MapAdapter<Map, Layer> {
});
const mouseEventEventToMapMouseEvent = (evt: MouseEvent) => {
const pixel = [evt.x, evt.y];
const mapEvent = {
pixel,
coordinate: map.getCoordinateFromPixel(pixel),
...evt,
};
return convertMapClickEvent(mapEvent);
const coordinate = map.getCoordinateFromPixel(pixel);
if (coordinate) {
const mapEvent = {
pixel,
coordinate,
...evt,
};
return convertMapClickEvent(mapEvent);
}
};
viewport.addEventListener(
'mouseout',
Expand Down

0 comments on commit a3fa11c

Please sign in to comment.