also postpone starting selection when clicking on a node
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
bind:edges
|
bind:edges
|
||||||
fitView
|
fitView
|
||||||
selectionMode={SelectionMode.Partial}
|
selectionMode={SelectionMode.Partial}
|
||||||
|
multiSelectionKey={['Meta', 'Shift']}
|
||||||
selectionOnDrag
|
selectionOnDrag
|
||||||
panOnScroll
|
panOnScroll
|
||||||
paneClickDistance={100}
|
paneClickDistance={100}
|
||||||
|
|||||||
@@ -120,13 +120,6 @@
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paneClickDistance === 0 || store.selectionKeyPressed) {
|
|
||||||
store.unselectNodesAndEdges();
|
|
||||||
|
|
||||||
onselectionstart?.(event);
|
|
||||||
selectionInProgress = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPointerMove(event: PointerEvent) {
|
function onPointerMove(event: PointerEvent) {
|
||||||
@@ -137,14 +130,10 @@
|
|||||||
const mousePos = getEventPosition(event, containerBounds);
|
const mousePos = getEventPosition(event, containerBounds);
|
||||||
const { startX = 0, startY = 0 } = store.selectionRect;
|
const { startX = 0, startY = 0 } = store.selectionRect;
|
||||||
|
|
||||||
if (
|
if (!selectionInProgress) {
|
||||||
!selectionInProgress &&
|
const requiredDistance = store.selectionKeyPressed ? 0 : paneClickDistance;
|
||||||
event.target === container &&
|
|
||||||
!store.selectionKeyPressed &&
|
|
||||||
paneClickDistance > 0
|
|
||||||
) {
|
|
||||||
const distance = Math.hypot(mousePos.x - startX, mousePos.y - startY);
|
const distance = Math.hypot(mousePos.x - startX, mousePos.y - startY);
|
||||||
if (distance <= paneClickDistance) {
|
if (distance <= requiredDistance) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
store.unselectNodesAndEdges();
|
store.unselectNodesAndEdges();
|
||||||
|
|||||||
Reference in New Issue
Block a user