diff --git a/build/litegraph.core.js b/build/litegraph.core.js index 0de607fb3..6e8171021 100644 --- a/build/litegraph.core.js +++ b/build/litegraph.core.js @@ -8855,16 +8855,15 @@ LGraphNode.prototype.executeAction = function(action) //inside widget switch (w.type) { case "button": - if (event.type === "mousemove") { - break; - } - if (w.callback) { - setTimeout(function() { - w.callback(w, that, node, pos, event); - }, 20); - } - w.clicked = true; - this.dirty_canvas = true; + if (event.type === "mousedown") { + if (w.callback) { + setTimeout(function() { + w.callback(w, that, node, pos, event); + }, 20); + } + w.clicked = true; + this.dirty_canvas = true; + } break; case "slider": var range = w.options.max - w.options.min; diff --git a/build/litegraph.core.min.js b/build/litegraph.core.min.js index b89b78e74..8d492d405 100644 --- a/build/litegraph.core.min.js +++ b/build/litegraph.core.min.js @@ -210,8 +210,8 @@ c,.5,k,n);d&&d._pos&&(d._pos[0]=e[0],d._pos[1]=e[1]);.6<=this.ds.scale&&this.hig case "number":case "combo":c.textAlign="left";c.strokeStyle=n;c.fillStyle=l;c.beginPath();k?c.roundRect(15,b,p-30,h,.5*h):c.rect(15,b,p-30,h);c.fill();k&&(v.disabled||c.stroke(),c.fillStyle=t,v.disabled||(c.beginPath(),c.moveTo(31,b+5),c.lineTo(21,b+.5*h),c.lineTo(31,b+h-5),c.fill(),c.beginPath(),c.moveTo(p-15-16,b+5),c.lineTo(p-15-6,b+.5*h),c.lineTo(p-15-16,b+h-5),c.fill()),c.fillStyle=m,c.fillText(v.name,35,q+.7*h),c.fillStyle=t,c.textAlign="right","number"==v.type?c.fillText(Number(v.value).toFixed(void 0!== v.options.precision?v.options.precision:3),p-30-20,q+.7*h):(A=v.value,v.options.values&&(F=v.options.values,F.constructor===Function&&(F=F()),F&&F.constructor!==Array&&(A=F[v.value])),c.fillText(A,p-30-20,q+.7*h)));break;case "string":case "text":c.textAlign="left";c.strokeStyle=n;c.fillStyle=l;c.beginPath();k?c.roundRect(15,b,p-30,h,.5*h):c.rect(15,b,p-30,h);c.fill();k&&(v.disabled||c.stroke(),c.save(),c.beginPath(),c.rect(15,b,p-30,h),c.clip(),c.fillStyle=m,null!=v.name&&c.fillText(v.name,30,q+ .7*h),c.fillStyle=t,c.textAlign="right",c.fillText(String(v.value).substr(0,30),p-30,q+.7*h),c.restore());break;default:v.draw&&v.draw(c,a,p,q,h)}b+=(v.computeSize?v.computeSize(p)[1]:h)+4;c.globalAlpha=this.editor_alpha}c.restore();c.textAlign="left"};l.prototype.processNodeWidgets=function(a,b,c,d){function e(d,e){d.value=e;d.options&&d.options.property&&void 0!==a.properties[d.options.property]&&a.setProperty(d.options.property,e);d.callback&&d.callback(d.value,n,a,b,c)}if(!a.widgets||!a.widgets.length)return null; -for(var g=b[0]-a.pos[0],h=b[1]-a.pos[1],k=a.size[0],n=this,l=this.getCanvasWindow(),t=0;tg||g>q-12||hm.last_y+p||void 0===m.last_y)){d=m.value;switch(m.type){case "button":if("mousemove"===c.type)break;m.callback&&setTimeout(function(){m.callback(m,n,a,b,c)},20);this.dirty_canvas=m.clicked=!0;break;case "slider":l=Math.clamp((g-15)/(q-30), -0,1);m.value=m.options.min+(m.options.max-m.options.min)*l;m.callback&&setTimeout(function(){e(m,m.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":d=m.value;if("mousemove"==c.type&&"number"==m.type)m.value+=.1*c.deltaX*(m.options.step||1),null!=m.options.min&&m.valuem.options.max&&(m.value=m.options.max);else if("mousedown"==c.type){var r=m.options.values;r&&r.constructor===Function&&(r=m.options.values(m,a));var w= +for(var g=b[0]-a.pos[0],h=b[1]-a.pos[1],k=a.size[0],n=this,l=this.getCanvasWindow(),t=0;tg||g>q-12||hm.last_y+p||void 0===m.last_y)){d=m.value;switch(m.type){case "button":"mousedown"===c.type&&(m.callback&&setTimeout(function(){m.callback(m,n,a,b,c)},20),this.dirty_canvas=m.clicked=!0);break;case "slider":l=Math.clamp((g-15)/(q-30),0,1); +m.value=m.options.min+(m.options.max-m.options.min)*l;m.callback&&setTimeout(function(){e(m,m.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":d=m.value;if("mousemove"==c.type&&"number"==m.type)m.value+=.1*c.deltaX*(m.options.step||1),null!=m.options.min&&m.valuem.options.max&&(m.value=m.options.max);else if("mousedown"==c.type){var r=m.options.values;r&&r.constructor===Function&&(r=m.options.values(m,a));var w= null;"number"!=m.type&&(w=r.constructor===Array?r:Object.keys(r));g=40>g?-1:g>q-40?1:0;if("number"==m.type)m.value+=.1*g*(m.options.step||1),null!=m.options.min&&m.valuem.options.max&&(m.value=m.options.max);else if(g)l=-1,this.last_mouseclick=0,l=r.constructor===Object?w.indexOf(String(m.value))+g:w.indexOf(m.value)+g,l>=w.length&&(l=w.length-1),0>l&&(l=0),m.value=r.constructor===Array?r[l]:l;else{var A=r!=w?Object.values(r):r; new f.ContextMenu(A,{scale:Math.max(1,this.ds.scale),event:c,className:"dark",callback:function(a,b,c){r!=w&&(a=A.indexOf(a));this.value=a;e(this,a);n.dirty_canvas=!0;return!1}.bind(m)},l)}}else"mouseup"==c.type&&"number"==m.type&&(g=40>g?-1:g>q-40?1:0,200>c.click_time&&0==g&&this.prompt("Value",m.value,function(a){this.value=Number(a);e(this,this.value)}.bind(m),c));d!=m.value&&setTimeout(function(){e(this,this.value)}.bind(m),20);this.dirty_canvas=!0;break;case "toggle":"mousedown"==c.type&&(m.value= !m.value,setTimeout(function(){e(m,m.value)},20));break;case "string":case "text":"mousedown"==c.type&&this.prompt("Value",m.value,function(a){this.value=a;e(this,a)}.bind(m),c,m.options?m.options.multiline:!1);break;default:m.mouse&&(this.dirty_canvas=m.mouse(c,[g,h],a))}if(d!=m.value){if(a.onWidgetChanged)a.onWidgetChanged(m.name,m.value,d,m);a.graph._version++}return m}}}return null};l.prototype.drawGroups=function(a,b){if(this.graph){a=this.graph._groups;b.save();b.globalAlpha=.5*this.editor_alpha; diff --git a/build/litegraph.js b/build/litegraph.js index ae1d95e17..cf26520c2 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -8855,16 +8855,15 @@ LGraphNode.prototype.executeAction = function(action) //inside widget switch (w.type) { case "button": - if (event.type === "mousemove") { - break; - } - if (w.callback) { - setTimeout(function() { - w.callback(w, that, node, pos, event); - }, 20); - } - w.clicked = true; - this.dirty_canvas = true; + if (event.type === "mousedown") { + if (w.callback) { + setTimeout(function() { + w.callback(w, that, node, pos, event); + }, 20); + } + w.clicked = true; + this.dirty_canvas = true; + } break; case "slider": var range = w.options.max - w.options.min; @@ -14879,7 +14878,7 @@ if (typeof exports != "undefined") { //Converter function Converter() { - this.addInput("in", "*"); + this.addInput("in", ""); this.addOutput("out"); this.size = [80, 30]; } @@ -17749,7 +17748,7 @@ if (typeof exports != "undefined") { // Texture Webcam ***************************************** function ImageWebcam() { this.addOutput("Webcam", "image"); - this.properties = { facingMode: "user" }; + this.properties = { filterFacingMode: false, facingMode: "user" }; this.boxcolor = "black"; this.frame = 0; } @@ -17759,8 +17758,8 @@ if (typeof exports != "undefined") { ImageWebcam.is_webcam_open = false; ImageWebcam.prototype.openStream = function() { - if (!navigator.getUserMedia) { - //console.log('getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags'); + if (!navigator.mediaDevices.getUserMedia) { + console.log('getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags'); return; } @@ -17769,7 +17768,7 @@ if (typeof exports != "undefined") { // Not showing vendor prefixes. var constraints = { audio: false, - video: { facingMode: this.properties.facingMode } + video: !this.properties.filterFacingMode ? true : { facingMode: this.properties.facingMode } }; navigator.mediaDevices .getUserMedia(constraints) diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 02c1fe9ee..3484eccce 100644 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -210,8 +210,8 @@ d,.5,r,l);h&&h._pos&&(h._pos[0]=f[0],h._pos[1]=f[1]);.6<=this.ds.scale&&this.hig case "number":case "combo":d.textAlign="left";d.strokeStyle=m;d.fillStyle=t;d.beginPath();r?d.roundRect(15,b,C-30,l,.5*l):d.rect(15,b,C-30,l);d.fill();r&&(F.disabled||d.stroke(),d.fillStyle=k,F.disabled||(d.beginPath(),d.moveTo(31,b+5),d.lineTo(21,b+.5*l),d.lineTo(31,b+l-5),d.fill(),d.beginPath(),d.moveTo(C-15-16,b+5),d.lineTo(C-15-6,b+.5*l),d.lineTo(C-15-16,b+l-5),d.fill()),d.fillStyle=g,d.fillText(F.name,35,H+.7*l),d.fillStyle=k,d.textAlign="right","number"==F.type?d.fillText(Number(F.value).toFixed(void 0!== F.options.precision?F.options.precision:3),C-30-20,H+.7*l):(n=F.value,F.options.values&&(q=F.options.values,q.constructor===Function&&(q=q()),q&&q.constructor!==Array&&(n=q[F.value])),d.fillText(n,C-30-20,H+.7*l)));break;case "string":case "text":d.textAlign="left";d.strokeStyle=m;d.fillStyle=t;d.beginPath();r?d.roundRect(15,b,C-30,l,.5*l):d.rect(15,b,C-30,l);d.fill();r&&(F.disabled||d.stroke(),d.save(),d.beginPath(),d.rect(15,b,C-30,l),d.clip(),d.fillStyle=g,null!=F.name&&d.fillText(F.name,30,H+ .7*l),d.fillStyle=k,d.textAlign="right",d.fillText(String(F.value).substr(0,30),C-30,H+.7*l),d.restore());break;default:F.draw&&F.draw(d,a,C,H,l)}b+=(F.computeSize?F.computeSize(C)[1]:l)+4;d.globalAlpha=this.editor_alpha}d.restore();d.textAlign="left"};k.prototype.processNodeWidgets=function(a,b,d,h){function f(f,h){f.value=h;f.options&&f.options.property&&void 0!==a.properties[f.options.property]&&a.setProperty(f.options.property,h);f.callback&&f.callback(f.value,m,a,b,d)}if(!a.widgets||!a.widgets.length)return null; -for(var c=b[0]-a.pos[0],l=b[1]-a.pos[1],r=a.size[0],m=this,t=this.getCanvasWindow(),k=0;kc||c>F-12||lg.last_y+J||void 0===g.last_y)){h=g.value;switch(g.type){case "button":if("mousemove"===d.type)break;g.callback&&setTimeout(function(){g.callback(g,m,a,b,d)},20);this.dirty_canvas=g.clicked=!0;break;case "slider":t=Math.clamp((c-15)/(F-30), -0,1);g.value=g.options.min+(g.options.max-g.options.min)*t;g.callback&&setTimeout(function(){f(g,g.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":h=g.value;if("mousemove"==d.type&&"number"==g.type)g.value+=.1*d.deltaX*(g.options.step||1),null!=g.options.min&&g.valueg.options.max&&(g.value=g.options.max);else if("mousedown"==d.type){var H=g.options.values;H&&H.constructor===Function&&(H=g.options.values(g,a));var C= +for(var c=b[0]-a.pos[0],l=b[1]-a.pos[1],r=a.size[0],m=this,t=this.getCanvasWindow(),k=0;kc||c>F-12||lg.last_y+J||void 0===g.last_y)){h=g.value;switch(g.type){case "button":"mousedown"===d.type&&(g.callback&&setTimeout(function(){g.callback(g,m,a,b,d)},20),this.dirty_canvas=g.clicked=!0);break;case "slider":t=Math.clamp((c-15)/(F-30),0,1); +g.value=g.options.min+(g.options.max-g.options.min)*t;g.callback&&setTimeout(function(){f(g,g.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":h=g.value;if("mousemove"==d.type&&"number"==g.type)g.value+=.1*d.deltaX*(g.options.step||1),null!=g.options.min&&g.valueg.options.max&&(g.value=g.options.max);else if("mousedown"==d.type){var H=g.options.values;H&&H.constructor===Function&&(H=g.options.values(g,a));var C= null;"number"!=g.type&&(C=H.constructor===Array?H:Object.keys(H));c=40>c?-1:c>F-40?1:0;if("number"==g.type)g.value+=.1*c*(g.options.step||1),null!=g.options.min&&g.valueg.options.max&&(g.value=g.options.max);else if(c)t=-1,this.last_mouseclick=0,t=H.constructor===Object?C.indexOf(String(g.value))+c:C.indexOf(g.value)+c,t>=C.length&&(t=C.length-1),0>t&&(t=0),g.value=H.constructor===Array?H[t]:t;else{var n=H!=C?Object.values(H):H; new e.ContextMenu(n,{scale:Math.max(1,this.ds.scale),event:d,className:"dark",callback:function(a,b,d){H!=C&&(a=n.indexOf(a));this.value=a;f(this,a);m.dirty_canvas=!0;return!1}.bind(g)},t)}}else"mouseup"==d.type&&"number"==g.type&&(c=40>c?-1:c>F-40?1:0,200>d.click_time&&0==c&&this.prompt("Value",g.value,function(a){this.value=Number(a);f(this,this.value)}.bind(g),d));h!=g.value&&setTimeout(function(){f(this,this.value)}.bind(g),20);this.dirty_canvas=!0;break;case "toggle":"mousedown"==d.type&&(g.value= !g.value,setTimeout(function(){f(g,g.value)},20));break;case "string":case "text":"mousedown"==d.type&&this.prompt("Value",g.value,function(a){this.value=a;f(this,a)}.bind(g),d,g.options?g.options.multiline:!1);break;default:g.mouse&&(this.dirty_canvas=g.mouse(d,[c,l],a))}if(h!=g.value){if(a.onWidgetChanged)a.onWidgetChanged(g.name,g.value,h,g);a.graph._version++}return g}}}return null};k.prototype.drawGroups=function(a,b){if(this.graph){a=this.graph._groups;b.save();b.globalAlpha=.5*this.editor_alpha; @@ -370,7 +370,7 @@ break;case 13:g.buttons[v].pressed&&(n.hat+="down",n.hatmap|=c.DOWN);break;case c.strokeRect(.5*(q[0]+1)*this.size[0]-4,.5*(q[1]+1)*this.size[1]-4,8,8);g=this.size[1]/this._current_buttons.length;c.fillStyle="#AEB";for(q=0;qe;++e){var g=this.getInputData(e);if(null!=g){var k=this.values[e];k.push(g);k.length>c[0]&&k.shift()}}}};c.prototype.onDrawBackground=function(e){if(!this.flags.collapsed){var g=this.size,k=.5*g[1]/ -this.properties.scale,n=c.colors,l=.5*g[1];e.fillStyle="#000";e.fillRect(0,0,g[0],g[1]);e.strokeStyle="#555";e.beginPath();e.moveTo(0,l);e.lineTo(g[0],l);e.stroke();if(this.inputs)for(var m=0;4>m;++m){var t=this.values[m];if(this.inputs[m]&&this.inputs[m].link){e.strokeStyle=n[m];e.beginPath();var a=t[0]*k*-1+l;e.moveTo(0,Math.clamp(a,0,g[1]));for(var b=1;be&&(e=0);if(0!=c.length){var g=[0,0,0];if(0==e)g=c[0];else if(1==e)g=c[c.length-1];else{var k= -(c.length-1)*e;e=c[Math.floor(k)];c=c[Math.floor(k)+1];k-=Math.floor(k);g[0]=e[0]*(1-k)+c[0]*k;g[1]=e[1]*(1-k)+c[1]*k;g[2]=e[2]*(1-k)+c[2]*k}for(e=0;ee;++e){var g=this.getInputData(e);if(null!=g){var k=this.values[e];k.push(g);k.length>c[0]&&k.shift()}}}};c.prototype.onDrawBackground=function(e){if(!this.flags.collapsed){var g= +this.size,k=.5*g[1]/this.properties.scale,n=c.colors,l=.5*g[1];e.fillStyle="#000";e.fillRect(0,0,g[0],g[1]);e.strokeStyle="#555";e.beginPath();e.moveTo(0,l);e.lineTo(g[0],l);e.stroke();if(this.inputs)for(var m=0;4>m;++m){var t=this.values[m];if(this.inputs[m]&&this.inputs[m].link){e.strokeStyle=n[m];e.beginPath();var a=t[0]*k*-1+l;e.moveTo(0,Math.clamp(a,0,g[1]));for(var b=1;be&&(e=0);if(0!=c.length){var g=[0,0,0];if(0==e)g=c[0];else if(1==e)g=c[c.length- +1];else{var k=(c.length-1)*e;e=c[Math.floor(k)];c=c[Math.floor(k)+1];k-=Math.floor(k);g[0]=e[0]*(1-k)+c[0]*k;g[1]=e[1]*(1-k)+c[1]*k;g[2]=e[2]*(1-k)+c[2]*k}for(e=0;e=this.size[1]||!this.properties.show|| -!this._video||(c.save(),c.drawImage(this._video,0,0,this.size[0],this.size[1]),c.restore())};D.prototype.onGetOutputs=function(){return[["width","number"],["height","number"],["stream_ready",e.EVENT],["stream_closed",e.EVENT],["stream_error",e.EVENT]]};e.registerNodeType("graphics/webcam",D)})(this); +this._video.pause())};A.prototype.onWidget=function(c,e){};e.registerNodeType("graphics/video",A);D.title="Webcam";D.desc="Webcam image";D.is_webcam_open=!1;D.prototype.openStream=function(){if(navigator.mediaDevices.getUserMedia){this._waiting_confirmation=!0;navigator.mediaDevices.getUserMedia({audio:!1,video:this.properties.filterFacingMode?{facingMode:this.properties.facingMode}:!0}).then(this.streamReady.bind(this)).catch(function(e){console.log("Webcam rejected",e);c._webcam_stream=!1;D.is_webcam_open= +!1;c.boxcolor="red";c.trigger("stream_error")});var c=this}else console.log("getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags")};D.prototype.closeStream=function(){if(this._webcam_stream){var c=this._webcam_stream.getTracks();if(c.length)for(var e=0;e=this.size[1]||!this.properties.show||!this._video||(c.save(),c.drawImage(this._video,0,0,this.size[0],this.size[1]),c.restore())};D.prototype.onGetOutputs=function(){return[["width","number"],["height","number"],["stream_ready",e.EVENT],["stream_closed",e.EVENT],["stream_error",e.EVENT]]};e.registerNodeType("graphics/webcam",D)})(this); (function(y){function c(){this.addOutput("tex","Texture");this.addOutput("name","string");this.properties={name:"",filter:!0};this.size=[c.image_preview_size,c.image_preview_size]}function g(){this.addInput("Texture","Texture");this.properties={flipY:!1};this.size=[c.image_preview_size,c.image_preview_size]}function q(){this.addInput("Texture","Texture");this.addOutput("tex","Texture");this.addOutput("name","string");this.properties={name:"",generate_mipmaps:!1}}function n(){this.addInput("Texture", "Texture");this.addInput("TextureB","Texture");this.addInput("value","number");this.addOutput("Texture","Texture");this.help="

