fix: address coderabbitai review comments

This commit is contained in:
DrJKL
2026-01-12 15:02:32 -08:00
parent d1317a37cd
commit 0634364fd4
7 changed files with 17 additions and 17 deletions

View File

@@ -7073,22 +7073,20 @@ export class LGraphCanvas implements CustomEventDispatcher<LGraphCanvasEventMap>
const defaultY = rect.top + rect.height * 0.5
const safeEvent =
event ??
Object.assign(
new MouseEvent('click', {
clientX: rect.left + rect.width * 0.5,
clientY: defaultY
}),
{ layerY: defaultY } // layerY is a nonstandard property used below
)
new MouseEvent('click', {
clientX: rect.left + rect.width * 0.5,
clientY: defaultY
})
const left = safeEvent.clientX - 80
const top = safeEvent.clientY - 20
dialog.style.left = `${left}px`
dialog.style.top = `${top}px`
// To avoid out of screen problems
if (safeEvent.layerY > rect.height - 200) {
helper.style.maxHeight = `${rect.height - safeEvent.layerY - 20}px`
// To avoid out of screen problems - derive layerY from clientY
const safeLayerY = event?.layerY ?? safeEvent.clientY - rect.top
if (safeLayerY > rect.height - 200) {
helper.style.maxHeight = `${rect.height - safeLayerY - 20}px`
}
requestAnimationFrame(function () {
input.focus()

View File

@@ -13,7 +13,7 @@ import type { ReadOnlyRect } from '@/lib/litegraph/src/interfaces'
const boundingRect: ReadOnlyRect = [0, 0, 10, 10]
describe('NodeSlot', () => {
describe('inputAsSerialisable', () => {
describe('outputAsSerialisable', () => {
it('removes _data from serialized slot', () => {
const slot: INodeOutputSlot & { _data: string } = {
_data: 'test data',

View File

@@ -49,15 +49,15 @@ export interface SettingParams<TValue = any> extends FormItem {
hideInVueNodes?: boolean
}
/**
* The base form item for rendering in a form.
*/
/**
* Legacy options function type for dynamic options.
* @deprecated Use static options array instead.
*/
type LegacyOptionsFunction = (value: unknown) => Array<string | SettingOption>
/**
* The base form item for rendering in a form.
*/
export interface FormItem {
name: string
type: SettingInputType | SettingCustomRenderer

View File

@@ -211,6 +211,7 @@ abstract class BaseDOMWidgetImpl<V extends object | string>
}
override createCopyForNode(node: LGraphNode): this {
// Safe: subclasses override getCloneArgs to return constructor-compatible args
const Ctor = this.constructor as new (args: Record<string, unknown>) => this
const cloned = new Ctor(this.getCloneArgs(node))
cloned.value = this.value

View File

@@ -166,8 +166,10 @@ export class DraggableList extends EventTarget {
}
initItemsState() {
const draggable = this.draggableItem
if (!draggable) return
this.getIdleItems().forEach((item, i) => {
if (this.getAllItems().indexOf(this.draggableItem!) > i) {
if (this.getAllItems().indexOf(draggable) > i) {
item.dataset.isAbove = ''
}
})

View File

@@ -73,7 +73,7 @@ export function createImageHost(node: LGraphNode) {
}
el.style.setProperty('--comfy-widget-min-height', elH.toString())
} else {
el.style.setProperty('--comfy-widget-min-height', null)
el.style.removeProperty('--comfy-widget-min-height')
}
const nw = node.size[0]

View File

@@ -9,6 +9,5 @@ import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/w
* ISerialisedGraph is the LiteGraph serialization format.
*
* TODO: Align these schemas to eliminate the need for this cast.
* @see https://github.com/Comfy-Org/ComfyUI_frontend/issues/XXXX
*/
export type WorkflowAsGraph = ComfyWorkflowJSON & ISerialisedGraph