mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Add / fix canvas TS strict types, doc (#237)
* Fix circular depdency in global * Add TS type guard private function * Add TS type * Add TS types & doc * Add TS type initialisers * Add NullableProperties type * Add TS types * Split node arrange code out to separate file
This commit is contained in:
@@ -6,7 +6,6 @@ import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import { ContextMenu } from "./ContextMenu"
|
||||
import { CurveEditor } from "./CurveEditor"
|
||||
import { LGraphEventMode, LinkDirection, LinkRenderType, NodeSlotType, RenderShape, TitleMode } from "./types/globalEnums"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { SlotShape, SlotDirection, SlotType, LabelPosition } from "./draw"
|
||||
import type { Dictionary, ISlotType, Rect } from "./interfaces"
|
||||
@@ -709,7 +708,7 @@ export class LiteGraphGlobal {
|
||||
pointerListenerAdd(oDOM: Node, sEvIn: string, fCall: (e: Event) => boolean | void, capture = false): void {
|
||||
if (!oDOM || !oDOM.addEventListener || !sEvIn || typeof fCall !== "function") return
|
||||
|
||||
let sMethod = LiteGraph.pointerevents_method
|
||||
let sMethod = this.pointerevents_method
|
||||
let sEvent = sEvIn
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
@@ -777,16 +776,16 @@ export class LiteGraphGlobal {
|
||||
//both pointer and move events
|
||||
case "down": case "up": case "move": case "over": case "out": case "enter":
|
||||
{
|
||||
if (LiteGraph.pointerevents_method == "pointer" || LiteGraph.pointerevents_method == "mouse") {
|
||||
oDOM.removeEventListener(LiteGraph.pointerevents_method + sEvent, fCall, capture)
|
||||
if (this.pointerevents_method == "pointer" || this.pointerevents_method == "mouse") {
|
||||
oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture)
|
||||
}
|
||||
}
|
||||
// @ts-expect-error
|
||||
// only pointerevents
|
||||
case "leave": case "cancel": case "gotpointercapture": case "lostpointercapture":
|
||||
{
|
||||
if (LiteGraph.pointerevents_method == "pointer") {
|
||||
return oDOM.removeEventListener(LiteGraph.pointerevents_method + sEvent, fCall, capture)
|
||||
if (this.pointerevents_method == "pointer") {
|
||||
return oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture)
|
||||
}
|
||||
}
|
||||
// not "pointer" || "mouse"
|
||||
|
||||
Reference in New Issue
Block a user