|
2532 | 2532 | var w = this.widgets[i];
|
2533 | 2533 | if(!w)
|
2534 | 2534 | continue;
|
2535 |
| - if(w.options && w.options.property && this.properties[ w.options.property ]) |
| 2535 | + if(w.options && w.options.property && (this.properties[ w.options.property ] != undefined)) |
2536 | 2536 | w.value = JSON.parse( JSON.stringify( this.properties[ w.options.property ] ) );
|
2537 | 2537 | }
|
2538 | 2538 | if (info.widgets_values) {
|
|
3775 | 3775 |
|
3776 | 3776 | /**
|
3777 | 3777 | * returns the bounding of the object, used for rendering purposes
|
3778 |
| - * bounding is: [topleft_cornerx, topleft_cornery, width, height] |
3779 | 3778 | * @method getBounding
|
3780 |
| - * @return {Float32Array[4]} the total size |
| 3779 | + * @param out {Float32Array[4]?} [optional] a place to store the output, to free garbage |
| 3780 | + * @param compute_outer {boolean?} [optional] set to true to include the shadow and connection points in the bounding calculation |
| 3781 | + * @return {Float32Array[4]} the bounding box in format of [topleft_cornerx, topleft_cornery, width, height] |
3781 | 3782 | */
|
3782 |
| - LGraphNode.prototype.getBounding = function(out) { |
| 3783 | + LGraphNode.prototype.getBounding = function(out, compute_outer) { |
3783 | 3784 | out = out || new Float32Array(4);
|
3784 |
| - out[0] = this.pos[0] - 4; |
3785 |
| - out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT; |
3786 |
| - out[2] = this.size[0] + 4; |
3787 |
| - out[3] = this.flags.collapsed ? LiteGraph.NODE_TITLE_HEIGHT : this.size[1] + LiteGraph.NODE_TITLE_HEIGHT; |
| 3785 | + const nodePos = this.pos; |
| 3786 | + const isCollapsed = this.flags.collapsed; |
| 3787 | + const nodeSize = this.size; |
| 3788 | + |
| 3789 | + let left_offset = 0; |
| 3790 | + // 1 offset due to how nodes are rendered |
| 3791 | + let right_offset = 1 ; |
| 3792 | + let top_offset = 0; |
| 3793 | + let bottom_offset = 0; |
| 3794 | + |
| 3795 | + if (compute_outer) { |
| 3796 | + // 4 offset for collapsed node connection points |
| 3797 | + left_offset = 4; |
| 3798 | + // 6 offset for right shadow and collapsed node connection points |
| 3799 | + right_offset = 6 + left_offset; |
| 3800 | + // 4 offset for collapsed nodes top connection points |
| 3801 | + top_offset = 4; |
| 3802 | + // 5 offset for bottom shadow and collapsed node connection points |
| 3803 | + bottom_offset = 5 + top_offset; |
| 3804 | + } |
| 3805 | + |
| 3806 | + out[0] = nodePos[0] - left_offset; |
| 3807 | + out[1] = nodePos[1] - LiteGraph.NODE_TITLE_HEIGHT - top_offset; |
| 3808 | + out[2] = isCollapsed ? |
| 3809 | + (this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH) + right_offset : |
| 3810 | + nodeSize[0] + right_offset; |
| 3811 | + out[3] = isCollapsed ? |
| 3812 | + LiteGraph.NODE_TITLE_HEIGHT + bottom_offset : |
| 3813 | + nodeSize[1] + LiteGraph.NODE_TITLE_HEIGHT + bottom_offset; |
3788 | 3814 |
|
3789 | 3815 | if (this.onBounding) {
|
3790 | 3816 | this.onBounding(out);
|
@@ -7673,7 +7699,7 @@ LGraphNode.prototype.executeAction = function(action)
|
7673 | 7699 | continue;
|
7674 | 7700 | }
|
7675 | 7701 |
|
7676 |
| - if (!overlapBounding(this.visible_area, n.getBounding(temp))) { |
| 7702 | + if (!overlapBounding(this.visible_area, n.getBounding(temp, true))) { |
7677 | 7703 | continue;
|
7678 | 7704 | } //out of the visible area
|
7679 | 7705 |
|
@@ -9975,6 +10001,7 @@ LGraphNode.prototype.executeAction = function(action)
|
9975 | 10001 | var x = pos[0] - node.pos[0];
|
9976 | 10002 | var y = pos[1] - node.pos[1];
|
9977 | 10003 | var width = node.size[0];
|
| 10004 | + var deltaX = event.deltaX || event.deltax || 0; |
9978 | 10005 | var that = this;
|
9979 | 10006 | var ref_window = this.getCanvasWindow();
|
9980 | 10007 |
|
@@ -10021,8 +10048,8 @@ LGraphNode.prototype.executeAction = function(action)
|
10021 | 10048 | case "combo":
|
10022 | 10049 | var old_value = w.value;
|
10023 | 10050 | if (event.type == LiteGraph.pointerevents_method+"move" && w.type == "number") {
|
10024 |
| - if(event.deltaX) |
10025 |
| - w.value += event.deltaX * 0.1 * (w.options.step || 1); |
| 10051 | + if(deltaX) |
| 10052 | + w.value += deltaX * 0.1 * (w.options.step || 1); |
10026 | 10053 | if ( w.options.min != null && w.value < w.options.min ) {
|
10027 | 10054 | w.value = w.options.min;
|
10028 | 10055 | }
|
@@ -11499,7 +11526,8 @@ LGraphNode.prototype.executeAction = function(action)
|
11499 | 11526 | var input = dialog.querySelector("input");
|
11500 | 11527 | if (input) {
|
11501 | 11528 | input.addEventListener("blur", function(e) {
|
11502 |
| - this.focus(); |
| 11529 | + if(that.search_box) |
| 11530 | + this.focus(); |
11503 | 11531 | });
|
11504 | 11532 | input.addEventListener("keydown", function(e) {
|
11505 | 11533 | if (e.keyCode == 38) {
|
|
0 commit comments