Added check for stage in drag overlay

This commit is contained in:
Mitchell McCaffrey 2021-01-04 12:22:09 +11:00
parent eb0826d48c
commit fd9f47e41e

View File

@ -16,8 +16,11 @@ function DragOverlay({ dragging, node, onRemove }) {
if (!node || !dragging || !removeTokenRef.current) {
return;
}
const pointerPosition = node.getStage().getPointerPosition();
const stage = node.getStage();
if (!stage) {
return;
}
const pointerPosition = stage.getPointerPosition();
const screenSpacePointerPosition = {
x: pointerPosition.x + mapRect.left,
y: pointerPosition.y + mapRect.top,