mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
Typescript LGraphCanvas (#202)
* Format only * Revert accidental change * Fix redundant falsy check - uninit. var * nit - Refactor const/let * nit - Refactor const/let (manual) * nit - Redeclared params * Add TS types & minor refactor only * Refactor - Clean up / reformat - Add strings.ts helper functions - Remove unused vars & local function params - Simplifies code - Rename vars for clarity - Add TODOs and other comments - Add ts-expect-error * Redirect draw.ts enums to global file (temp.) Should be revisited after TS merge complete Corrects import of types from draw.ts into interfaces * Add measure.ts - move util funcs from Global * Add all imports required for TS conversion * Refactor - TS narrowing * nit - TS types & minor refactor * Add missing types from recent PRs Removes duplicate declarations Fixes some type mismatches * nit - Refactor recent PRs * Revert incorrect decls backported * Remove unused params * Add TS types only * Fix minor TS type coercion issues Also removes redundant code * nit - Refactor * Remove @ts-nocheck * Fix refactor regression - drag link to output Issue was the result of fixing var declared outside of closure * Restore original logic --------- Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
@@ -8,7 +8,7 @@ import type { LGraphCanvas } from "./LGraphCanvas"
|
||||
import type { CanvasMouseEvent } from "./types/events"
|
||||
import { BadgePosition, LGraphBadge } from "./LGraphBadge";
|
||||
import { LiteGraph } from "./litegraph";
|
||||
import { isInsideRectangle } from "./LiteGraphGlobal";
|
||||
import { isInsideRectangle } from "./measure";
|
||||
import { LLink } from "./LLink";
|
||||
|
||||
export type NodeId = number | string
|
||||
@@ -145,7 +145,7 @@ export class LGraphNode {
|
||||
_shape?: RenderShape
|
||||
subgraph?: LGraph
|
||||
skip_subgraph_button?: boolean
|
||||
mouseOver?: IMouseOverData
|
||||
mouseOver?: boolean
|
||||
is_selected?: boolean
|
||||
redraw_on_mouse?: boolean
|
||||
// Appears unused
|
||||
@@ -228,6 +228,7 @@ export class LGraphNode {
|
||||
onMouseMove?(this: LGraphNode, e: MouseEvent, pos: Point, arg2: LGraphCanvas): void
|
||||
onPropertyChange?(this: LGraphNode): void
|
||||
updateOutputData?(this: LGraphNode, origin_slot: number): void
|
||||
isValidWidgetLink?(slot_index: number, node: LGraphNode, overWidget: IWidget): boolean | undefined
|
||||
|
||||
constructor(title: string) {
|
||||
this._ctor(title);
|
||||
@@ -2705,7 +2706,7 @@ export class LGraphNode {
|
||||
* Forces the node to do not move or realign on Z or resize
|
||||
* @method pin
|
||||
**/
|
||||
pin(v) {
|
||||
pin(v?) {
|
||||
this.graph._version++;
|
||||
if (v === undefined) {
|
||||
this.flags.pinned = !this.flags.pinned;
|
||||
|
||||
Reference in New Issue
Block a user