fix: bounds check
This commit is contained in:
parent
d19e917505
commit
44c19fe76b
|
@ -74,6 +74,12 @@ export default function Devtools({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const {left, top} = offsetRef.current.getBoundingClientRect();
|
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 x = Math.floor((event.clientX - left) / tileSize.x);
|
||||||
const y = Math.floor((event.clientY - top) / tileSize.y);
|
const y = Math.floor((event.clientY - top) / tileSize.y);
|
||||||
setMoveStart({x, y});
|
setMoveStart({x, y});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user