Skip to content

Commit 1f76cff

Browse files
committed
fix tooltip coordinate
1 parent 2ba9f6e commit 1f76cff

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/components/src/map-container.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,19 @@ export default function MapContainerFactory(
858858
getCursor?: ({isDragging}: {isDragging: boolean}) => string;
859859
} = {};
860860
if (primaryMap) {
861-
extraDeckParams.getTooltip = info =>
862-
EditorLayerUtils.getTooltip(info, {
863-
editorMenuActive,
864-
editor,
865-
theme
866-
});
861+
// Omit hover updates when the pointer position is invalid, ie. over UI overlays or
862+
// outside the map container. In those cases x/y may be < 0
863+
extraDeckParams.getTooltip = info => {
864+
const x = Number(info?.x);
865+
const y = Number(info?.y);
866+
if (Number.isNaN(x) || Number.isNaN(y) || x < 0 || y < 0) return null;
867+
868+
return EditorLayerUtils.getTooltip(info, {
869+
editorMenuActive,
870+
editor,
871+
theme
872+
});
873+
};
867874

868875
extraDeckParams.getCursor = ({isDragging}: {isDragging: boolean}) => {
869876
const editorCursor = EditorLayerUtils.getCursor({

0 commit comments

Comments
 (0)