Merge pull request #4568 from xyflow/fix-draggable

Fix grab cursor
This commit is contained in:
Moritz Klack
2024-08-19 15:21:52 +02:00
committed by GitHub
4 changed files with 14 additions and 5 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@xyflow/react': patch
'@xyflow/svelte': patch
'@xyflow/system': patch
---
Only display grab cursor when panOnDrag is on left mouse button
+3 -1
View File
@@ -253,9 +253,11 @@ export function Pane({
selectionStarted.current = false;
};
const draggable = panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0));
return (
<div
className={cc(['react-flow__pane', { draggable: panOnDrag, dragging, selection: isSelecting }])}
className={cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }])}
onClick={hasActiveSelection ? undefined : wrapHandler(onClick, container)}
onContextMenu={wrapHandler(onContextMenu, container)}
onWheel={wrapHandler(onWheel, container)}
@@ -212,7 +212,7 @@
<div
bind:this={container}
class="svelte-flow__pane"
class:draggable={panOnDrag}
class:draggable={panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0))}
class:dragging={$dragging}
class:selection={isSelecting}
on:click={hasActiveSelection ? undefined : wrapHandler(onClick, container)}
+3 -3
View File
@@ -75,10 +75,10 @@
&.draggable {
cursor: grab;
}
&.dragging {
cursor: grabbing;
}
&.dragging {
cursor: grabbing;
}
}