diff --git a/build/litegraph.js b/build/litegraph.js index 455428785f..dbd2b72910 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -2126,9 +2126,14 @@ LGraphNode.prototype.computeSize = function( minHeight, out ) * @method getBounding * @return {Float32Array[4]} the total size */ -LGraphNode.prototype.getBounding = function() +LGraphNode.prototype.getBounding = function( out ) { - return new Float32Array([this.pos[0] - 4, this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT, this.pos[0] + this.size[0] + 4, this.pos[1] + this.size[1] + LGraph.NODE_TITLE_HEIGHT]); + out = out || new Float32Array(4); + out[0] = this.pos[0] - 4; + out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT; + out[2] = this.pos[0] + this.size[0] + 4; + out[3] = this.pos[1] + this.size[1] + LGraph.NODE_TITLE_HEIGHT; + return out; } /** @@ -4007,6 +4012,7 @@ LGraphCanvas.prototype.sendToBack = function(n) LGraphCanvas.prototype.computeVisibleNodes = function() { + var temp = new Float32Array(4); var visible_nodes = []; for(var i = 0, l = this.graph._nodes.length; i < l; ++i) { @@ -4016,7 +4022,7 @@ LGraphCanvas.prototype.computeVisibleNodes = function() if(this.live_mode && !n.onDrawBackground && !n.onDrawForeground) continue; - if(!overlapBounding(this.visible_area, n.getBounding() )) + if(!overlapBounding( this.visible_area, n.getBounding( temp ) )) continue; //out of the visible area visible_nodes.push(n); diff --git a/build/litegraph.min.js b/build/litegraph.min.js index f9f15da3e1..51eeb55377 100755 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -45,7 +45,7 @@ LGraphNode.prototype.addProperty=function(a,b,e,k){e={name:a,type:e,default_valu LGraphNode.prototype.addOutputs=function(a){for(var b=0;ba&&this.pos[1]-k-eb)return!0;return!1};LGraphNode.prototype.getSlotInPosition=function(a,b){if(this.inputs)for(var e=0,k=this.inputs.length;e=this.outputs.length)return h.debug&&console.log("Connect: Error, slot number not found"),!1;b&&b.constructor===Number&&(b=this.graph.getNodeById(b));if(!b)throw"Node not found";if(b==this)return!1;if(e.constructor=== @@ -95,10 +95,10 @@ b.onSelected)b.onSelected();b.selected=!0;this.selected_nodes[this.graph._nodes[ function(a){this.offset[0]=-a.pos[0]-0.5*a.size[0]+0.5*this.canvas.width/this.scale;this.offset[1]=-a.pos[1]-0.5*a.size[1]+0.5*this.canvas.height/this.scale;this.setDirty(!0,!0)};LGraphCanvas.prototype.adjustMouseEvent=function(a){var b=this.canvas.getBoundingClientRect();a.localX=a.pageX-b.left;a.localY=a.pageY-b.top;a.canvasX=a.localX/this.scale-this.offset[0];a.canvasY=a.localY/this.scale-this.offset[1]};LGraphCanvas.prototype.setZoom=function(a,b){b||(b=[0.5*this.canvas.width,0.5*this.canvas.height]); var e=this.convertOffsetToCanvas(b);this.scale=a;this.scale>this.max_zoom?this.scale=this.max_zoom:this.scalee-this.graph._last_trigger_time)&&this.drawBackCanvas();(this.dirty_canvas||a)&&this.drawFrontCanvas();this.fps=this.render_time?1/this.render_time:0;this.frame+=1}};LGraphCanvas.prototype.drawFrontCanvas=function(){this.ctx||(this.ctx=this.bgcanvas.getContext("2d"));var a=this.ctx;if(a){a.start2D&&a.start2D();var b=this.canvas; -a.restore();a.setTransform(1,0,0,1,0,0);this.dirty_area&&(a.save(),a.beginPath(),a.rect(this.dirty_area[0],this.dirty_area[1],this.dirty_area[2],this.dirty_area[3]),a.clip());this.clear_background&&a.clearRect(0,0,b.width,b.height);this.bgcanvas==this.canvas?this.drawBackCanvas():a.drawImage(this.bgcanvas,0,0);if(this.onRender)this.onRender(b,a);this.show_info&&this.renderInfo(a);if(this.graph){a.save();a.scale(this.scale,this.scale);a.translate(this.offset[0],this.offset[1]);this.visible_nodes=b= -this.computeVisibleNodes();for(var e=0;ee-this.graph._last_trigger_time)&&this.drawBackCanvas();(this.dirty_canvas||a)&&this.drawFrontCanvas();this.fps=this.render_time?1/this.render_time:0;this.frame+=1}};LGraphCanvas.prototype.drawFrontCanvas=function(){this.ctx||(this.ctx=this.bgcanvas.getContext("2d"));var a=this.ctx;if(a){a.start2D&&a.start2D(); +var b=this.canvas;a.restore();a.setTransform(1,0,0,1,0,0);this.dirty_area&&(a.save(),a.beginPath(),a.rect(this.dirty_area[0],this.dirty_area[1],this.dirty_area[2],this.dirty_area[3]),a.clip());this.clear_background&&a.clearRect(0,0,b.width,b.height);this.bgcanvas==this.canvas?this.drawBackCanvas():a.drawImage(this.bgcanvas,0,0);if(this.onRender)this.onRender(b,a);this.show_info&&this.renderInfo(a);if(this.graph){a.save();a.scale(this.scale,this.scale);a.translate(this.offset[0],this.offset[1]);this.visible_nodes= +b=this.computeVisibleNodes();for(var e=0;e