mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 07:14:11 +00:00
[Perf] Fix unnecessary canvas redraw (null vs undefined) (#715)
Fixes regression added in TS strict conversion. A fallback to `null` added to match the TS type, however value being stored was actually uncaught use of `undefined`. `null` !== `undefined` -> redraw every frame the pointer moves
This commit is contained in:
@@ -441,7 +441,7 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
/** used for widgets */
|
||||
node_widget?: [LGraphNode, IWidget] | null
|
||||
/** The link to draw a tooltip for. */
|
||||
over_link_center: LinkSegment | null
|
||||
over_link_center?: LinkSegment
|
||||
last_mouse_position: Point
|
||||
/** The visible area of this canvas. Tightly coupled with {@link ds}. */
|
||||
visible_area: Rect32
|
||||
@@ -678,7 +678,6 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
|
||||
this.current_node = null
|
||||
this.node_widget = null
|
||||
this.over_link_center = null
|
||||
this.last_mouse_position = [0, 0]
|
||||
this.visible_area = this.ds.visible_area
|
||||
this.visible_links = []
|
||||
@@ -2072,7 +2071,7 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
pointer.finally = () => this.dragging_canvas = false
|
||||
|
||||
// clear tooltip
|
||||
this.over_link_center = null
|
||||
this.over_link_center = undefined
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -2788,7 +2787,7 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
const segment = this.#getLinkCentreOnPos(e)
|
||||
if (this.over_link_center !== segment) {
|
||||
underPointer |= CanvasItem.Link
|
||||
this.over_link_center = segment ?? null
|
||||
this.over_link_center = segment
|
||||
this.dirty_bgcanvas = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user