diff --git a/browser_tests/tests/vueNodes/nodeStates/lod.spec.ts-snapshots/vue-nodes-lod-active-chromium-linux.png b/browser_tests/tests/vueNodes/nodeStates/lod.spec.ts-snapshots/vue-nodes-lod-active-chromium-linux.png index 9b4dcc6f8..3cdc29049 100644 Binary files a/browser_tests/tests/vueNodes/nodeStates/lod.spec.ts-snapshots/vue-nodes-lod-active-chromium-linux.png and b/browser_tests/tests/vueNodes/nodeStates/lod.spec.ts-snapshots/vue-nodes-lod-active-chromium-linux.png differ diff --git a/src/platform/settings/settingStore.ts b/src/platform/settings/settingStore.ts index 5a1573efb..83742de70 100644 --- a/src/platform/settings/settingStore.ts +++ b/src/platform/settings/settingStore.ts @@ -38,8 +38,9 @@ function onChange( } // Backward compatibility with old settings dialog. // Some extensions still listens event emitted by the old settings dialog. - // @ts-expect-error 'setting' is possibly 'undefined'.ts(18048) - app.ui.settings.dispatchChange(setting.id, newValue, oldValue) + if (setting) { + app.ui.settings.dispatchChange(setting.id, newValue, oldValue) + } } export const useSettingStore = defineStore('setting', () => { diff --git a/src/renderer/extensions/vueNodes/components/LGraphNode.vue b/src/renderer/extensions/vueNodes/components/LGraphNode.vue index 6130e9c42..28aa3ac11 100644 --- a/src/renderer/extensions/vueNodes/components/LGraphNode.vue +++ b/src/renderer/extensions/vueNodes/components/LGraphNode.vue @@ -154,7 +154,6 @@ import { useTelemetry } from '@/platform/telemetry' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions' import { layoutStore } from '@/renderer/core/layout/store/layoutStore' -import { useTransformState } from '@/renderer/core/layout/transform/useTransformState' import SlotConnectionDot from '@/renderer/extensions/vueNodes/components/SlotConnectionDot.vue' import { useNodeEventHandlers } from '@/renderer/extensions/vueNodes/composables/useNodeEventHandlers' import { useNodePointerInteractions } from '@/renderer/extensions/vueNodes/composables/useNodePointerInteractions' @@ -201,13 +200,6 @@ const { bringNodeToFront } = useNodeZIndex() useVueElementTracking(() => nodeData.id, 'node') -const transformState = useTransformState() -if (!transformState) { - throw new Error( - 'TransformState must be provided for node resize functionality' - ) -} - const { selectedNodeIds } = storeToRefs(useCanvasStore()) const isSelected = computed(() => { return selectedNodeIds.value.has(nodeData.id) @@ -364,29 +356,24 @@ const cornerResizeHandles: CornerResizeHandle[] = [ const MIN_NODE_WIDTH = 225 -const { startResize } = useNodeResize( - (result, element) => { - if (isCollapsed.value) return +const { startResize } = useNodeResize((result, element) => { + if (isCollapsed.value) return - // Clamp width to minimum to avoid conflicts with CSS min-width - const clampedWidth = Math.max(result.size.width, MIN_NODE_WIDTH) + // Clamp width to minimum to avoid conflicts with CSS min-width + const clampedWidth = Math.max(result.size.width, MIN_NODE_WIDTH) - // Apply size directly to DOM element - ResizeObserver will pick this up - element.style.setProperty('--node-width', `${clampedWidth}px`) - element.style.setProperty('--node-height', `${result.size.height}px`) + // Apply size directly to DOM element - ResizeObserver will pick this up + element.style.setProperty('--node-width', `${clampedWidth}px`) + element.style.setProperty('--node-height', `${result.size.height}px`) - const currentPosition = position.value - const deltaX = Math.abs(result.position.x - currentPosition.x) - const deltaY = Math.abs(result.position.y - currentPosition.y) + const currentPosition = position.value + const deltaX = Math.abs(result.position.x - currentPosition.x) + const deltaY = Math.abs(result.position.y - currentPosition.y) - if (deltaX > POSITION_EPSILON || deltaY > POSITION_EPSILON) { - moveNodeTo(result.position) - } - }, - { - transformState + if (deltaX > POSITION_EPSILON || deltaY > POSITION_EPSILON) { + moveNodeTo(result.position) } -) +}) const handleResizePointerDown = (direction: ResizeHandleDirection) => { return (event: PointerEvent) => { diff --git a/src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.ts b/src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.ts index 823ffefbf..4d63e00ab 100644 --- a/src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.ts +++ b/src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.ts @@ -7,12 +7,7 @@ import { useShiftKeySync } from '@/renderer/extensions/vueNodes/composables/useS import type { ResizeHandleDirection } from './resizeMath' import { createResizeSession, toCanvasDelta } from './resizeMath' -import type { useTransformState } from '@/renderer/core/layout/transform/useTransformState' - -interface UseNodeResizeOptions { - /** Transform state for coordinate conversion */ - transformState: ReturnType -} +import { useTransformState } from '@/renderer/core/layout/transform/useTransformState' interface ResizeCallbackPayload { size: Size @@ -26,13 +21,9 @@ interface ResizeCallbackPayload { * Handles pointer capture, coordinate calculations, and size constraints. */ export function useNodeResize( - resizeCallback: ( - payload: ResizeCallbackPayload, - element: HTMLElement - ) => void, - options: UseNodeResizeOptions + resizeCallback: (payload: ResizeCallbackPayload, element: HTMLElement) => void ) { - const { transformState } = options + const transformState = useTransformState() const isResizing = ref(false) const resizeStartPointer = ref(null)