mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-19 06:20:10 +00:00
Convert static canvas vars to private static fields (#102)
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
@@ -7696,7 +7696,7 @@ const globalExport = {};
|
||||
/* Interaction */
|
||||
|
||||
/* LGraphCanvas render */
|
||||
var temp = new Float32Array(4);
|
||||
LGraphCanvas.#temp = new Float32Array(4);
|
||||
|
||||
/**
|
||||
* checks which nodes are visible (inside the camera area)
|
||||
@@ -7714,7 +7714,7 @@ const globalExport = {};
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!overlapBounding(this.visible_area, n.getBounding(temp, true))) {
|
||||
if (!overlapBounding(this.visible_area, n.getBounding(LGraphCanvas.#temp, true))) {
|
||||
continue;
|
||||
} //out of the visible area
|
||||
|
||||
@@ -8448,7 +8448,7 @@ const globalExport = {};
|
||||
this.dirty_canvas = true; //to force to repaint the front canvas with the bgcanvas
|
||||
};
|
||||
|
||||
var temp_vec2 = new Float32Array(2);
|
||||
LGraphCanvas.#temp_vec2 = new Float32Array(2);
|
||||
|
||||
/**
|
||||
* draws the given node inside the canvas
|
||||
@@ -8502,8 +8502,8 @@ const globalExport = {};
|
||||
|
||||
//clip if required (mask)
|
||||
var shape = node._shape || LiteGraph.BOX_SHAPE;
|
||||
var size = temp_vec2;
|
||||
temp_vec2.set(node.size);
|
||||
var size = LGraphCanvas.#temp_vec2;
|
||||
LGraphCanvas.#temp_vec2.set(node.size);
|
||||
var horizontal = node.horizontal; // || node.flags.horizontal;
|
||||
|
||||
if (node.flags.collapsed) {
|
||||
@@ -8943,7 +8943,7 @@ const globalExport = {};
|
||||
* draws the shape of the given node in the canvas
|
||||
* @method drawNodeShape
|
||||
**/
|
||||
var tmp_area = new Float32Array(4);
|
||||
LGraphCanvas.#tmp_area = new Float32Array(4);
|
||||
|
||||
LGraphCanvas.prototype.drawNodeShape = function(
|
||||
node,
|
||||
@@ -8974,7 +8974,7 @@ const globalExport = {};
|
||||
render_title = true;
|
||||
}
|
||||
|
||||
var area = tmp_area;
|
||||
var area = LGraphCanvas.#tmp_area;
|
||||
area[0] = 0; //x
|
||||
area[1] = render_title ? -title_height : 0; //y
|
||||
area[2] = size[0] + 1; //w
|
||||
@@ -9265,10 +9265,10 @@ const globalExport = {};
|
||||
if (node.action_triggered>0) node.action_triggered--;
|
||||
};
|
||||
|
||||
var margin_area = new Float32Array(4);
|
||||
var link_bounding = new Float32Array(4);
|
||||
var tempA = new Float32Array(2);
|
||||
var tempB = new Float32Array(2);
|
||||
LGraphCanvas.#margin_area = new Float32Array(4);
|
||||
LGraphCanvas.#link_bounding = new Float32Array(4);
|
||||
LGraphCanvas.#tempA = new Float32Array(2);
|
||||
LGraphCanvas.#tempB = new Float32Array(2);
|
||||
|
||||
/**
|
||||
* draws every connection visible in the canvas
|
||||
@@ -9278,10 +9278,10 @@ const globalExport = {};
|
||||
LGraphCanvas.prototype.drawConnections = function(ctx) {
|
||||
var now = LiteGraph.getTime();
|
||||
var visible_area = this.visible_area;
|
||||
margin_area[0] = visible_area[0] - 20;
|
||||
margin_area[1] = visible_area[1] - 20;
|
||||
margin_area[2] = visible_area[2] + 40;
|
||||
margin_area[3] = visible_area[3] + 40;
|
||||
LGraphCanvas.#margin_area[0] = visible_area[0] - 20;
|
||||
LGraphCanvas.#margin_area[1] = visible_area[1] - 20;
|
||||
LGraphCanvas.#margin_area[2] = visible_area[2] + 40;
|
||||
LGraphCanvas.#margin_area[3] = visible_area[3] + 40;
|
||||
|
||||
//draw connections
|
||||
ctx.lineWidth = this.connections_width;
|
||||
@@ -9325,27 +9325,27 @@ const globalExport = {};
|
||||
start_node_slotpos = start_node.getConnectionPos(
|
||||
false,
|
||||
start_node_slot,
|
||||
tempA
|
||||
LGraphCanvas.#tempA
|
||||
);
|
||||
}
|
||||
var end_node_slotpos = node.getConnectionPos(true, i, tempB);
|
||||
var end_node_slotpos = node.getConnectionPos(true, i, LGraphCanvas.#tempB);
|
||||
|
||||
//compute link bounding
|
||||
link_bounding[0] = start_node_slotpos[0];
|
||||
link_bounding[1] = start_node_slotpos[1];
|
||||
link_bounding[2] = end_node_slotpos[0] - start_node_slotpos[0];
|
||||
link_bounding[3] = end_node_slotpos[1] - start_node_slotpos[1];
|
||||
if (link_bounding[2] < 0) {
|
||||
link_bounding[0] += link_bounding[2];
|
||||
link_bounding[2] = Math.abs(link_bounding[2]);
|
||||
LGraphCanvas.#link_bounding[0] = start_node_slotpos[0];
|
||||
LGraphCanvas.#link_bounding[1] = start_node_slotpos[1];
|
||||
LGraphCanvas.#link_bounding[2] = end_node_slotpos[0] - start_node_slotpos[0];
|
||||
LGraphCanvas.#link_bounding[3] = end_node_slotpos[1] - start_node_slotpos[1];
|
||||
if (LGraphCanvas.#link_bounding[2] < 0) {
|
||||
LGraphCanvas.#link_bounding[0] += LGraphCanvas.#link_bounding[2];
|
||||
LGraphCanvas.#link_bounding[2] = Math.abs(LGraphCanvas.#link_bounding[2]);
|
||||
}
|
||||
if (link_bounding[3] < 0) {
|
||||
link_bounding[1] += link_bounding[3];
|
||||
link_bounding[3] = Math.abs(link_bounding[3]);
|
||||
if (LGraphCanvas.#link_bounding[3] < 0) {
|
||||
LGraphCanvas.#link_bounding[1] += LGraphCanvas.#link_bounding[3];
|
||||
LGraphCanvas.#link_bounding[3] = Math.abs(LGraphCanvas.#link_bounding[3]);
|
||||
}
|
||||
|
||||
//skip links outside of the visible area of the canvas
|
||||
if (!overlapBounding(link_bounding, margin_area)) {
|
||||
if (!overlapBounding(LGraphCanvas.#link_bounding, LGraphCanvas.#margin_area)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user