Skip to content

Commit

Permalink
Cursor grab only shown if left click is panning
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkogo committed Aug 19, 2024
1 parent aaf130f commit 6af9f45
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/react/src/container/Pane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/lib/container/Pane/Pane.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
6 changes: 3 additions & 3 deletions packages/system/src/styles/init.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@

&.draggable {
cursor: grab;
}

&.dragging {
cursor: grabbing;
}
&.dragging {
cursor: grabbing;
}
}

Expand Down

0 comments on commit 6af9f45

Please sign in to comment.