Created
January 31, 2023 20:13
-
-
Save dannon/ca6a0131fdc23fa8bc8b756e1d111089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/client/src/components/Workflow/Editor/WorkflowGraph.vue b/client/src/components/Workflow/Editor/WorkflowGraph.vue | |
index 3dc2aa26b1..d3c0dfab5f 100644 | |
--- a/client/src/components/Workflow/Editor/WorkflowGraph.vue | |
+++ b/client/src/components/Workflow/Editor/WorkflowGraph.vue | |
@@ -68,7 +68,7 @@ const canvas: Ref<HTMLElement | null> = ref(null); | |
const elementBounding = useElementBounding(canvas, { windowResize: false, windowScroll: false }); | |
const scroll = useScroll(canvas); | |
-const { transform, panBy, setZoom, moveTo } = useD3Zoom(1, minZoom, maxZoom, canvas, scroll); | |
+const { transform, panBy, setZoom, moveTo } = useD3Zoom(1, minZoom, maxZoom, canvas, scroll, { x: 10, y: 10 }); | |
const isDragging = ref(false); | |
provide("isDragging", isDragging); | |
diff --git a/client/src/components/Workflow/Editor/composables/d3Zoom.ts b/client/src/components/Workflow/Editor/composables/d3Zoom.ts | |
index 17df1fc74d..1729866815 100644 | |
--- a/client/src/components/Workflow/Editor/composables/d3Zoom.ts | |
+++ b/client/src/components/Workflow/Editor/composables/d3Zoom.ts | |
@@ -17,9 +17,10 @@ export function useD3Zoom( | |
minZoom: number, | |
maxZoom: number, | |
targetRef: Ref<HTMLElement | null>, | |
- scroll: UseScrollReturn | |
+ scroll: UseScrollReturn, | |
+ initialOffset: XYPosition = { x: 0, y: 0 } | |
) { | |
- const transform = ref({ x: 0, y: 0, k: k }); | |
+ const transform = ref({ x: initialOffset.x, y: initialOffset.y, k: k }); | |
const d3Zoom = zoom<HTMLElement, unknown>().filter(filter).scaleExtent([minZoom, maxZoom]); | |
watch(targetRef, () => { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment