fix: bounds check

This commit is contained in:
cha0s 2024-07-08 14:06:57 -05:00
parent d19e917505
commit 44c19fe76b

View File

@ -74,6 +74,12 @@ export default function Devtools({
return;
}
const {left, top} = offsetRef.current.getBoundingClientRect();
if (
event.clientX - left >= w
|| event.clientY - top >= h
) {
return;
}
const x = Math.floor((event.clientX - left) / tileSize.x);
const y = Math.floor((event.clientY - top) / tileSize.y);
setMoveStart({x, y});