mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(editor): Fix canvas moving check (#17856)
This commit is contained in:
@@ -196,15 +196,18 @@ const classes = computed(() => ({
|
||||
const panningKeyCode = ref<string[] | true>(isMobileDevice ? true : [' ', controlKeyCode]);
|
||||
const panningMouseButton = ref<number[] | true>(isMobileDevice ? true : [1]);
|
||||
const selectionKeyCode = ref<string | true | null>(isMobileDevice ? 'Shift' : true);
|
||||
const isInPanningMode = ref(false);
|
||||
|
||||
function switchToPanningMode() {
|
||||
selectionKeyCode.value = null;
|
||||
panningMouseButton.value = [0, 1];
|
||||
isInPanningMode.value = true;
|
||||
}
|
||||
|
||||
function switchToSelectionMode() {
|
||||
selectionKeyCode.value = true;
|
||||
panningMouseButton.value = [1];
|
||||
isInPanningMode.value = false;
|
||||
}
|
||||
|
||||
onKeyDown(panningKeyCode.value, switchToPanningMode, {
|
||||
@@ -651,8 +654,13 @@ function setReadonly(value: boolean) {
|
||||
elementsSelectable.value = true;
|
||||
}
|
||||
|
||||
function onPaneMoveStart() {
|
||||
isPaneMoving.value = true;
|
||||
function onPaneMove({ event }: { event: unknown }) {
|
||||
// The event object is either D3ZoomEvent or WheelEvent.
|
||||
// Here I'm ignoring D3ZoomEvent because it's not necessarily followed by a moveEnd event.
|
||||
// This can be simplified once https://github.com/bcakmakoglu/vue-flow/issues/1908 is resolved
|
||||
if (isInPanningMode.value || event instanceof WheelEvent) {
|
||||
isPaneMoving.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function onPaneMoveEnd() {
|
||||
@@ -894,6 +902,7 @@ provide(CanvasKey, {
|
||||
initialized,
|
||||
viewport,
|
||||
isExperimentalNdvActive,
|
||||
isPaneMoving,
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -923,7 +932,7 @@ provide(CanvasKey, {
|
||||
@connect-end="onConnectEnd"
|
||||
@pane-click="onClickPane"
|
||||
@pane-context-menu="onOpenContextMenu"
|
||||
@move-start="onPaneMoveStart"
|
||||
@move="onPaneMove"
|
||||
@move-end="onPaneMoveEnd"
|
||||
@node-drag-stop="onNodeDragStop"
|
||||
@node-click="onNodeClick"
|
||||
|
||||
Reference in New Issue
Block a user