feat(svelte): add selectionOnDrag

This commit is contained in:
moklick
2023-11-13 11:45:53 +01:00
parent d4df8be6f2
commit dee36d5b90
6 changed files with 9 additions and 6 deletions
@@ -40,6 +40,7 @@
type $$Props = PaneProps;
export let panOnDrag: $$Props['panOnDrag'] = undefined;
export let selectionOnDrag: $$Props['selectionOnDrag'] = undefined;
const dispatch = createEventDispatcher<{
paneclick: {
@@ -67,9 +68,9 @@
let containerBounds: DOMRect | null = null;
let selectedNodes: Node[] = [];
$: isSelecting = $selectionKeyPressed;
$: hasActiveSelection = $elementsSelectable && (isSelecting || $selectionRectMode === 'user');
$: _panOnDrag = $panActivationKeyPressed || panOnDrag;
$: isSelecting = $selectionKeyPressed || (selectionOnDrag && _panOnDrag !== true);
$: hasActiveSelection = $elementsSelectable && (isSelecting || $selectionRectMode === 'user');
function onClick(event: MouseEvent | TouchEvent) {
dispatch('paneclick', { event });
@@ -1,3 +1,4 @@
export type PaneProps = {
panOnDrag?: boolean | number[];
selectionOnDrag?: boolean;
};