diff --git a/.changeset/empty-falcons-obey.md b/.changeset/empty-falcons-obey.md new file mode 100644 index 000000000..e607799b3 --- /dev/null +++ b/.changeset/empty-falcons-obey.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Reorder pane class names to allow dragging cursor when selection mode is permanently enabled diff --git a/.changeset/nasty-panthers-admire.md b/.changeset/nasty-panthers-admire.md new file mode 100644 index 000000000..75fcafc4f --- /dev/null +++ b/.changeset/nasty-panthers-admire.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Allow pan on drag when selectionKeyCode is `true` but panOnDrag key is not left mouse btn diff --git a/packages/core/src/composables/useKeyPress.ts b/packages/core/src/composables/useKeyPress.ts index 750c17d67..0f776d9d0 100644 --- a/packages/core/src/composables/useKeyPress.ts +++ b/packages/core/src/composables/useKeyPress.ts @@ -75,7 +75,7 @@ function useKeyOrCode(code: string, keysToWatch: string | string[]) { * @param keyFilter - Can be a boolean, a string, an array of strings or a function that returns a boolean. If it's a boolean, it will act as if the key is always pressed. If it's a string, it will return true if a key matching that string is pressed. If it's an array of strings, it will return true if any of the strings match a key being pressed, or a combination (e.g. ['ctrl+a', 'ctrl+b']) * @param options - Options object */ -export function useKeyPress(keyFilter: MaybeRefOrGetter, options?: UseKeyPressOptions) { +export function useKeyPress(keyFilter: MaybeRefOrGetter, options?: UseKeyPressOptions) { const actInsideInputWithModifier = toRef(() => toValue(options?.actInsideInputWithModifier) ?? false) const target = toRef(() => toValue(options?.target) ?? window) @@ -149,7 +149,7 @@ export function useKeyPress(keyFilter: MaybeRefOrGetter, optio isPressed.value = false } - function createKeyFilterFn(keyFilter: KeyFilter | null) { + function createKeyFilterFn(keyFilter: KeyFilter | boolean | null) { // if the keyFilter is null, we just set the isPressed value to false if (keyFilter === null) { reset() diff --git a/packages/core/src/style.css b/packages/core/src/style.css index 8c081a9bb..f2512de47 100644 --- a/packages/core/src/style.css +++ b/packages/core/src/style.css @@ -22,13 +22,13 @@ cursor: grab; } - &.dragging { - cursor: grabbing; - } - &.selection { cursor: pointer; } + + &.dragging { + cursor: grabbing; + } } .vue-flow__transformationpane { diff --git a/packages/core/src/types/flow.ts b/packages/core/src/types/flow.ts index 2160060ac..4ea8134aa 100644 --- a/packages/core/src/types/flow.ts +++ b/packages/core/src/types/flow.ts @@ -162,7 +162,7 @@ export interface FlowProps { connectionRadius?: number isValidConnection?: ValidConnectionFunc | null deleteKeyCode?: KeyFilter | null - selectionKeyCode?: KeyFilter | null + selectionKeyCode?: KeyFilter | boolean | null multiSelectionKeyCode?: KeyFilter | null zoomActivationKeyCode?: KeyFilter | null panActivationKeyCode?: KeyFilter | null diff --git a/packages/core/src/types/store.ts b/packages/core/src/types/store.ts index d3a0354f1..0fd614f82 100644 --- a/packages/core/src/types/store.ts +++ b/packages/core/src/types/store.ts @@ -83,7 +83,7 @@ export interface State extends Omit { multiSelectionActive: boolean deleteKeyCode: KeyFilter | null - selectionKeyCode: KeyFilter | null + selectionKeyCode: KeyFilter | boolean | null multiSelectionKeyCode: KeyFilter | null zoomActivationKeyCode: KeyFilter | null panActivationKeyCode: KeyFilter | null