Skip to content

Commit 31be0a0

Browse files
authored
Use upstreamed viewport serialisation (#3864)
1 parent d9ab427 commit 31be0a0

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</template>
4545

4646
<script setup lang="ts">
47-
import type { LGraphNode, Point } from '@comfyorg/litegraph'
47+
import type { LGraphNode } from '@comfyorg/litegraph'
4848
import { useEventListener } from '@vueuse/core'
4949
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
5050
@@ -225,32 +225,6 @@ watch(
225225
}
226226
)
227227
228-
// Save the drag & scale info in the serialized workflow if the setting is enabled
229-
watch(
230-
[
231-
() => canvasStore.canvas,
232-
() => settingStore.get('Comfy.EnableWorkflowViewRestore')
233-
],
234-
([canvas, enableWorkflowViewRestore]) => {
235-
const extra = canvas?.graph?.extra
236-
if (!extra) return
237-
238-
if (enableWorkflowViewRestore) {
239-
extra.ds = {
240-
get scale() {
241-
return canvas.ds.scale
242-
},
243-
get offset() {
244-
const [x, y] = canvas.ds.offset
245-
return [x, y] satisfies Point
246-
}
247-
}
248-
} else {
249-
delete extra.ds
250-
}
251-
}
252-
)
253-
254228
useEventListener(
255229
canvasRef,
256230
'litegraph:no-items-selected',

src/composables/useLitegraphSettings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,10 @@ export const useLitegraphSettings = () => {
128128
'LiteGraph.Pointer.TrackpadGestures'
129129
)
130130
})
131+
132+
watchEffect(() => {
133+
LiteGraph.saveViewportWithGraph = settingStore.get(
134+
'Comfy.EnableWorkflowViewRestore'
135+
)
136+
})
131137
}

0 commit comments

Comments
 (0)