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) { if (!node || !dragging || !removeTokenRef.current) {
return; return;
} }
const stage = node.getStage();
const pointerPosition = node.getStage().getPointerPosition(); if (!stage) {
return;
}
const pointerPosition = stage.getPointerPosition();
const screenSpacePointerPosition = { const screenSpacePointerPosition = {
x: pointerPosition.x + mapRect.left, x: pointerPosition.x + mapRect.left,
y: pointerPosition.y + mapRect.top, y: pointerPosition.y + mapRect.top,