Skip to content

Commit 263f52f

Browse files
Fix inconsistency on bypass from context menu (#4988) (#4997)
When a node is bypassed from the selection toolbox or by pressing a keybind for bypass, it will also recursively bypass the contents of a subgraph. This effect was not applied when clicking the bypass button from the context menu. The context menu option has been updated to perform the same action as the others so that behaviour is consistent. Co-authored-by: AustinMroz <[email protected]>
1 parent be7d239 commit 263f52f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/services/litegraphService.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import _ from 'lodash'
22

3+
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
34
import { useNodeAnimatedImage } from '@/composables/node/useNodeAnimatedImage'
45
import { useNodeCanvasImagePreview } from '@/composables/node/useNodeCanvasImagePreview'
56
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
@@ -63,6 +64,7 @@ export const useLitegraphService = () => {
6364
const toastStore = useToastStore()
6465
const widgetStore = useWidgetStore()
6566
const canvasStore = useCanvasStore()
67+
const { toggleSelectedNodesMode } = useSelectedLiteGraphItems()
6668

6769
// TODO: Dedupe `registerNodeDef`; this should remain synchronous.
6870
function registerSubgraphNodeDef(
@@ -762,15 +764,8 @@ export const useLitegraphService = () => {
762764
options.push({
763765
content: 'Bypass',
764766
callback: () => {
765-
const mode =
766-
this.mode === LGraphEventMode.BYPASS
767-
? LGraphEventMode.ALWAYS
768-
: LGraphEventMode.BYPASS
769-
for (const item of app.canvas.selectedItems) {
770-
if (item instanceof LGraphNode) item.mode = mode
771-
}
772-
// @ts-expect-error fixme ts strict error
773-
this.graph.change()
767+
toggleSelectedNodesMode(LGraphEventMode.BYPASS)
768+
app.canvas.setDirty(true, true)
774769
}
775770
})
776771

0 commit comments

Comments
 (0)