|
2530 | 2530 | var w = this.widgets[i]; |
2531 | 2531 | if(!w) |
2532 | 2532 | continue; |
2533 | | - if(w.options && w.options.property && this.properties[ w.options.property ]) |
| 2533 | + if(w.options && w.options.property && (this.properties[ w.options.property ] != undefined)) |
2534 | 2534 | w.value = JSON.parse( JSON.stringify( this.properties[ w.options.property ] ) ); |
2535 | 2535 | } |
2536 | 2536 | if (info.widgets_values) { |
|
3773 | 3773 |
|
3774 | 3774 | /** |
3775 | 3775 | * returns the bounding of the object, used for rendering purposes |
3776 | | - * bounding is: [topleft_cornerx, topleft_cornery, width, height] |
3777 | 3776 | * @method getBounding |
3778 | | - * @return {Float32Array[4]} the total size |
| 3777 | + * @param out {Float32Array[4]?} [optional] a place to store the output, to free garbage |
| 3778 | + * @param compute_outer {boolean?} [optional] set to true to include the shadow and connection points in the bounding calculation |
| 3779 | + * @return {Float32Array[4]} the bounding box in format of [topleft_cornerx, topleft_cornery, width, height] |
3779 | 3780 | */ |
3780 | | - LGraphNode.prototype.getBounding = function(out) { |
| 3781 | + LGraphNode.prototype.getBounding = function(out, compute_outer) { |
3781 | 3782 | out = out || new Float32Array(4); |
3782 | | - out[0] = this.pos[0] - 4; |
3783 | | - out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT; |
3784 | | - out[2] = this.size[0] + 4; |
3785 | | - out[3] = this.flags.collapsed ? LiteGraph.NODE_TITLE_HEIGHT : this.size[1] + LiteGraph.NODE_TITLE_HEIGHT; |
| 3783 | + const nodePos = this.pos; |
| 3784 | + const isCollapsed = this.flags.collapsed; |
| 3785 | + const nodeSize = this.size; |
| 3786 | + |
| 3787 | + let left_offset = 0; |
| 3788 | + // 1 offset due to how nodes are rendered |
| 3789 | + let right_offset = 1 ; |
| 3790 | + let top_offset = 0; |
| 3791 | + let bottom_offset = 0; |
| 3792 | + |
| 3793 | + if (compute_outer) { |
| 3794 | + // 4 offset for collapsed node connection points |
| 3795 | + left_offset = 4; |
| 3796 | + // 6 offset for right shadow and collapsed node connection points |
| 3797 | + right_offset = 6 + left_offset; |
| 3798 | + // 4 offset for collapsed nodes top connection points |
| 3799 | + top_offset = 4; |
| 3800 | + // 5 offset for bottom shadow and collapsed node connection points |
| 3801 | + bottom_offset = 5 + top_offset; |
| 3802 | + } |
| 3803 | + |
| 3804 | + out[0] = nodePos[0] - left_offset; |
| 3805 | + out[1] = nodePos[1] - LiteGraph.NODE_TITLE_HEIGHT - top_offset; |
| 3806 | + out[2] = isCollapsed ? |
| 3807 | + (this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH) + right_offset : |
| 3808 | + nodeSize[0] + right_offset; |
| 3809 | + out[3] = isCollapsed ? |
| 3810 | + LiteGraph.NODE_TITLE_HEIGHT + bottom_offset : |
| 3811 | + nodeSize[1] + LiteGraph.NODE_TITLE_HEIGHT + bottom_offset; |
3786 | 3812 |
|
3787 | 3813 | if (this.onBounding) { |
3788 | 3814 | this.onBounding(out); |
@@ -7671,7 +7697,7 @@ LGraphNode.prototype.executeAction = function(action) |
7671 | 7697 | continue; |
7672 | 7698 | } |
7673 | 7699 |
|
7674 | | - if (!overlapBounding(this.visible_area, n.getBounding(temp))) { |
| 7700 | + if (!overlapBounding(this.visible_area, n.getBounding(temp, true))) { |
7675 | 7701 | continue; |
7676 | 7702 | } //out of the visible area |
7677 | 7703 |
|
|
0 commit comments