refactor(core): remove selectionOnDrag prop and use selectionKeyCode to trigger selection

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-25 17:38:56 +01:00
committed by Braks
parent 31e3a8cb71
commit c3e1741a4b
8 changed files with 44 additions and 10 deletions
@@ -32,7 +32,6 @@ const {
connectionStartHandle,
userSelectionActive,
paneDragging,
selectionOnDrag,
} = $(useVueFlow())
const viewportEl = ref<HTMLDivElement>()
@@ -52,7 +51,9 @@ const isConnecting = $computed(() => !!connectionStartHandle)
const shouldPanOnDrag = computed(() => !selectionKeyPressed && panOnDrag && panKeyPressed.value)
const isSelecting = computed(() => selectionKeyPressed || (selectionOnDrag && shouldPanOnDrag.value !== true))
const isSelecting = computed(
() => (selectionKeyCode !== true && selectionKeyPressed) || (selectionKeyCode === true && shouldPanOnDrag.value !== true),
)
const viewChanged = (prevViewport: ViewportTransform, eventTransform: ZoomTransform): boolean =>
(prevViewport.x !== eventTransform.x && !isNaN(eventTransform.x)) ||