pixelcode must be vec3, uvcode must be vec2, is optional

\t\t

uv: tex. coords

color: texture colorB: textureB

time: scene time value: input value

For multiline you must type: result = ...

";this.properties={value:1,pixelcode:"color + colorB * value",uvcode:"",precision:c.DEFAULT}; this.has_error=!1}function v(){this.addOutput("out","Texture");this.properties={code:"",u_value:1,u_color:[1,1,1,1],width:512,height:512,precision:c.DEFAULT};this.properties.code=v.pixel_shader;this._uniforms={u_value:1,u_color:vec4.create(),in_texture:0,texSize:vec4.create(),time:0}}function k(){this.addInput("in","Texture");this.addInput("scale","vec2");this.addInput("offset","vec2");this.addOutput("out","Texture");this.properties={offset:vec2.fromValues(0,0),scale:vec2.fromValues(1,1),precision:c.DEFAULT}} diff --git a/build/litegraph_mini.js b/build/litegraph_mini.js index e8d339af0..5fcefdd2b 100644 --- a/build/litegraph_mini.js +++ b/build/litegraph_mini.js @@ -8855,16 +8855,15 @@ LGraphNode.prototype.executeAction = function(action) //inside widget switch (w.type) { case "button": - if (event.type === "mousemove") { - break; - } - if (w.callback) { - setTimeout(function() { - w.callback(w, that, node, pos, event); - }, 20); - } - w.clicked = true; - this.dirty_canvas = true; + if (event.type === "mousedown") { + if (w.callback) { + setTimeout(function() { + w.callback(w, that, node, pos, event); + }, 20); + } + w.clicked = true; + this.dirty_canvas = true; + } break; case "slider": var range = w.options.max - w.options.min; @@ -14081,7 +14080,7 @@ if (typeof exports != "undefined") { //Converter function Converter() { - this.addInput("in", "*"); + this.addInput("in", ""); this.addOutput("out"); this.size = [80, 30]; } diff --git a/build/litegraph_mini.min.js b/build/litegraph_mini.min.js index f28f29bb6..108d9b199 100644 --- a/build/litegraph_mini.min.js +++ b/build/litegraph_mini.min.js @@ -210,8 +210,8 @@ c,.5,n,r);d&&d._pos&&(d._pos[0]=e[0],d._pos[1]=e[1]);.6<=this.ds.scale&&this.hig case "number":case "combo":c.textAlign="left";c.strokeStyle=r;c.fillStyle=h;c.beginPath();n?c.roundRect(15,b,m-30,g,.5*g):c.rect(15,b,m-30,g);c.fill();n&&(y.disabled||c.stroke(),c.fillStyle=k,y.disabled||(c.beginPath(),c.moveTo(31,b+5),c.lineTo(21,b+.5*g),c.lineTo(31,b+g-5),c.fill(),c.beginPath(),c.moveTo(m-15-16,b+5),c.lineTo(m-15-6,b+.5*g),c.lineTo(m-15-16,b+g-5),c.fill()),c.fillStyle=p,c.fillText(y.name,35,t+.7*g),c.fillStyle=k,c.textAlign="right","number"==y.type?c.fillText(Number(y.value).toFixed(void 0!== y.options.precision?y.options.precision:3),m-30-20,t+.7*g):(q=y.value,y.options.values&&(w=y.options.values,w.constructor===Function&&(w=w()),w&&w.constructor!==Array&&(q=w[y.value])),c.fillText(q,m-30-20,t+.7*g)));break;case "string":case "text":c.textAlign="left";c.strokeStyle=r;c.fillStyle=h;c.beginPath();n?c.roundRect(15,b,m-30,g,.5*g):c.rect(15,b,m-30,g);c.fill();n&&(y.disabled||c.stroke(),c.save(),c.beginPath(),c.rect(15,b,m-30,g),c.clip(),c.fillStyle=p,null!=y.name&&c.fillText(y.name,30,t+ .7*g),c.fillStyle=k,c.textAlign="right",c.fillText(String(y.value).substr(0,30),m-30,t+.7*g),c.restore());break;default:y.draw&&y.draw(c,a,m,t,g)}b+=(y.computeSize?y.computeSize(m)[1]:g)+4;c.globalAlpha=this.editor_alpha}c.restore();c.textAlign="left"};h.prototype.processNodeWidgets=function(a,b,c,d){function e(d,e){d.value=e;d.options&&d.options.property&&void 0!==a.properties[d.options.property]&&a.setProperty(d.options.property,e);d.callback&&d.callback(d.value,r,a,b,c)}if(!a.widgets||!a.widgets.length)return null; -for(var f=b[0]-a.pos[0],g=b[1]-a.pos[1],n=a.size[0],r=this,h=this.getCanvasWindow(),k=0;kf||f>t-12||gp.last_y+z||void 0===p.last_y)){d=p.value;switch(p.type){case "button":if("mousemove"===c.type)break;p.callback&&setTimeout(function(){p.callback(p,r,a,b,c)},20);this.dirty_canvas=p.clicked=!0;break;case "slider":h=Math.clamp((f-15)/(t-30), -0,1);p.value=p.options.min+(p.options.max-p.options.min)*h;p.callback&&setTimeout(function(){e(p,p.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":d=p.value;if("mousemove"==c.type&&"number"==p.type)p.value+=.1*c.deltaX*(p.options.step||1),null!=p.options.min&&p.valuep.options.max&&(p.value=p.options.max);else if("mousedown"==c.type){var m=p.options.values;m&&m.constructor===Function&&(m=p.options.values(p,a));var q= +for(var f=b[0]-a.pos[0],g=b[1]-a.pos[1],n=a.size[0],r=this,h=this.getCanvasWindow(),k=0;kf||f>t-12||gp.last_y+z||void 0===p.last_y)){d=p.value;switch(p.type){case "button":"mousedown"===c.type&&(p.callback&&setTimeout(function(){p.callback(p,r,a,b,c)},20),this.dirty_canvas=p.clicked=!0);break;case "slider":h=Math.clamp((f-15)/(t-30),0,1); +p.value=p.options.min+(p.options.max-p.options.min)*h;p.callback&&setTimeout(function(){e(p,p.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":d=p.value;if("mousemove"==c.type&&"number"==p.type)p.value+=.1*c.deltaX*(p.options.step||1),null!=p.options.min&&p.valuep.options.max&&(p.value=p.options.max);else if("mousedown"==c.type){var m=p.options.values;m&&m.constructor===Function&&(m=p.options.values(p,a));var q= null;"number"!=p.type&&(q=m.constructor===Array?m:Object.keys(m));f=40>f?-1:f>t-40?1:0;if("number"==p.type)p.value+=.1*f*(p.options.step||1),null!=p.options.min&&p.valuep.options.max&&(p.value=p.options.max);else if(f)h=-1,this.last_mouseclick=0,h=m.constructor===Object?q.indexOf(String(p.value))+f:q.indexOf(p.value)+f,h>=q.length&&(h=q.length-1),0>h&&(h=0),p.value=m.constructor===Array?m[h]:h;else{var w=m!=q?Object.values(m):m; new l.ContextMenu(w,{scale:Math.max(1,this.ds.scale),event:c,className:"dark",callback:function(a,b,c){m!=q&&(a=w.indexOf(a));this.value=a;e(this,a);r.dirty_canvas=!0;return!1}.bind(p)},h)}}else"mouseup"==c.type&&"number"==p.type&&(f=40>f?-1:f>t-40?1:0,200>c.click_time&&0==f&&this.prompt("Value",p.value,function(a){this.value=Number(a);e(this,this.value)}.bind(p),c));d!=p.value&&setTimeout(function(){e(this,this.value)}.bind(p),20);this.dirty_canvas=!0;break;case "toggle":"mousedown"==c.type&&(p.value= !p.value,setTimeout(function(){e(p,p.value)},20));break;case "string":case "text":"mousedown"==c.type&&this.prompt("Value",p.value,function(a){this.value=a;e(this,a)}.bind(p),c,p.options?p.options.multiline:!1);break;default:p.mouse&&(this.dirty_canvas=p.mouse(c,[f,g],a))}if(d!=p.value){if(a.onWidgetChanged)a.onWidgetChanged(p.name,p.value,d,p);a.graph._version++}return p}}}return null};h.prototype.drawGroups=function(a,b){if(this.graph){a=this.graph._groups;b.save();b.globalAlpha=.5*this.editor_alpha; @@ -345,7 +345,7 @@ break;case 13:k.buttons[q].pressed&&(t.hat+="down",t.hatmap|=m.DOWN);break;case k.strokeRect(.5*(m[0]+1)*this.size[0]-4,.5*(m[1]+1)*this.size[1]-4,8,8);t=this.size[1]/this._current_buttons.length;k.fillStyle="#AEB";for(m=0;m