From e8c1e9aa2ec49daf2432b9909c27103654e2de2b Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 31 Jul 2025 16:12:17 -0700 Subject: [PATCH 1/3] [refactor] Extract selection filtering logic to useSelectedLiteGraphItems composable - Create new composable to handle filtering of selected LiteGraph items - Move Reroute filtering logic from SelectionOverlay to the composable - Add comprehensive unit tests for the new composable - Refactor SelectionOverlay to use the new composable This improves code organization by extracting reusable selection logic that can be shared across components. --- src/components/graph/SelectionOverlay.vue | 12 +- .../graph/useSelectedLiteGraphItems.ts | 77 ++++++ .../graph/useSelectedLiteGraphItems.test.ts | 226 ++++++++++++++++++ 3 files changed, 309 insertions(+), 6 deletions(-) create mode 100644 src/composables/graph/useSelectedLiteGraphItems.ts create mode 100644 tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts diff --git a/src/components/graph/SelectionOverlay.vue b/src/components/graph/SelectionOverlay.vue index aa1f11c766..507f85c9fb 100644 --- a/src/components/graph/SelectionOverlay.vue +++ b/src/components/graph/SelectionOverlay.vue @@ -18,25 +18,26 @@ import { whenever } from '@vueuse/core' import { ref, watch } from 'vue' import { useAbsolutePosition } from '@/composables/element/useAbsolutePosition' +import { useSelectedLiteGraphItems } from '@/composables/graph/useSelectedLiteGraphItems' import { useCanvasStore } from '@/stores/graphStore' const canvasStore = useCanvasStore() const { style, updatePosition } = useAbsolutePosition() +const { selectableItems, hasSelectableItems, hasMultipleSelectableItems } = + useSelectedLiteGraphItems() const visible = ref(false) const showBorder = ref(false) const positionSelectionOverlay = () => { - const { selectedItems } = canvasStore.getCanvas() - showBorder.value = selectedItems.size > 1 - - if (!selectedItems.size) { + if (!hasSelectableItems.value) { visible.value = false return } + showBorder.value = hasMultipleSelectableItems.value visible.value = true - const bounds = createBounds(selectedItems) + const bounds = createBounds(selectableItems.value) if (bounds) { updatePosition({ pos: [bounds[0], bounds[1]], @@ -45,7 +46,6 @@ const positionSelectionOverlay = () => { } } -// Register listener on canvas creation. whenever( () => canvasStore.getCanvas().state.selectionChanged, () => { diff --git a/src/composables/graph/useSelectedLiteGraphItems.ts b/src/composables/graph/useSelectedLiteGraphItems.ts new file mode 100644 index 0000000000..9e0b89886f --- /dev/null +++ b/src/composables/graph/useSelectedLiteGraphItems.ts @@ -0,0 +1,77 @@ +import { Positionable, Reroute } from '@comfyorg/litegraph' +import { ComputedRef, computed } from 'vue' + +import { useCanvasStore } from '@/stores/graphStore' + +/** + * Composable for handling selected LiteGraph items filtering and operations. + * This provides utilities for working with selected items on the canvas, + * including filtering out items that should not be included in selection operations. + */ +export function useSelectedLiteGraphItems() { + const canvasStore = useCanvasStore() + + /** + * Items that should not show in the selection overlay are ignored. + * @param item - The item to check. + * @returns True if the item should be ignored, false otherwise. + */ + const isIgnoredItem = (item: Positionable): boolean => { + return item instanceof Reroute + } + + /** + * Filter out items that should not show in the selection overlay. + * @param items - The Set of items to filter. + * @returns The filtered Set of items. + */ + const filterSelectableItems = ( + items: Set + ): Set => { + const result = new Set() + for (const item of items) { + if (!isIgnoredItem(item)) { + result.add(item) + } + } + return result + } + + /** + * Get the raw selected items from the canvas. + * Note: This returns the store's reactive array which is updated via updateSelectedItems(). + */ + const selectedItems: ComputedRef = computed(() => { + return canvasStore.selectedItems + }) + + /** + * Get the filtered selected items that should be included in selection operations. + */ + const selectableItems: ComputedRef> = computed(() => { + return filterSelectableItems(new Set(selectedItems.value)) + }) + + /** + * Check if there are any selectable items. + */ + const hasSelectableItems: ComputedRef = computed(() => { + return selectableItems.value.size > 0 + }) + + /** + * Check if there are multiple selectable items. + */ + const hasMultipleSelectableItems: ComputedRef = computed(() => { + return selectableItems.value.size > 1 + }) + + return { + isIgnoredItem, + filterSelectableItems, + selectedItems, + selectableItems, + hasSelectableItems, + hasMultipleSelectableItems + } +} diff --git a/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts b/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts new file mode 100644 index 0000000000..9e16c82d63 --- /dev/null +++ b/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts @@ -0,0 +1,226 @@ +import { Positionable, Reroute } from '@comfyorg/litegraph' +import { createPinia, setActivePinia } from 'pinia' +import { beforeEach, describe, expect, it, vi } from 'vitest' +import { markRaw } from 'vue' + +import { useSelectedLiteGraphItems } from '@/composables/graph/useSelectedLiteGraphItems' +import { useCanvasStore } from '@/stores/graphStore' + +// Mock the litegraph module +vi.mock('@comfyorg/litegraph', () => ({ + Reroute: class Reroute { + constructor() {} + } +})) + +// Mock Positionable objects +// @ts-expect-error - Mock implementation for testing +class MockNode implements Positionable { + pos: [number, number] + size: [number, number] + + constructor( + pos: [number, number] = [0, 0], + size: [number, number] = [100, 100] + ) { + this.pos = pos + this.size = size + } +} + +class MockReroute extends Reroute implements Positionable { + // @ts-expect-error - Override for testing + override pos: [number, number] + size: [number, number] + + constructor( + pos: [number, number] = [0, 0], + size: [number, number] = [20, 20] + ) { + // @ts-expect-error - Mock constructor + super() + this.pos = pos + this.size = size + } +} + +describe('useSelectedLiteGraphItems', () => { + let canvasStore: ReturnType + + beforeEach(() => { + setActivePinia(createPinia()) + canvasStore = useCanvasStore() + + // Initialize selectedItems as empty array + canvasStore.selectedItems = [] + }) + + describe('isIgnoredItem', () => { + it('should return true for Reroute instances', () => { + const { isIgnoredItem } = useSelectedLiteGraphItems() + const reroute = new MockReroute() + expect(isIgnoredItem(reroute)).toBe(true) + }) + + it('should return false for non-Reroute items', () => { + const { isIgnoredItem } = useSelectedLiteGraphItems() + const node = new MockNode() + // @ts-expect-error - Test mock + expect(isIgnoredItem(node)).toBe(false) + }) + }) + + describe('filterSelectableItems', () => { + it('should filter out Reroute items', () => { + const { filterSelectableItems } = useSelectedLiteGraphItems() + const node1 = new MockNode([0, 0]) + const node2 = new MockNode([100, 100]) + const reroute = new MockReroute([50, 50]) + + // @ts-expect-error - Test mocks + const items = new Set([node1, node2, reroute]) + const filtered = filterSelectableItems(items) + + expect(filtered.size).toBe(2) + // @ts-expect-error - Test mocks + expect(filtered.has(node1)).toBe(true) + // @ts-expect-error - Test mocks + expect(filtered.has(node2)).toBe(true) + expect(filtered.has(reroute)).toBe(false) + }) + + it('should return empty set when all items are ignored', () => { + const { filterSelectableItems } = useSelectedLiteGraphItems() + const reroute1 = new MockReroute([0, 0]) + const reroute2 = new MockReroute([50, 50]) + + const items = new Set([reroute1, reroute2]) + const filtered = filterSelectableItems(items) + + expect(filtered.size).toBe(0) + }) + + it('should handle empty set', () => { + const { filterSelectableItems } = useSelectedLiteGraphItems() + const items = new Set() + const filtered = filterSelectableItems(items) + + expect(filtered.size).toBe(0) + }) + }) + + describe('computed properties', () => { + it('selectedItems should return all selected items from store', () => { + const { selectedItems } = useSelectedLiteGraphItems() + const node = markRaw(new MockNode()) + const reroute = markRaw(new MockReroute()) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node, reroute] + + expect(selectedItems.value.length).toBe(2) + expect(selectedItems.value[0]).toBe(node) + expect(selectedItems.value[1]).toBe(reroute) + }) + + it('selectableItems should return only non-ignored items', () => { + const { selectableItems } = useSelectedLiteGraphItems() + const node1 = markRaw(new MockNode()) + const node2 = markRaw(new MockNode()) + const reroute = markRaw(new MockReroute()) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node1, node2, reroute] + + expect(selectableItems.value.size).toBe(2) + const selectableArray = Array.from(selectableItems.value) + expect(selectableArray).toContain(node1) + expect(selectableArray).toContain(node2) + expect(selectableArray).not.toContain(reroute) + }) + + it('hasSelectableItems should be true when there are selectable items', () => { + const { hasSelectableItems } = useSelectedLiteGraphItems() + const node = markRaw(new MockNode()) + + expect(hasSelectableItems.value).toBe(false) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node] + expect(hasSelectableItems.value).toBe(true) + }) + + it('hasSelectableItems should be false when only ignored items are selected', () => { + const { hasSelectableItems } = useSelectedLiteGraphItems() + const reroute = markRaw(new MockReroute()) + + canvasStore.selectedItems = [reroute] + expect(hasSelectableItems.value).toBe(false) + }) + + it('hasMultipleSelectableItems should be true when there are 2+ selectable items', () => { + const { hasMultipleSelectableItems } = useSelectedLiteGraphItems() + const node1 = markRaw(new MockNode()) + const node2 = markRaw(new MockNode()) + + expect(hasMultipleSelectableItems.value).toBe(false) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node1] + expect(hasMultipleSelectableItems.value).toBe(false) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node1, node2] + expect(hasMultipleSelectableItems.value).toBe(true) + }) + + it('hasMultipleSelectableItems should not count ignored items', () => { + const { hasMultipleSelectableItems } = useSelectedLiteGraphItems() + const node = markRaw(new MockNode()) + const reroute1 = markRaw(new MockReroute()) + const reroute2 = markRaw(new MockReroute()) + + // @ts-expect-error - Test data + canvasStore.selectedItems = [node, reroute1, reroute2] + + // Even though there are 3 items total, only 1 is selectable + expect(hasMultipleSelectableItems.value).toBe(false) + }) + }) + + describe('reactivity', () => { + it('computed properties should update when selectedItems change', () => { + const { + selectableItems, + hasSelectableItems, + hasMultipleSelectableItems + } = useSelectedLiteGraphItems() + const node1 = markRaw(new MockNode()) + const node2 = markRaw(new MockNode()) + + expect(hasSelectableItems.value).toBe(false) + expect(hasMultipleSelectableItems.value).toBe(false) + + // Add first node + // @ts-expect-error - Test data + canvasStore.selectedItems = [node1] + expect(hasSelectableItems.value).toBe(true) + expect(hasMultipleSelectableItems.value).toBe(false) + expect(selectableItems.value.size).toBe(1) + + // Add second node + // @ts-expect-error - Test data + canvasStore.selectedItems = [node1, node2] + expect(hasSelectableItems.value).toBe(true) + expect(hasMultipleSelectableItems.value).toBe(true) + expect(selectableItems.value.size).toBe(2) + + // Remove a node + // @ts-expect-error - Test data + canvasStore.selectedItems = [node2] + expect(hasSelectableItems.value).toBe(true) + expect(hasMultipleSelectableItems.value).toBe(false) + expect(selectableItems.value.size).toBe(1) + }) + }) +}) From 288b686fe480a72f76eb4618703147eaf6c1b106 Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 31 Jul 2025 16:54:57 -0700 Subject: [PATCH 2/3] [fix] Change composable to use methods instead of computed properties The original implementation used computed properties that accessed the store's selectedItems array, but the canvas maintains its own selectedItems Set that needs to be accessed dynamically. Changed to use methods that directly access the canvas selectedItems each time they're called. This fixes the selection overlay to properly update when items are selected. --- src/components/graph/SelectionOverlay.vue | 11 +- .../graph/useSelectedLiteGraphItems.ts | 36 ++--- .../graph/useSelectedLiteGraphItems.test.ts | 138 ++++++++---------- 3 files changed, 85 insertions(+), 100 deletions(-) diff --git a/src/components/graph/SelectionOverlay.vue b/src/components/graph/SelectionOverlay.vue index 507f85c9fb..329c7bd08f 100644 --- a/src/components/graph/SelectionOverlay.vue +++ b/src/components/graph/SelectionOverlay.vue @@ -23,21 +23,22 @@ import { useCanvasStore } from '@/stores/graphStore' const canvasStore = useCanvasStore() const { style, updatePosition } = useAbsolutePosition() -const { selectableItems, hasSelectableItems, hasMultipleSelectableItems } = - useSelectedLiteGraphItems() +const { getSelectableItems } = useSelectedLiteGraphItems() const visible = ref(false) const showBorder = ref(false) const positionSelectionOverlay = () => { - if (!hasSelectableItems.value) { + const selectableItems = getSelectableItems() + showBorder.value = selectableItems.size > 1 + + if (!selectableItems.size) { visible.value = false return } - showBorder.value = hasMultipleSelectableItems.value visible.value = true - const bounds = createBounds(selectableItems.value) + const bounds = createBounds(selectableItems) if (bounds) { updatePosition({ pos: [bounds[0], bounds[1]], diff --git a/src/composables/graph/useSelectedLiteGraphItems.ts b/src/composables/graph/useSelectedLiteGraphItems.ts index 9e0b89886f..3d44fe089f 100644 --- a/src/composables/graph/useSelectedLiteGraphItems.ts +++ b/src/composables/graph/useSelectedLiteGraphItems.ts @@ -1,5 +1,4 @@ import { Positionable, Reroute } from '@comfyorg/litegraph' -import { ComputedRef, computed } from 'vue' import { useCanvasStore } from '@/stores/graphStore' @@ -38,39 +37,34 @@ export function useSelectedLiteGraphItems() { } /** - * Get the raw selected items from the canvas. - * Note: This returns the store's reactive array which is updated via updateSelectedItems(). + * Get the filtered selected items from the canvas. + * @returns The filtered Set of selected items. */ - const selectedItems: ComputedRef = computed(() => { - return canvasStore.selectedItems - }) - - /** - * Get the filtered selected items that should be included in selection operations. - */ - const selectableItems: ComputedRef> = computed(() => { - return filterSelectableItems(new Set(selectedItems.value)) - }) + const getSelectableItems = (): Set => { + const { selectedItems } = canvasStore.getCanvas() + return filterSelectableItems(selectedItems) + } /** * Check if there are any selectable items. + * @returns True if there are selectable items, false otherwise. */ - const hasSelectableItems: ComputedRef = computed(() => { - return selectableItems.value.size > 0 - }) + const hasSelectableItems = (): boolean => { + return getSelectableItems().size > 0 + } /** * Check if there are multiple selectable items. + * @returns True if there are multiple selectable items, false otherwise. */ - const hasMultipleSelectableItems: ComputedRef = computed(() => { - return selectableItems.value.size > 1 - }) + const hasMultipleSelectableItems = (): boolean => { + return getSelectableItems().size > 1 + } return { isIgnoredItem, filterSelectableItems, - selectedItems, - selectableItems, + getSelectableItems, hasSelectableItems, hasMultipleSelectableItems } diff --git a/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts b/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts index 9e16c82d63..72186dc017 100644 --- a/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts +++ b/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts @@ -1,7 +1,6 @@ import { Positionable, Reroute } from '@comfyorg/litegraph' import { createPinia, setActivePinia } from 'pinia' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { markRaw } from 'vue' import { useSelectedLiteGraphItems } from '@/composables/graph/useSelectedLiteGraphItems' import { useCanvasStore } from '@/stores/graphStore' @@ -46,13 +45,19 @@ class MockReroute extends Reroute implements Positionable { describe('useSelectedLiteGraphItems', () => { let canvasStore: ReturnType + let mockCanvas: any beforeEach(() => { setActivePinia(createPinia()) canvasStore = useCanvasStore() - // Initialize selectedItems as empty array - canvasStore.selectedItems = [] + // Mock canvas with selectedItems Set + mockCanvas = { + selectedItems: new Set() + } + + // Mock getCanvas to return our mock canvas + vi.spyOn(canvasStore, 'getCanvas').mockReturnValue(mockCanvas) }) describe('isIgnoredItem', () => { @@ -109,118 +114,103 @@ describe('useSelectedLiteGraphItems', () => { }) }) - describe('computed properties', () => { - it('selectedItems should return all selected items from store', () => { - const { selectedItems } = useSelectedLiteGraphItems() - const node = markRaw(new MockNode()) - const reroute = markRaw(new MockReroute()) - - // @ts-expect-error - Test data - canvasStore.selectedItems = [node, reroute] - - expect(selectedItems.value.length).toBe(2) - expect(selectedItems.value[0]).toBe(node) - expect(selectedItems.value[1]).toBe(reroute) - }) - - it('selectableItems should return only non-ignored items', () => { - const { selectableItems } = useSelectedLiteGraphItems() - const node1 = markRaw(new MockNode()) - const node2 = markRaw(new MockNode()) - const reroute = markRaw(new MockReroute()) + describe('methods', () => { + it('getSelectableItems should return only non-ignored items', () => { + const { getSelectableItems } = useSelectedLiteGraphItems() + const node1 = new MockNode() + const node2 = new MockNode() + const reroute = new MockReroute() - // @ts-expect-error - Test data - canvasStore.selectedItems = [node1, node2, reroute] + mockCanvas.selectedItems.add(node1) + mockCanvas.selectedItems.add(node2) + mockCanvas.selectedItems.add(reroute) - expect(selectableItems.value.size).toBe(2) - const selectableArray = Array.from(selectableItems.value) - expect(selectableArray).toContain(node1) - expect(selectableArray).toContain(node2) - expect(selectableArray).not.toContain(reroute) + const selectableItems = getSelectableItems() + expect(selectableItems.size).toBe(2) + // @ts-expect-error - Test mock + expect(selectableItems.has(node1)).toBe(true) + // @ts-expect-error - Test mock + expect(selectableItems.has(node2)).toBe(true) + expect(selectableItems.has(reroute)).toBe(false) }) it('hasSelectableItems should be true when there are selectable items', () => { const { hasSelectableItems } = useSelectedLiteGraphItems() - const node = markRaw(new MockNode()) + const node = new MockNode() - expect(hasSelectableItems.value).toBe(false) + expect(hasSelectableItems()).toBe(false) - // @ts-expect-error - Test data - canvasStore.selectedItems = [node] - expect(hasSelectableItems.value).toBe(true) + mockCanvas.selectedItems.add(node) + expect(hasSelectableItems()).toBe(true) }) it('hasSelectableItems should be false when only ignored items are selected', () => { const { hasSelectableItems } = useSelectedLiteGraphItems() - const reroute = markRaw(new MockReroute()) + const reroute = new MockReroute() - canvasStore.selectedItems = [reroute] - expect(hasSelectableItems.value).toBe(false) + mockCanvas.selectedItems.add(reroute) + expect(hasSelectableItems()).toBe(false) }) it('hasMultipleSelectableItems should be true when there are 2+ selectable items', () => { const { hasMultipleSelectableItems } = useSelectedLiteGraphItems() - const node1 = markRaw(new MockNode()) - const node2 = markRaw(new MockNode()) + const node1 = new MockNode() + const node2 = new MockNode() - expect(hasMultipleSelectableItems.value).toBe(false) + expect(hasMultipleSelectableItems()).toBe(false) - // @ts-expect-error - Test data - canvasStore.selectedItems = [node1] - expect(hasMultipleSelectableItems.value).toBe(false) + mockCanvas.selectedItems.add(node1) + expect(hasMultipleSelectableItems()).toBe(false) - // @ts-expect-error - Test data - canvasStore.selectedItems = [node1, node2] - expect(hasMultipleSelectableItems.value).toBe(true) + mockCanvas.selectedItems.add(node2) + expect(hasMultipleSelectableItems()).toBe(true) }) it('hasMultipleSelectableItems should not count ignored items', () => { const { hasMultipleSelectableItems } = useSelectedLiteGraphItems() - const node = markRaw(new MockNode()) - const reroute1 = markRaw(new MockReroute()) - const reroute2 = markRaw(new MockReroute()) + const node = new MockNode() + const reroute1 = new MockReroute() + const reroute2 = new MockReroute() - // @ts-expect-error - Test data - canvasStore.selectedItems = [node, reroute1, reroute2] + mockCanvas.selectedItems.add(node) + mockCanvas.selectedItems.add(reroute1) + mockCanvas.selectedItems.add(reroute2) // Even though there are 3 items total, only 1 is selectable - expect(hasMultipleSelectableItems.value).toBe(false) + expect(hasMultipleSelectableItems()).toBe(false) }) }) - describe('reactivity', () => { - it('computed properties should update when selectedItems change', () => { + describe('dynamic behavior', () => { + it('methods should reflect changes when selectedItems change', () => { const { - selectableItems, + getSelectableItems, hasSelectableItems, hasMultipleSelectableItems } = useSelectedLiteGraphItems() - const node1 = markRaw(new MockNode()) - const node2 = markRaw(new MockNode()) + const node1 = new MockNode() + const node2 = new MockNode() - expect(hasSelectableItems.value).toBe(false) - expect(hasMultipleSelectableItems.value).toBe(false) + expect(hasSelectableItems()).toBe(false) + expect(hasMultipleSelectableItems()).toBe(false) // Add first node - // @ts-expect-error - Test data - canvasStore.selectedItems = [node1] - expect(hasSelectableItems.value).toBe(true) - expect(hasMultipleSelectableItems.value).toBe(false) - expect(selectableItems.value.size).toBe(1) + mockCanvas.selectedItems.add(node1) + expect(hasSelectableItems()).toBe(true) + expect(hasMultipleSelectableItems()).toBe(false) + expect(getSelectableItems().size).toBe(1) // Add second node - // @ts-expect-error - Test data - canvasStore.selectedItems = [node1, node2] - expect(hasSelectableItems.value).toBe(true) - expect(hasMultipleSelectableItems.value).toBe(true) - expect(selectableItems.value.size).toBe(2) + mockCanvas.selectedItems.add(node2) + expect(hasSelectableItems()).toBe(true) + expect(hasMultipleSelectableItems()).toBe(true) + expect(getSelectableItems().size).toBe(2) // Remove a node - // @ts-expect-error - Test data - canvasStore.selectedItems = [node2] - expect(hasSelectableItems.value).toBe(true) - expect(hasMultipleSelectableItems.value).toBe(false) - expect(selectableItems.value.size).toBe(1) + mockCanvas.selectedItems.delete(node1) + expect(hasSelectableItems()).toBe(true) + expect(hasMultipleSelectableItems()).toBe(false) + expect(getSelectableItems().size).toBe(1) }) }) }) From a27a7aa39c7b3fc1c389feca4e272f71d70b0d91 Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 31 Jul 2025 17:25:58 -0700 Subject: [PATCH 3/3] [refactor] Move useSelectedLiteGraphItems to composables/canvas This composable deals with canvas rendering/selection visualization, not the graph data model, so it belongs in composables/canvas/ instead of composables/graph/. --- src/components/graph/SelectionOverlay.vue | 2 +- src/composables/{graph => canvas}/useSelectedLiteGraphItems.ts | 0 .../{graph => canvas}/useSelectedLiteGraphItems.test.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/composables/{graph => canvas}/useSelectedLiteGraphItems.ts (100%) rename tests-ui/tests/composables/{graph => canvas}/useSelectedLiteGraphItems.test.ts (98%) diff --git a/src/components/graph/SelectionOverlay.vue b/src/components/graph/SelectionOverlay.vue index 329c7bd08f..d998dad061 100644 --- a/src/components/graph/SelectionOverlay.vue +++ b/src/components/graph/SelectionOverlay.vue @@ -17,8 +17,8 @@ import { createBounds } from '@comfyorg/litegraph' import { whenever } from '@vueuse/core' import { ref, watch } from 'vue' +import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' import { useAbsolutePosition } from '@/composables/element/useAbsolutePosition' -import { useSelectedLiteGraphItems } from '@/composables/graph/useSelectedLiteGraphItems' import { useCanvasStore } from '@/stores/graphStore' const canvasStore = useCanvasStore() diff --git a/src/composables/graph/useSelectedLiteGraphItems.ts b/src/composables/canvas/useSelectedLiteGraphItems.ts similarity index 100% rename from src/composables/graph/useSelectedLiteGraphItems.ts rename to src/composables/canvas/useSelectedLiteGraphItems.ts diff --git a/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts b/tests-ui/tests/composables/canvas/useSelectedLiteGraphItems.test.ts similarity index 98% rename from tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts rename to tests-ui/tests/composables/canvas/useSelectedLiteGraphItems.test.ts index 72186dc017..4bbbc906bd 100644 --- a/tests-ui/tests/composables/graph/useSelectedLiteGraphItems.test.ts +++ b/tests-ui/tests/composables/canvas/useSelectedLiteGraphItems.test.ts @@ -2,7 +2,7 @@ import { Positionable, Reroute } from '@comfyorg/litegraph' import { createPinia, setActivePinia } from 'pinia' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { useSelectedLiteGraphItems } from '@/composables/graph/useSelectedLiteGraphItems' +import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' import { useCanvasStore } from '@/stores/graphStore' // Mock the litegraph module