mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(editor): Fix initial node and sticky insert position in new canvas (no-changelog) (#10153)
This commit is contained in:
@@ -29,7 +29,7 @@ import type {
|
||||
ToggleNodeCreatorOptions,
|
||||
XYPosition,
|
||||
} from '@/Interface';
|
||||
import type { Connection } from '@vue-flow/core';
|
||||
import type { Connection, ViewportTransform } from '@vue-flow/core';
|
||||
import type {
|
||||
CanvasConnectionCreateData,
|
||||
CanvasNode,
|
||||
@@ -135,7 +135,7 @@ const templatesStore = useTemplatesStore();
|
||||
|
||||
const canvasEventBus = createEventBus();
|
||||
|
||||
const lastClickPosition = ref<XYPosition>([450, 450]);
|
||||
const lastClickPosition = ref<XYPosition>([0, 0]);
|
||||
|
||||
const { runWorkflow, stopCurrentExecution, stopWaitingForWebhook } = useRunWorkflow({ router });
|
||||
const {
|
||||
@@ -1303,6 +1303,13 @@ async function onSaveFromWithinExecutionDebug() {
|
||||
* Canvas
|
||||
*/
|
||||
|
||||
const viewportTransform = ref<ViewportTransform>({ x: 0, y: 0, zoom: 1 });
|
||||
|
||||
function onViewportChange(event: ViewportTransform) {
|
||||
viewportTransform.value = event;
|
||||
uiStore.nodeViewOffsetPosition = [event.x, event.y];
|
||||
}
|
||||
|
||||
function fitView() {
|
||||
setTimeout(() => canvasEventBus.emit('fitView'));
|
||||
}
|
||||
@@ -1500,6 +1507,7 @@ onBeforeUnmount(() => {
|
||||
@run:workflow="onRunWorkflow"
|
||||
@save:workflow="onSaveWorkflow"
|
||||
@create:workflow="onCreateWorkflow"
|
||||
@viewport-change="onViewportChange"
|
||||
>
|
||||
<div :class="$style.executionButtons">
|
||||
<CanvasRunWorkflowButton
|
||||
@@ -1528,7 +1536,7 @@ onBeforeUnmount(() => {
|
||||
<NodeCreation
|
||||
v-if="!isCanvasReadOnly"
|
||||
:create-node-active="uiStore.isCreateNodeActive"
|
||||
:node-view-scale="1"
|
||||
:node-view-scale="viewportTransform.zoom"
|
||||
@toggle-node-creator="onOpenNodeCreator"
|
||||
@add-nodes="onAddNodesAndConnections"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user