Pane: only use cursor grab when panOnDrag=true

This commit is contained in:
peterkogo
2024-02-21 07:41:56 +01:00
parent 20e2d3d2ce
commit 9fb4979631
3 changed files with 8 additions and 4 deletions

View File

@@ -220,7 +220,7 @@ export function Pane({
return (
<div
className={cc(['react-flow__pane', { dragging, selection: isSelecting }])}
className={cc(['react-flow__pane', { draggable: panOnDrag, dragging, selection: isSelecting }])}
onClick={hasActiveSelection ? undefined : wrapHandler(onClick, container)}
onContextMenu={wrapHandler(onContextMenu, container)}
onWheel={wrapHandler(onWheel, container)}

View File

@@ -202,6 +202,7 @@
<div
bind:this={container}
class="svelte-flow__pane"
class:draggable={panOnDrag}
class:dragging={$dragging}
class:selection={isSelecting}
on:click={hasActiveSelection ? undefined : wrapHandler(onClick, container)}

View File

@@ -66,14 +66,17 @@
.xy-flow__pane {
z-index: 1;
cursor: grab;
&.selection {
cursor: pointer;
}
&.dragging {
cursor: grabbing;
&.draggable {
cursor: grab;
&.dragging {
cursor: grabbing;
}
}
}