diff --git a/build/litegraph.js b/build/litegraph.js
index 954191248..fcc707be4 100644
--- a/build/litegraph.js
+++ b/build/litegraph.js
@@ -26,6 +26,7 @@
NODE_COLLAPSED_RADIUS: 10,
NODE_COLLAPSED_WIDTH: 80,
NODE_TITLE_COLOR: "#999",
+ NODE_SELECTED_TITLE_COLOR: "#FFF",
NODE_TEXT_SIZE: 14,
NODE_TEXT_COLOR: "#AAA",
NODE_SUBTEXT_SIZE: 12,
@@ -33,13 +34,14 @@
NODE_DEFAULT_BGCOLOR: "#353535",
NODE_DEFAULT_BOXCOLOR: "#666",
NODE_DEFAULT_SHAPE: "box",
+ NODE_BOX_OUTLINE_COLOR: "#FFF",
DEFAULT_SHADOW_COLOR: "rgba(0,0,0,0.5)",
DEFAULT_GROUP_FONT: 24,
- WIDGET_BGCOLOR: "#222",
- WIDGET_OUTLINE_COLOR: "#666",
- WIDGET_TEXT_COLOR: "#DDD",
- WIDGET_SECONDARY_TEXT_COLOR: "#999",
+ WIDGET_BGCOLOR: "#222",
+ WIDGET_OUTLINE_COLOR: "#666",
+ WIDGET_TEXT_COLOR: "#DDD",
+ WIDGET_SECONDARY_TEXT_COLOR: "#999",
LINK_COLOR: "#9A9",
EVENT_LINK_COLOR: "#A86",
@@ -96,6 +98,7 @@
Globals: {}, //used to store vars between graphs
searchbox_extras: {}, //used to add extra features to the search box
+ auto_sort_node_types: false, // If set to true, will automatically sort node types / categories in the context menus
/**
* Register a node class so it can be listed when the user wants to create a new one
@@ -416,7 +419,7 @@
}
}
- return r;
+ return this.auto_sort_node_types ? r.sort() : r;
},
/**
@@ -440,7 +443,7 @@
for (var i in categories) {
result.push(i);
}
- return result;
+ return this.auto_sort_node_types ? result.sort() : result;
},
//debug purposes: reloads all the js scripts that matches a wildcard
@@ -7966,7 +7969,7 @@ LGraphNode.prototype.executeAction = function(action)
var title = String(node.getTitle());
if (title) {
if (selected) {
- ctx.fillStyle = "white";
+ ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR;
} else {
ctx.fillStyle =
node.constructor.title_text_color ||
@@ -8069,7 +8072,7 @@ LGraphNode.prototype.executeAction = function(action)
Math.PI * 2
);
}
- ctx.strokeStyle = "#FFF";
+ ctx.strokeStyle = LiteGraph.NODE_BOX_OUTLINE_COLOR;
ctx.stroke();
ctx.strokeStyle = fgcolor;
ctx.globalAlpha = 1;
@@ -9452,7 +9455,7 @@ LGraphNode.prototype.executeAction = function(action)
entries.push({
content:
"" +
- i +
+ (info.label ? info.label : i) +
"" +
"" +
value +
@@ -10050,7 +10053,7 @@ LGraphNode.prototype.executeAction = function(action)
var dialog = this.createDialog(
"" +
- property +
+ (info.label ? info.label : property) +
"" +
input_html +
"",
@@ -10077,8 +10080,12 @@ LGraphNode.prototype.executeAction = function(action)
input.addEventListener("blur", function(e) {
this.focus();
});
+
var v = node.properties[property] !== undefined ? node.properties[property] : "";
- v = JSON.stringify(v);
+ if (type !== 'string') {
+ v = JSON.stringify(v);
+ }
+
input.value = v;
input.addEventListener("keydown", function(e) {
if (e.keyCode != 13) {
diff --git a/build/litegraph.min.js b/build/litegraph.min.js
index b6198e5fa..b61bf8cd1 100644
--- a/build/litegraph.min.js
+++ b/build/litegraph.min.js
@@ -8,100 +8,100 @@ b.parentMenu,this.parentMenu.lock=!0,this.parentMenu.current_submenu=this));var
setTimeout(function(){f.style.pointerEvents="auto"},100);f.addEventListener("mouseup",function(a){a.preventDefault();return!0},!0);f.addEventListener("contextmenu",function(a){if(2!=a.button)return!1;a.preventDefault();return!1},!0);f.addEventListener("mousedown",function(a){if(2==a.button)return g.close(),a.preventDefault(),!0},!0);b.scroll_speed||(b.scroll_speed=0.1);f.addEventListener("wheel",d,!0);f.addEventListener("mousewheel",d,!0);this.root=f;b.title&&(e=document.createElement("div"),e.className=
"litemenu-title",e.innerHTML=b.title,f.appendChild(e));for(var m=e=0;ms.width-y.width-10&&(m=s.width-y.width-10);s.height&&
-e>s.height-y.height-10&&(e=s.height-y.height-10)}f.style.left=m+"px";f.style.top=e+"px";b.scale&&(f.style.transform="scale("+b.scale+")")}function D(a){this.points=a;this.nearest=this.selected=-1;this.size=null;this.must_update=!0;this.margin=5}var f=B.LiteGraph={VERSION:0.4,CANVAS_GRID_SIZE:10,NODE_TITLE_HEIGHT:30,NODE_TITLE_TEXT_Y:20,NODE_SLOT_HEIGHT:20,NODE_WIDGET_HEIGHT:20,NODE_WIDTH:140,NODE_MIN_WIDTH:50,NODE_COLLAPSED_RADIUS:10,NODE_COLLAPSED_WIDTH:80,NODE_TITLE_COLOR:"#999",NODE_TEXT_SIZE:14,
-NODE_TEXT_COLOR:"#AAA",NODE_SUBTEXT_SIZE:12,NODE_DEFAULT_COLOR:"#333",NODE_DEFAULT_BGCOLOR:"#353535",NODE_DEFAULT_BOXCOLOR:"#666",NODE_DEFAULT_SHAPE:"box",DEFAULT_SHADOW_COLOR:"rgba(0,0,0,0.5)",DEFAULT_GROUP_FONT:24,WIDGET_BGCOLOR:"#222",WIDGET_OUTLINE_COLOR:"#666",WIDGET_TEXT_COLOR:"#DDD",WIDGET_SECONDARY_TEXT_COLOR:"#999",LINK_COLOR:"#9A9",EVENT_LINK_COLOR:"#A86",CONNECTING_LINK_COLOR:"#AFA",MAX_NUMBER_OF_NODES:1E3,DEFAULT_POSITION:[100,100],VALID_SHAPES:["default","box","round","card"],BOX_SHAPE:1,
-ROUND_SHAPE:2,CIRCLE_SHAPE:3,CARD_SHAPE:4,ARROW_SHAPE:5,INPUT:1,OUTPUT:2,EVENT:-1,ACTION:-1,ALWAYS:0,ON_EVENT:1,NEVER:2,ON_TRIGGER:3,UP:1,DOWN:2,LEFT:3,RIGHT:4,CENTER:5,STRAIGHT_LINK:0,LINEAR_LINK:1,SPLINE_LINK:2,NORMAL_TITLE:0,NO_TITLE:1,TRANSPARENT_TITLE:2,AUTOHIDE_TITLE:3,proxy:null,node_images_path:"",debug:!1,catch_exceptions:!0,throw_errors:!0,allow_scripts:!1,registered_node_types:{},node_types_by_file_extension:{},Nodes:{},Globals:{},searchbox_extras:{},registerNodeType:function(a,b){if(!b.prototype)throw"Cannot register a simple object, it must be a class with a prototype";
-b.type=a;f.debug&&console.log("Node registered: "+a);a.split("/");var d=b.name,g=a.lastIndexOf("/");b.category=a.substr(0,g);b.title||(b.title=d);if(b.prototype)for(var e in u.prototype)b.prototype[e]||(b.prototype[e]=u.prototype[e]);if(g=this.registered_node_types[a])console.log("replacing node type: "+a);else if(Object.hasOwnProperty(b.prototype,"shape")||Object.defineProperty(b.prototype,"shape",{set:function(a){switch(a){case "default":delete this._shape;break;case "box":this._shape=f.BOX_SHAPE;
-break;case "round":this._shape=f.ROUND_SHAPE;break;case "circle":this._shape=f.CIRCLE_SHAPE;break;case "card":this._shape=f.CARD_SHAPE;break;default:this._shape=a}},get:function(a){return this._shape},enumerable:!0,configurable:!0}),b.prototype.onPropertyChange&&console.warn("LiteGraph node class "+a+" has onPropertyChange method, it must be called onPropertyChanged with d at the end"),b.supported_extensions)for(e in b.supported_extensions){var E=b.supported_extensions[e];E&&E.constructor===String&&
-(this.node_types_by_file_extension[E.toLowerCase()]=b)}this.registered_node_types[a]=b;b.constructor.name&&(this.Nodes[d]=b);if(f.onNodeTypeRegistered)f.onNodeTypeRegistered(a,b);if(g&&f.onNodeTypeReplaced)f.onNodeTypeReplaced(a,b,g);b.prototype.onPropertyChange&&console.warn("LiteGraph node class "+a+" has onPropertyChange method, it must be called onPropertyChanged with d at the end");if(b.supported_extensions)for(e=0;em&&(m=e.size[0]),s+=e.size[1]+a+f.NODE_TITLE_HEIGHT;b+=m+a}this.setDirtyCanvas(!0,!0)};c.prototype.getTime=function(){return this.globaltime};c.prototype.getFixedTime=function(){return this.fixedtime};c.prototype.getElapsedTime=function(){return this.elapsed_time};c.prototype.sendEventToAllNodes=function(a,b,d){d=d||f.ALWAYS;var g=this._nodes_in_order?this._nodes_in_order:this._nodes;if(g)for(var e=0,E=g.length;e<
-E;++e){var m=g[e];if(m.constructor===f.Subgraph&&"onExecute"!=a)m.mode==d&&m.sendEventToAllNodes(a,b,d);else if(m[a]&&m.mode==d)if(void 0===b)m[a]();else if(b&&b.constructor===Array)m[a].apply(m,b);else m[a](b)}};c.prototype.sendActionToCanvas=function(a,b){if(this.list_of_graphcanvas)for(var d=0;d=f.MAX_NUMBER_OF_NODES)throw"LiteGraph: max number of nodes in a graph reached";null==a.id||-1==a.id?a.id=++this.last_node_id:this.last_node_ida.length||(this._pos[0]=a[0],this._pos[1]=a[1])},get:function(){return this._pos},enumerable:!0});this.id=-1;this.type=null;this.inputs=[];this.outputs=[];this.connections=[];this.properties={};this.properties_info=[];this.flags={}};u.prototype.configure=function(a){this.graph&&this.graph._version++;for(var b in a)if("properties"==b)for(var d in a.properties){if(this.properties[d]=a.properties[d],this.onPropertyChanged)this.onPropertyChanged(d,
-a.properties[d])}else null!=a[b]&&("object"==typeof a[b]?this[b]&&this[b].configure?this[b].configure(a[b]):this[b]=f.cloneObject(a[b],this[b]):this[b]=a[b]);a.title||(this.title=this.constructor.title);if(this.onConnectionsChange){if(this.inputs)for(d=0;d=this.outputs.length)){var d=this.outputs[a];if(d&&(d._data=b,this.outputs[a].links))for(d=0;d=this.outputs.length)){var d=this.outputs[a];if(d&&(d.type=b,this.outputs[a].links))for(d=0;d=this.inputs.length||null==this.inputs[a].link)){var d=this.graph.links[this.inputs[a].link];if(!d)return null;if(!b)return d.data;var g=this.graph.getNodeById(d.origin_id);if(!g)return d.data;
-if(g.updateOutputData)g.updateOutputData(d.origin_slot);else if(g.onExecute)g.onExecute();return d.data}};u.prototype.getInputDataType=function(a){if(!this.inputs||a>=this.inputs.length||null==this.inputs[a].link)return null;a=this.graph.links[this.inputs[a].link];if(!a)return null;var b=this.graph.getNodeById(a.origin_id);return b?(a=b.outputs[a.origin_slot])?a.type:null:a.type};u.prototype.getInputDataByName=function(a,b){var d=this.findInputSlot(a);return-1==d?null:this.getInputData(d,b)};u.prototype.isInputConnected=
-function(a){return this.inputs?a=this.inputs.length)return null;a=this.inputs[a];return a&&null!==a.link?(a=this.graph.links[a.link])?this.graph.getNodeById(a.origin_id):
-null:null};u.prototype.getInputOrProperty=function(a){if(!this.inputs||!this.inputs.length)return this.properties?this.properties[a]:null;for(var b=0,d=this.inputs.length;b=this.outputs.length?null:this.outputs[a]._data};u.prototype.getOutputInfo=function(a){return this.outputs?a=this.outputs.length)return null;a=this.outputs[a];if(!a.links||0==a.links.length)return null;
-for(var b=[],d=0;da&&this.pos[1]-e-db)return!0;return!1};u.prototype.getSlotInPosition=function(a,b){var d=new Float32Array(2);if(this.inputs)for(var g=0,e=this.inputs.length;g=this.outputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),null;b&&b.constructor===Number&&(b=this.graph.getNodeById(b));
-if(!b)throw"target node is null";if(b==this)return null;if(d.constructor===String){if(d=b.findInputSlot(d),-1==d)return f.debug&&console.log("Connect: Error, no slot of name "+d),null}else{if(d===f.EVENT)return null;if(!b.inputs||d>=b.inputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),null}var g=!1;null!=b.inputs[d].link&&(this.graph.beforeChange(),b.disconnectInput(d),g=!0);var e=this.outputs[a];if(b.onConnectInput&&!1===b.onConnectInput(d,e.type,e,this,a))return null;
-var c=b.inputs[d],m=null;if(!f.isValidConnection(e.type,c.type))return this.setDirtyCanvas(!1,!0),g&&this.graph.connectionChange(this,m),null;g||this.graph.beforeChange();m=new l(++this.graph.last_link_id,c.type,this.id,a,b.id,d);this.graph.links[m.id]=m;null==e.links&&(e.links=[]);e.links.push(m.id);b.inputs[d].link=m.id;this.graph&&this.graph._version++;if(this.onConnectionsChange)this.onConnectionsChange(f.OUTPUT,a,!0,m,e);if(b.onConnectionsChange)b.onConnectionsChange(f.INPUT,d,!0,m,c);this.graph&&
-this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(f.INPUT,b,d,this,a),this.graph.onNodeConnectionChange(f.OUTPUT,this,a,b,d));this.setDirtyCanvas(!1,!0);this.graph.afterChange();this.graph.connectionChange(this,m);return m};u.prototype.disconnectOutput=function(a,b){if(a.constructor===String){if(a=this.findOutputSlot(a),-1==a)return f.debug&&console.log("Connect: Error, no slot of name "+a),!1}else if(!this.outputs||a>=this.outputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),
-!1;var d=this.outputs[a];if(!d||!d.links||0==d.links.length)return!1;if(b){b.constructor===Number&&(b=this.graph.getNodeById(b));if(!b)throw"Target Node not found";for(var g=0,e=d.links.length;g=this.inputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),!1;var b=this.inputs[a];if(!b)return!1;var d=this.inputs[a].link;if(null!=d){this.inputs[a].link=null;var g=this.graph.links[d];if(g){var e=this.graph.getNodeById(g.origin_id);if(!e)return!1;var c=e.outputs[g.origin_slot];if(!c||!c.links||0==c.links.length)return!1;for(var m=0,
-s=c.links.length;mb&&this.inputs[b].pos)return d[0]=this.pos[0]+this.inputs[b].pos[0],d[1]=this.pos[1]+this.inputs[b].pos[1],d;if(!a&&g>b&&this.outputs[b].pos)return d[0]=this.pos[0]+this.outputs[b].pos[0],d[1]=this.pos[1]+this.outputs[b].pos[1],d;if(this.horizontal)return d[0]=this.pos[0]+this.size[0]/g*(b+0.5),d[1]=a?this.pos[1]-f.NODE_TITLE_HEIGHT:this.pos[1]+this.size[1],d;d[0]=a?this.pos[0]+e:this.pos[0]+this.size[0]+1-e;d[1]=this.pos[1]+(b+0.7)*f.NODE_SLOT_HEIGHT+(this.constructor.slot_start_y||0);
-return d};u.prototype.alignToGrid=function(){this.pos[0]=f.CANVAS_GRID_SIZE*Math.round(this.pos[0]/f.CANVAS_GRID_SIZE);this.pos[1]=f.CANVAS_GRID_SIZE*Math.round(this.pos[1]/f.CANVAS_GRID_SIZE)};u.prototype.trace=function(a){this.console||(this.console=[]);this.console.push(a);this.console.length>u.MAX_CONSOLE&&this.console.shift();if(this.graph.onNodeTrace)this.graph.onNodeTrace(this,a)};u.prototype.setDirtyCanvas=function(a,b){this.graph&&this.graph.sendActionToCanvas("setDirty",[a,b])};u.prototype.loadImage=
-function(a){var b=new Image;b.src=f.node_images_path+a;b.ready=!1;var d=this;b.onload=function(){this.ready=!0;d.setDirtyCanvas(!0)};return b};u.prototype.captureInput=function(a){if(this.graph&&this.graph.list_of_graphcanvas)for(var b=this.graph.list_of_graphcanvas,d=0;da.length||(this._pos[0]=a[0],this._pos[1]=a[1])},get:function(){return this._pos},enumerable:!0});Object.defineProperty(this,"size",{set:function(a){!a||2>a.length||(this._size[0]=Math.max(140,a[0]),this._size[1]=Math.max(80,a[1]))},get:function(){return this._size},enumerable:!0})};r.prototype.configure=function(a){this.title=a.title;this._bounding.set(a.bounding);this.color=
-a.color;this.font=a.font};r.prototype.serialize=function(){var a=this._bounding;return{title:this.title,bounding:[Math.round(a[0]),Math.round(a[1]),Math.round(a[2]),Math.round(a[3])],color:this.color,font:this.font}};r.prototype.move=function(a,b,d){this._pos[0]+=a;this._pos[1]+=b;if(!d)for(d=0;dthis.max_scale&&(a=this.max_scale);if(a!=this.scale&&this.element){var d=this.element.getBoundingClientRect();if(d){b=b||[0.5*d.width,0.5*d.height];d=this.convertCanvasToOffset(b);this.scale=a;0.01>Math.abs(this.scale-1)&&(this.scale=1);var g=this.convertCanvasToOffset(b),d=[g[0]-d[0],g[1]-d[1]];this.offset[0]+=d[0];this.offset[1]+=d[1];if(this.onredraw)this.onredraw(this)}}};
-t.prototype.changeDeltaScale=function(a,b){this.changeScale(this.scale*a,b)};t.prototype.reset=function(){this.scale=1;this.offset[0]=0;this.offset[1]=0};B.LGraphCanvas=f.LGraphCanvas=h;h.DEFAULT_BACKGROUND_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=";
+e>s.height-y.height-10&&(e=s.height-y.height-10)}f.style.left=m+"px";f.style.top=e+"px";b.scale&&(f.style.transform="scale("+b.scale+")")}function D(a){this.points=a;this.nearest=this.selected=-1;this.size=null;this.must_update=!0;this.margin=5}var f=B.LiteGraph={VERSION:0.4,CANVAS_GRID_SIZE:10,NODE_TITLE_HEIGHT:30,NODE_TITLE_TEXT_Y:20,NODE_SLOT_HEIGHT:20,NODE_WIDGET_HEIGHT:20,NODE_WIDTH:140,NODE_MIN_WIDTH:50,NODE_COLLAPSED_RADIUS:10,NODE_COLLAPSED_WIDTH:80,NODE_TITLE_COLOR:"#999",NODE_SELECTED_TITLE_COLOR:"#FFF",
+NODE_TEXT_SIZE:14,NODE_TEXT_COLOR:"#AAA",NODE_SUBTEXT_SIZE:12,NODE_DEFAULT_COLOR:"#333",NODE_DEFAULT_BGCOLOR:"#353535",NODE_DEFAULT_BOXCOLOR:"#666",NODE_DEFAULT_SHAPE:"box",NODE_BOX_OUTLINE_COLOR:"#FFF",DEFAULT_SHADOW_COLOR:"rgba(0,0,0,0.5)",DEFAULT_GROUP_FONT:24,WIDGET_BGCOLOR:"#222",WIDGET_OUTLINE_COLOR:"#666",WIDGET_TEXT_COLOR:"#DDD",WIDGET_SECONDARY_TEXT_COLOR:"#999",LINK_COLOR:"#9A9",EVENT_LINK_COLOR:"#A86",CONNECTING_LINK_COLOR:"#AFA",MAX_NUMBER_OF_NODES:1E3,DEFAULT_POSITION:[100,100],VALID_SHAPES:["default",
+"box","round","card"],BOX_SHAPE:1,ROUND_SHAPE:2,CIRCLE_SHAPE:3,CARD_SHAPE:4,ARROW_SHAPE:5,INPUT:1,OUTPUT:2,EVENT:-1,ACTION:-1,ALWAYS:0,ON_EVENT:1,NEVER:2,ON_TRIGGER:3,UP:1,DOWN:2,LEFT:3,RIGHT:4,CENTER:5,STRAIGHT_LINK:0,LINEAR_LINK:1,SPLINE_LINK:2,NORMAL_TITLE:0,NO_TITLE:1,TRANSPARENT_TITLE:2,AUTOHIDE_TITLE:3,proxy:null,node_images_path:"",debug:!1,catch_exceptions:!0,throw_errors:!0,allow_scripts:!1,registered_node_types:{},node_types_by_file_extension:{},Nodes:{},Globals:{},searchbox_extras:{},auto_sort_node_types:!1,
+registerNodeType:function(a,b){if(!b.prototype)throw"Cannot register a simple object, it must be a class with a prototype";b.type=a;f.debug&&console.log("Node registered: "+a);a.split("/");var d=b.name,g=a.lastIndexOf("/");b.category=a.substr(0,g);b.title||(b.title=d);if(b.prototype)for(var e in u.prototype)b.prototype[e]||(b.prototype[e]=u.prototype[e]);if(g=this.registered_node_types[a])console.log("replacing node type: "+a);else if(Object.hasOwnProperty(b.prototype,"shape")||Object.defineProperty(b.prototype,
+"shape",{set:function(a){switch(a){case "default":delete this._shape;break;case "box":this._shape=f.BOX_SHAPE;break;case "round":this._shape=f.ROUND_SHAPE;break;case "circle":this._shape=f.CIRCLE_SHAPE;break;case "card":this._shape=f.CARD_SHAPE;break;default:this._shape=a}},get:function(a){return this._shape},enumerable:!0,configurable:!0}),b.prototype.onPropertyChange&&console.warn("LiteGraph node class "+a+" has onPropertyChange method, it must be called onPropertyChanged with d at the end"),b.supported_extensions)for(e in b.supported_extensions){var E=
+b.supported_extensions[e];E&&E.constructor===String&&(this.node_types_by_file_extension[E.toLowerCase()]=b)}this.registered_node_types[a]=b;b.constructor.name&&(this.Nodes[d]=b);if(f.onNodeTypeRegistered)f.onNodeTypeRegistered(a,b);if(g&&f.onNodeTypeReplaced)f.onNodeTypeReplaced(a,b,g);b.prototype.onPropertyChange&&console.warn("LiteGraph node class "+a+" has onPropertyChange method, it must be called onPropertyChanged with d at the end");if(b.supported_extensions)for(e=0;em&&(m=e.size[0]),s+=e.size[1]+a+f.NODE_TITLE_HEIGHT;b+=m+a}this.setDirtyCanvas(!0,!0)};c.prototype.getTime=function(){return this.globaltime};c.prototype.getFixedTime=function(){return this.fixedtime};c.prototype.getElapsedTime=function(){return this.elapsed_time};
+c.prototype.sendEventToAllNodes=function(a,b,d){d=d||f.ALWAYS;var g=this._nodes_in_order?this._nodes_in_order:this._nodes;if(g)for(var e=0,E=g.length;e=f.MAX_NUMBER_OF_NODES)throw"LiteGraph: max number of nodes in a graph reached";null==a.id||-1==a.id?a.id=++this.last_node_id:this.last_node_ida.length||(this._pos[0]=a[0],this._pos[1]=a[1])},get:function(){return this._pos},enumerable:!0});this.id=-1;this.type=null;this.inputs=[];this.outputs=[];this.connections=[];this.properties={};this.properties_info=[];this.flags={}};u.prototype.configure=function(a){this.graph&&this.graph._version++;
+for(var b in a)if("properties"==b)for(var d in a.properties){if(this.properties[d]=a.properties[d],this.onPropertyChanged)this.onPropertyChanged(d,a.properties[d])}else null!=a[b]&&("object"==typeof a[b]?this[b]&&this[b].configure?this[b].configure(a[b]):this[b]=f.cloneObject(a[b],this[b]):this[b]=a[b]);a.title||(this.title=this.constructor.title);if(this.onConnectionsChange){if(this.inputs)for(d=0;d=this.outputs.length)){var d=this.outputs[a];if(d&&(d._data=b,this.outputs[a].links))for(d=0;d=this.outputs.length)){var d=this.outputs[a];if(d&&(d.type=b,this.outputs[a].links))for(d=0;d=this.inputs.length||null==this.inputs[a].link)){var d=this.graph.links[this.inputs[a].link];if(!d)return null;if(!b)return d.data;
+var g=this.graph.getNodeById(d.origin_id);if(!g)return d.data;if(g.updateOutputData)g.updateOutputData(d.origin_slot);else if(g.onExecute)g.onExecute();return d.data}};u.prototype.getInputDataType=function(a){if(!this.inputs||a>=this.inputs.length||null==this.inputs[a].link)return null;a=this.graph.links[this.inputs[a].link];if(!a)return null;var b=this.graph.getNodeById(a.origin_id);return b?(a=b.outputs[a.origin_slot])?a.type:null:a.type};u.prototype.getInputDataByName=function(a,b){var d=this.findInputSlot(a);
+return-1==d?null:this.getInputData(d,b)};u.prototype.isInputConnected=function(a){return this.inputs?a=this.inputs.length)return null;a=this.inputs[a];return a&&null!==
+a.link?(a=this.graph.links[a.link])?this.graph.getNodeById(a.origin_id):null:null};u.prototype.getInputOrProperty=function(a){if(!this.inputs||!this.inputs.length)return this.properties?this.properties[a]:null;for(var b=0,d=this.inputs.length;b=this.outputs.length?null:this.outputs[a]._data};u.prototype.getOutputInfo=
+function(a){return this.outputs?a=this.outputs.length)return null;
+a=this.outputs[a];if(!a.links||0==a.links.length)return null;for(var b=[],d=0;da&&this.pos[1]-e-db)return!0;return!1};u.prototype.getSlotInPosition=function(a,b){var d=new Float32Array(2);if(this.inputs)for(var g=
+0,e=this.inputs.length;g=this.outputs.length)return f.debug&&
+console.log("Connect: Error, slot number not found"),null;b&&b.constructor===Number&&(b=this.graph.getNodeById(b));if(!b)throw"target node is null";if(b==this)return null;if(d.constructor===String){if(d=b.findInputSlot(d),-1==d)return f.debug&&console.log("Connect: Error, no slot of name "+d),null}else{if(d===f.EVENT)return null;if(!b.inputs||d>=b.inputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),null}var g=!1;null!=b.inputs[d].link&&(this.graph.beforeChange(),b.disconnectInput(d),
+g=!0);var e=this.outputs[a];if(b.onConnectInput&&!1===b.onConnectInput(d,e.type,e,this,a))return null;var c=b.inputs[d],m=null;if(!f.isValidConnection(e.type,c.type))return this.setDirtyCanvas(!1,!0),g&&this.graph.connectionChange(this,m),null;g||this.graph.beforeChange();m=new l(++this.graph.last_link_id,c.type,this.id,a,b.id,d);this.graph.links[m.id]=m;null==e.links&&(e.links=[]);e.links.push(m.id);b.inputs[d].link=m.id;this.graph&&this.graph._version++;if(this.onConnectionsChange)this.onConnectionsChange(f.OUTPUT,
+a,!0,m,e);if(b.onConnectionsChange)b.onConnectionsChange(f.INPUT,d,!0,m,c);this.graph&&this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(f.INPUT,b,d,this,a),this.graph.onNodeConnectionChange(f.OUTPUT,this,a,b,d));this.setDirtyCanvas(!1,!0);this.graph.afterChange();this.graph.connectionChange(this,m);return m};u.prototype.disconnectOutput=function(a,b){if(a.constructor===String){if(a=this.findOutputSlot(a),-1==a)return f.debug&&console.log("Connect: Error, no slot of name "+a),
+!1}else if(!this.outputs||a>=this.outputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),!1;var d=this.outputs[a];if(!d||!d.links||0==d.links.length)return!1;if(b){b.constructor===Number&&(b=this.graph.getNodeById(b));if(!b)throw"Target Node not found";for(var g=0,e=d.links.length;g=this.inputs.length)return f.debug&&console.log("Connect: Error, slot number not found"),!1;var b=this.inputs[a];if(!b)return!1;var d=this.inputs[a].link;if(null!=d){this.inputs[a].link=null;var g=this.graph.links[d];
+if(g){var e=this.graph.getNodeById(g.origin_id);if(!e)return!1;var c=e.outputs[g.origin_slot];if(!c||!c.links||0==c.links.length)return!1;for(var m=0,s=c.links.length;mb&&this.inputs[b].pos)return d[0]=this.pos[0]+this.inputs[b].pos[0],d[1]=this.pos[1]+this.inputs[b].pos[1],d;if(!a&&g>b&&this.outputs[b].pos)return d[0]=this.pos[0]+this.outputs[b].pos[0],d[1]=this.pos[1]+this.outputs[b].pos[1],d;if(this.horizontal)return d[0]=this.pos[0]+this.size[0]/g*(b+0.5),d[1]=a?this.pos[1]-f.NODE_TITLE_HEIGHT:
+this.pos[1]+this.size[1],d;d[0]=a?this.pos[0]+e:this.pos[0]+this.size[0]+1-e;d[1]=this.pos[1]+(b+0.7)*f.NODE_SLOT_HEIGHT+(this.constructor.slot_start_y||0);return d};u.prototype.alignToGrid=function(){this.pos[0]=f.CANVAS_GRID_SIZE*Math.round(this.pos[0]/f.CANVAS_GRID_SIZE);this.pos[1]=f.CANVAS_GRID_SIZE*Math.round(this.pos[1]/f.CANVAS_GRID_SIZE)};u.prototype.trace=function(a){this.console||(this.console=[]);this.console.push(a);this.console.length>u.MAX_CONSOLE&&this.console.shift();if(this.graph.onNodeTrace)this.graph.onNodeTrace(this,
+a)};u.prototype.setDirtyCanvas=function(a,b){this.graph&&this.graph.sendActionToCanvas("setDirty",[a,b])};u.prototype.loadImage=function(a){var b=new Image;b.src=f.node_images_path+a;b.ready=!1;var d=this;b.onload=function(){this.ready=!0;d.setDirtyCanvas(!0)};return b};u.prototype.captureInput=function(a){if(this.graph&&this.graph.list_of_graphcanvas)for(var b=this.graph.list_of_graphcanvas,d=0;da.length||(this._pos[0]=a[0],this._pos[1]=a[1])},get:function(){return this._pos},enumerable:!0});Object.defineProperty(this,"size",{set:function(a){!a||2>a.length||(this._size[0]=Math.max(140,a[0]),this._size[1]=Math.max(80,a[1]))},get:function(){return this._size},
+enumerable:!0})};r.prototype.configure=function(a){this.title=a.title;this._bounding.set(a.bounding);this.color=a.color;this.font=a.font};r.prototype.serialize=function(){var a=this._bounding;return{title:this.title,bounding:[Math.round(a[0]),Math.round(a[1]),Math.round(a[2]),Math.round(a[3])],color:this.color,font:this.font}};r.prototype.move=function(a,b,d){this._pos[0]+=a;this._pos[1]+=b;if(!d)for(d=0;dthis.max_scale&&(a=this.max_scale);if(a!=this.scale&&this.element){var d=this.element.getBoundingClientRect();if(d){b=b||[0.5*d.width,0.5*d.height];d=this.convertCanvasToOffset(b);this.scale=a;0.01>Math.abs(this.scale-1)&&(this.scale=
+1);var g=this.convertCanvasToOffset(b),d=[g[0]-d[0],g[1]-d[1]];this.offset[0]+=d[0];this.offset[1]+=d[1];if(this.onredraw)this.onredraw(this)}}};t.prototype.changeDeltaScale=function(a,b){this.changeScale(this.scale*a,b)};t.prototype.reset=function(){this.scale=1;this.offset[0]=0;this.offset[1]=0};B.LGraphCanvas=f.LGraphCanvas=h;h.DEFAULT_BACKGROUND_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=";
h.link_type_colors={"-1":f.EVENT_LINK_COLOR,number:"#AAA",node:"#DCA"};h.gradients={};h.prototype.clear=function(){this.fps=this.render_time=this.last_draw_time=this.frame=0;this.dragging_rectangle=null;this.selected_nodes={};this.selected_group=null;this.visible_nodes=[];this.connecting_node=this.node_capturing_input=this.node_over=this.node_dragged=null;this.highlighted_links={};this.dragging_canvas=!1;this.dirty_bgcanvas=this.dirty_canvas=!0;this.node_widget=this.node_in_panel=this.dirty_area=
null;this.last_mouse=[0,0];this.last_mouseclick=0;this.visible_area.set([0,0,0,0]);if(this.onClear)this.onClear()};h.prototype.setGraph=function(a,b){this.graph!=a&&(b||this.clear(),!a&&this.graph?this.graph.detachCanvas(this):(a.attachCanvas(this),this._graph_stack&&(this._graph_stack=null),this.setDirty(!0,!0)))};h.prototype.getTopGraph=function(){return this._graph_stack.length?this._graph_stack[0]:this.graph};h.prototype.openSubgraph=function(a){if(!a)throw"graph cannot be null";if(this.graph==
a)throw"graph cannot be the same";this.clear();this.graph&&(this._graph_stack||(this._graph_stack=[]),this._graph_stack.push(this.graph));a.attachCanvas(this);this.checkPanels();this.setDirty(!0,!0)};h.prototype.closeSubgraph=function(){if(this._graph_stack&&0!=this._graph_stack.length){var a=this.graph._subgraph_node,b=this._graph_stack.pop();this.selected_nodes={};this.highlighted_links={};b.attachCanvas(this);this.setDirty(!0,!0);a&&(this.centerOnNode(a),this.selectNodes([a]))}};h.prototype.getCurrentGraph=
@@ -180,24 +180,24 @@ function(a,b){var d=b._pos;a.fillStyle="black";a.beginPath();a.arc(d[0],d[1],3,0
f.TRANSPARENT_TITLE?q=!1:k==f.AUTOHIDE_TITLE&&m&&(q=!0);w[0]=0;w[1]=q?-e:0;w[2]=d[0]+1;w[3]=q?d[1]+e:d[1];m=b.globalAlpha;b.beginPath();y==f.BOX_SHAPE||s?b.fillRect(w[0],w[1],w[2],w[3]):y==f.ROUND_SHAPE||y==f.CARD_SHAPE?b.roundRect(w[0],w[1],w[2],w[3],this.round_radius,y==f.CARD_SHAPE?0:this.round_radius):y==f.CIRCLE_SHAPE&&b.arc(0.5*d[0],0.5*d[1],0.5*d[0],0,2*Math.PI);b.fill();a.flags.collapsed||(b.shadowColor="transparent",b.fillStyle="rgba(0,0,0,0.2)",b.fillRect(0,-1,w[2],2));b.shadowColor="transparent";
if(a.onDrawBackground)a.onDrawBackground(b,this,this.canvas,this.graph_mouse);if(q||k==f.TRANSPARENT_TITLE){if(a.onDrawTitleBar)a.onDrawTitleBar(b,e,d,this.ds.scale,g);else if(k!=f.TRANSPARENT_TITLE&&(a.constructor.title_color||this.render_title_colored)){q=a.constructor.title_color||g;a.flags.collapsed&&(b.shadowColor=f.DEFAULT_SHADOW_COLOR);if(this.use_gradients){var z=h.gradients[q];z||(z=h.gradients[q]=b.createLinearGradient(0,0,400,0),z.addColorStop(0,q),z.addColorStop(1,"#000"));b.fillStyle=
z}else b.fillStyle=q;b.beginPath();y==f.BOX_SHAPE||s?b.rect(0,-e,d[0]+1,e):y!=f.ROUND_SHAPE&&y!=f.CARD_SHAPE||b.roundRect(0,-e,d[0]+1,e,this.round_radius,a.flags.collapsed?this.round_radius:0);b.fill();b.shadowColor="transparent"}if(a.onDrawTitleBox)a.onDrawTitleBox(b,e,d,this.ds.scale);else y==f.ROUND_SHAPE||y==f.CIRCLE_SHAPE||y==f.CARD_SHAPE?(s&&(b.fillStyle="black",b.beginPath(),b.arc(0.5*e,-0.5*e,6,0,2*Math.PI),b.fill()),b.fillStyle=a.boxcolor||f.NODE_DEFAULT_BOXCOLOR,s?b.fillRect(0.5*e-5,-0.5*
-e-5,10,10):(b.beginPath(),b.arc(0.5*e,-0.5*e,5,0,2*Math.PI),b.fill())):(s&&(b.fillStyle="black",b.fillRect(0.5*(e-10)-1,-0.5*(e+10)-1,12,12)),b.fillStyle=a.boxcolor||f.NODE_DEFAULT_BOXCOLOR,b.fillRect(0.5*(e-10),-0.5*(e+10),10,10));b.globalAlpha=m;if(a.onDrawTitleText)a.onDrawTitleText(b,e,d,this.ds.scale,this.title_text_font,c);!s&&(b.font=this.title_text_font,m=String(a.getTitle()))&&(b.fillStyle=c?"white":a.constructor.title_text_color||this.node_title_color,a.flags.collapsed?(b.textAlign="left",
-b.measureText(m),b.fillText(m.substr(0,20),e,f.NODE_TITLE_TEXT_Y-e),b.textAlign="left"):(b.textAlign="left",b.fillText(m,e,f.NODE_TITLE_TEXT_Y-e)));a.flags.collapsed||!a.subgraph||a.skip_subgraph_button||(m=f.NODE_TITLE_HEIGHT,q=a.size[0]-m,z=f.isInsideRectangle(this.graph_mouse[0]-a.pos[0],this.graph_mouse[1]-a.pos[1],q+2,-m+2,m-4,m-4),b.fillStyle=z?"#888":"#555",y==f.BOX_SHAPE||s?b.fillRect(q+2,-m+2,m-4,m-4):(b.beginPath(),b.roundRect(q+2,-m+2,m-4,m-4,4),b.fill()),b.fillStyle="#333",b.beginPath(),
-b.moveTo(q+0.2*m,0.6*-m),b.lineTo(q+0.8*m,0.6*-m),b.lineTo(q+0.5*m,0.3*-m),b.fill());if(a.onDrawTitle)a.onDrawTitle(b)}if(c){if(a.onBounding)a.onBounding(w);k==f.TRANSPARENT_TITLE&&(w[1]-=e,w[3]+=e);b.lineWidth=1;b.globalAlpha=0.8;b.beginPath();y==f.BOX_SHAPE?b.rect(-6+w[0],-6+w[1],12+w[2],12+w[3]):y==f.ROUND_SHAPE||y==f.CARD_SHAPE&&a.flags.collapsed?b.roundRect(-6+w[0],-6+w[1],12+w[2],12+w[3],2*this.round_radius):y==f.CARD_SHAPE?b.roundRect(-6+w[0],-6+w[1],12+w[2],12+w[3],2*this.round_radius,2):
-y==f.CIRCLE_SHAPE&&b.arc(0.5*d[0],0.5*d[1],0.5*d[0]+6,0,2*Math.PI);b.strokeStyle="#FFF";b.stroke();b.strokeStyle=g;b.globalAlpha=1}};var L=new Float32Array(4),n=new Float32Array(4),v=new Float32Array(2),k=new Float32Array(2);h.prototype.drawConnections=function(a){var b=f.getTime(),d=this.visible_area;L[0]=d[0]-20;L[1]=d[1]-20;L[2]=d[2]+40;L[3]=d[3]+40;a.lineWidth=this.connections_width;a.fillStyle="#AAA";a.strokeStyle="#AAA";a.globalAlpha=this.editor_alpha;for(var d=this.graph._nodes,g=0,e=d.length;g<
-e;++g){var c=d[g];if(c.inputs&&c.inputs.length)for(var m=0;mn[2]&&(n[0]+=n[2],n[2]=Math.abs(n[2]));0>n[3]&&(n[1]+=n[3],n[3]=Math.abs(n[3]));if(G(n,L)){var F=y.outputs[q],q=c.inputs[m];if(F&&
-q&&(y=F.dir||(y.horizontal?f.DOWN:f.RIGHT),q=q.dir||(c.horizontal?f.UP:f.LEFT),this.renderLink(a,h,z,s,!1,0,null,y,q),s&&s._last_time&&1E3>b-s._last_time)){var F=2-0.002*(b-s._last_time),r=a.globalAlpha;a.globalAlpha=r*F;this.renderLink(a,h,z,s,!0,F,"white",y,q);a.globalAlpha=r}}}}}}a.globalAlpha=1};h.prototype.renderLink=function(a,b,d,g,e,c,m,s,y,k){g&&this.visible_links.push(g);!m&&g&&(m=g.color||h.link_type_colors[g.type]);m||(m=this.default_link_color);null!=g&&this.highlighted_links[g.id]&&
-(m="#FFF");s=s||f.RIGHT;y=y||f.LEFT;var q=C(b,d);this.render_connections_border&&0.6b[1]?0:Math.PI,a.save(),a.translate(z[0],z[1]),a.rotate(F),a.beginPath(),a.moveTo(-5,-3),a.lineTo(0,7),a.lineTo(5,-3),a.fill(),a.restore(),a.save(),a.translate(k[0],k[1]),a.rotate(n),
-a.beginPath(),a.moveTo(-5,-3),a.lineTo(0,7),a.lineTo(5,-3),a.fill(),a.restore()),a.beginPath(),a.arc(e[0],e[1],5,0,2*Math.PI),a.fill());if(c)for(a.fillStyle=m,z=0;5>z;++z)c=(0.001*f.getTime()+0.2*z)%1,e=this.computeConnectionPoint(b,d,c,s,y),a.beginPath(),a.arc(e[0],e[1],5,0,2*Math.PI),a.fill()};h.prototype.computeConnectionPoint=function(a,b,d,g,e){g=g||f.RIGHT;e=e||f.LEFT;var c=C(a,b),m=[a[0],a[1]],s=[b[0],b[1]];switch(g){case f.LEFT:m[0]+=-0.25*c;break;case f.RIGHT:m[0]+=0.25*c;break;case f.UP:m[1]+=
--0.25*c;break;case f.DOWN:m[1]+=0.25*c}switch(e){case f.LEFT:s[0]+=-0.25*c;break;case f.RIGHT:s[0]+=0.25*c;break;case f.UP:s[1]+=-0.25*c;break;case f.DOWN:s[1]+=0.25*c}g=(1-d)*(1-d)*(1-d);e=3*(1-d)*(1-d)*d;c=3*(1-d)*d*d;d*=d*d;return[g*a[0]+e*m[0]+c*s[0]+d*b[0],g*a[1]+e*m[1]+c*s[1]+d*b[1]]};h.prototype.drawExecutionOrder=function(a){a.shadowColor="transparent";a.globalAlpha=0.25;a.textAlign="center";a.strokeStyle="white";a.globalAlpha=0.75;for(var b=this.visible_nodes,d=0;dn[2]&&(n[0]+=n[2],n[2]=Math.abs(n[2]));0>n[3]&&(n[1]+=n[3],n[3]=Math.abs(n[3]));if(G(n,
+L)){var F=y.outputs[q],q=c.inputs[m];if(F&&q&&(y=F.dir||(y.horizontal?f.DOWN:f.RIGHT),q=q.dir||(c.horizontal?f.UP:f.LEFT),this.renderLink(a,h,z,s,!1,0,null,y,q),s&&s._last_time&&1E3>b-s._last_time)){var F=2-0.002*(b-s._last_time),r=a.globalAlpha;a.globalAlpha=r*F;this.renderLink(a,h,z,s,!0,F,"white",y,q);a.globalAlpha=r}}}}}}a.globalAlpha=1};h.prototype.renderLink=function(a,b,d,g,e,c,m,s,y,k){g&&this.visible_links.push(g);!m&&g&&(m=g.color||h.link_type_colors[g.type]);m||(m=this.default_link_color);
+null!=g&&this.highlighted_links[g.id]&&(m="#FFF");s=s||f.RIGHT;y=y||f.LEFT;var q=C(b,d);this.render_connections_border&&0.6b[1]?0:Math.PI,a.save(),a.translate(z[0],z[1]),a.rotate(F),a.beginPath(),a.moveTo(-5,-3),a.lineTo(0,7),a.lineTo(5,-3),a.fill(),a.restore(),a.save(),a.translate(k[0],
+k[1]),a.rotate(n),a.beginPath(),a.moveTo(-5,-3),a.lineTo(0,7),a.lineTo(5,-3),a.fill(),a.restore()),a.beginPath(),a.arc(e[0],e[1],5,0,2*Math.PI),a.fill());if(c)for(a.fillStyle=m,z=0;5>z;++z)c=(0.001*f.getTime()+0.2*z)%1,e=this.computeConnectionPoint(b,d,c,s,y),a.beginPath(),a.arc(e[0],e[1],5,0,2*Math.PI),a.fill()};h.prototype.computeConnectionPoint=function(a,b,d,g,e){g=g||f.RIGHT;e=e||f.LEFT;var c=C(a,b),m=[a[0],a[1]],s=[b[0],b[1]];switch(g){case f.LEFT:m[0]+=-0.25*c;break;case f.RIGHT:m[0]+=0.25*
+c;break;case f.UP:m[1]+=-0.25*c;break;case f.DOWN:m[1]+=0.25*c}switch(e){case f.LEFT:s[0]+=-0.25*c;break;case f.RIGHT:s[0]+=0.25*c;break;case f.UP:s[1]+=-0.25*c;break;case f.DOWN:s[1]+=0.25*c}g=(1-d)*(1-d)*(1-d);e=3*(1-d)*(1-d)*d;c=3*(1-d)*d*d;d*=d*d;return[g*a[0]+e*m[0]+c*s[0]+d*b[0],g*a[1]+e*m[1]+c*s[1]+d*b[1]]};h.prototype.drawExecutionOrder=function(a){a.shadowColor="transparent";a.globalAlpha=0.25;a.textAlign="center";a.strokeStyle="white";a.globalAlpha=0.75;for(var b=this.visible_nodes,d=0;d<
+b.length;++d){var g=b[d];a.fillStyle="black";a.fillRect(g.pos[0]-f.NODE_TITLE_HEIGHT,g.pos[1]-f.NODE_TITLE_HEIGHT,f.NODE_TITLE_HEIGHT,f.NODE_TITLE_HEIGHT);0==g.order&&a.strokeRect(g.pos[0]-f.NODE_TITLE_HEIGHT+0.5,g.pos[1]-f.NODE_TITLE_HEIGHT+0.5,f.NODE_TITLE_HEIGHT,f.NODE_TITLE_HEIGHT);a.fillStyle="#FFF";a.fillText(g.order,g.pos[0]+-0.5*f.NODE_TITLE_HEIGHT,g.pos[1]-6)}a.globalAlpha=1};h.prototype.drawNodeWidgets=function(a,b,d,g){if(!a.widgets||!a.widgets.length)return 0;var e=a.size[0],c=a.widgets;
+b+=2;var m=f.NODE_WIDGET_HEIGHT,s=0.5c||c>h-12||mn.last_y+F)){g=n.value;switch(n.type){case "button":if("mousemove"===d.type)break;n.callback&&setTimeout(function(){n.callback(n,y,a,b,d)},20);this.dirty_canvas=n.clicked=!0;break;case "slider":k=Math.clamp((c-10)/(h-20),0,1);n.value=n.options.min+(n.options.max-n.options.min)*k;n.callback&&setTimeout(function(){e(n,
n.value)},20);this.dirty_canvas=!0;break;case "number":case "combo":g=n.value;if("mousemove"==d.type&&"number"==n.type)n.value+=0.1*d.deltaX*(n.options.step||1),null!=n.options.min&&n.valuen.options.max&&(n.value=n.options.max);else if("mousedown"==d.type){var J=n.options.values;J&&J.constructor===Function&&(J=n.options.values(n,a));var I=null;"number"!=n.type&&(I=J.constructor===Array?J:Object.keys(J));c=40>c?-1:c>h-40?1:0;if("number"==
@@ -213,60 +213,60 @@ new f.ContextMenu(b,{event:d,callback:c,parentMenu:g},y);return!1}};h.onMenuColl
b.length;y++){var k=b[y];if(k){var n=k[0];k[2]&&k[2].label&&(n=k[2].label);n={content:n,value:k};k[1]==f.ACTION&&(n.className="event");s.push(n)}else s.push(null)}this.onMenuNodeInputs&&(s=this.onMenuNodeInputs(s));if(s.length)return new f.ContextMenu(s,{event:d,callback:c,parentMenu:g,node:e},a),!1;console.log("no input entries")}};h.showMenuNodeOptionalOutputs=function(a,b,d,g,e){function c(a,b,d){if(e&&(a.callback&&a.callback.call(m,e,a,b,d),a.value))if(d=a.value[1],!d||d.constructor!==Object&&
d.constructor!==Array)e.graph.beforeChange(),e.addOutput(a.value[0],a.value[1],a.value[2]),e.setDirtyCanvas(!0,!0),e.graph.afterChange();else{a=[];for(var s in d)a.push({content:s,value:d[s]});new f.ContextMenu(a,{event:b,callback:c,parentMenu:g,node:e});return!1}}if(e){var m=this;a=h.active_canvas.getCanvasWindow();b=e.optional_outputs;e.onGetOutputs&&(b=e.onGetOutputs());var s=[];if(b)for(var y=0;y"+k+""+a+"",value:k})}if(s.length)return new f.ContextMenu(s,{event:d,callback:c,parentMenu:g,allow_html:!0,node:e},b),!1}};h.decodeHTML=function(a){var b=document.createElement("div");
-b.innerText=a;return b.innerHTML};h.onResizeNode=function(a,b,d,g,e){if(e){e.size=e.computeSize();if(e.onResize)e.onResize(e.size);e.setDirtyCanvas(!0,!0)}};h.prototype.showLinkMenu=function(a,b){var d=this;console.log(a);var g=new f.ContextMenu(["Add Node",null,"Delete"],{event:b,title:null!=a.data?a.data.constructor.name:null,callback:function(b,f,c){switch(b){case "Add Node":h.onMenuAdd(null,null,c,g,function(b){console.log("node autoconnect");var e=d.graph.getNodeById(a.origin_id),g=d.graph.getNodeById(a.target_id);
-b.inputs&&b.inputs.length&&b.outputs&&b.outputs.length&&e.outputs[a.origin_slot].type==b.inputs[0].type&&b.outputs[0].type==g.inputs[0].type&&(e.connect(a.origin_slot,b,0),b.connect(0,g,a.target_slot),b.pos[0]-=0.5*b.size[0])});break;case "Delete":d.graph.removeLink(a.id)}}});return!1};h.onShowPropertyEditor=function(a,b,d,g,e){function f(){var b=k.value;"Number"==a.type?b=Number(b):"Boolean"==a.type&&(b=Boolean(b));e[c]=b;s.parentNode&&s.parentNode.removeChild(s);e.setDirtyCanvas(!0,!0)}var c=a.property||
-"title";b=e[c];var s=document.createElement("div");s.className="graphdialog";s.innerHTML="";s.querySelector(".name").innerText=c;var k=s.querySelector("input");k&&(k.value=b,k.addEventListener("blur",function(a){this.focus()}),k.addEventListener("keydown",function(a){13==a.keyCode&&(f(),a.preventDefault(),a.stopPropagation())}));b=h.active_canvas.canvas;d=b.getBoundingClientRect();var n=g=-20;d&&(g-=d.left,n-=
-d.top);event?(s.style.left=event.clientX+g+"px",s.style.top=event.clientY+n+"px"):(s.style.left=0.5*b.width+g+"px",s.style.top=0.5*b.height+n+"px");s.querySelector("button").addEventListener("click",f);b.parentNode.appendChild(s)};h.prototype.prompt=function(a,b,d,g){var e=this;a=a||"";var f=!1,c=document.createElement("div");c.className="graphdialog rounded";c.innerHTML=" ";c.close=function(){e.prompt_box=
-null;c.parentNode&&c.parentNode.removeChild(c)};1h.search_limit)break}}k=null;if(Array.prototype.filter)k=Object.keys(f.registered_node_types).filter(y);
-else for(m in k=[],f.registered_node_types)y(m)&&k.push(m);for(m=0;mh.search_limit);m++);var y=function(a){var b=f.registered_node_types[a];return s&&b.filter!=s?!1:-1!==a.toLowerCase().indexOf(d)}}}var e=this,c=h.active_canvas,m=c.canvas,s=m.ownerDocument||document,k=document.createElement("div");k.className="litegraph litesearchbox graphdialog rounded";k.innerHTML="Search ";
+var s=[],k;for(k in e.properties){a=void 0!==e.properties[k]?e.properties[k]:" ";"object"==typeof a&&(a=JSON.stringify(a));var n=e.getPropertyInfo(k);if("enum"==n.type||"combo"==n.type)a=h.getPropertyPrintableValue(a,n.values);a=h.decodeHTML(a);s.push({content:""+(n.label?n.label:k)+""+a+"",value:k})}if(s.length)return new f.ContextMenu(s,{event:d,callback:c,parentMenu:g,allow_html:!0,node:e},b),!1}};h.decodeHTML=function(a){var b=
+document.createElement("div");b.innerText=a;return b.innerHTML};h.onResizeNode=function(a,b,d,g,e){if(e){e.size=e.computeSize();if(e.onResize)e.onResize(e.size);e.setDirtyCanvas(!0,!0)}};h.prototype.showLinkMenu=function(a,b){var d=this;console.log(a);var g=new f.ContextMenu(["Add Node",null,"Delete"],{event:b,title:null!=a.data?a.data.constructor.name:null,callback:function(b,f,c){switch(b){case "Add Node":h.onMenuAdd(null,null,c,g,function(b){console.log("node autoconnect");var e=d.graph.getNodeById(a.origin_id),
+g=d.graph.getNodeById(a.target_id);b.inputs&&b.inputs.length&&b.outputs&&b.outputs.length&&e.outputs[a.origin_slot].type==b.inputs[0].type&&b.outputs[0].type==g.inputs[0].type&&(e.connect(a.origin_slot,b,0),b.connect(0,g,a.target_slot),b.pos[0]-=0.5*b.size[0])});break;case "Delete":d.graph.removeLink(a.id)}}});return!1};h.onShowPropertyEditor=function(a,b,d,g,e){function f(){var b=k.value;"Number"==a.type?b=Number(b):"Boolean"==a.type&&(b=Boolean(b));e[c]=b;s.parentNode&&s.parentNode.removeChild(s);
+e.setDirtyCanvas(!0,!0)}var c=a.property||"title";b=e[c];var s=document.createElement("div");s.className="graphdialog";s.innerHTML="";s.querySelector(".name").innerText=c;var k=s.querySelector("input");k&&(k.value=b,k.addEventListener("blur",function(a){this.focus()}),k.addEventListener("keydown",function(a){13==a.keyCode&&(f(),a.preventDefault(),a.stopPropagation())}));b=h.active_canvas.canvas;d=b.getBoundingClientRect();
+var n=g=-20;d&&(g-=d.left,n-=d.top);event?(s.style.left=event.clientX+g+"px",s.style.top=event.clientY+n+"px"):(s.style.left=0.5*b.width+g+"px",s.style.top=0.5*b.height+n+"px");s.querySelector("button").addEventListener("click",f);b.parentNode.appendChild(s)};h.prototype.prompt=function(a,b,d,g){var e=this;a=a||"";var f=!1,c=document.createElement("div");c.className="graphdialog rounded";c.innerHTML=" ";
+c.close=function(){e.prompt_box=null;c.parentNode&&c.parentNode.removeChild(c)};1h.search_limit)break}}k=
+null;if(Array.prototype.filter)k=Object.keys(f.registered_node_types).filter(y);else for(m in k=[],f.registered_node_types)y(m)&&k.push(m);for(m=0;mh.search_limit);m++);var y=function(a){var b=f.registered_node_types[a];return s&&b.filter!=s?!1:-1!==a.toLowerCase().indexOf(d)}}}var e=this,c=h.active_canvas,m=c.canvas,s=m.ownerDocument||document,k=document.createElement("div");k.className="litegraph litesearchbox graphdialog rounded";k.innerHTML="Search ";
k.close=function(){e.search_box=null;s.body.focus();s.body.style.overflow="";setTimeout(function(){e.canvas.focus()},20);k.parentNode&&k.parentNode.removeChild(k)};var n=null;1m.height-200&&(q.style.maxHeight=m.height-a.layerY-20+"px");J.focus();return k};h.prototype.showEditPropertyValue=function(a,b,d){function g(){e(h.value)}function e(e){f&&f.values&&f.values.constructor===Object&&void 0!=f.values[e]&&(e=f.values[e]);"number"==typeof a.properties[b]&&(e=Number(e));if("array"==c||"object"==c)e=JSON.parse(e);a.properties[b]=
e;a.graph&&a.graph._version++;if(a.onPropertyChanged)a.onPropertyChanged(b,e);if(d.onclose)d.onclose();q.close();a.setDirtyCanvas(!0,!0)}if(a&&void 0!==a.properties[b]){d=d||{};var f=a.getPropertyInfo(b),c=f.type,s="";if("string"==c||"number"==c||"array"==c||"object"==c)s="";else if("enum"!=c&&"combo"!=c||!f.values)if("boolean"==c)s="";else{console.warn("unknown type: "+c);
-return}else{var s=""}var q=this.createDialog(""+b+""+s+"",d);if("enum"!=c&&"combo"!=c||!f.values)if("boolean"==c)(h=q.querySelector("input"))&&h.addEventListener("click",function(a){e(!!h.checked)});else{if(h=q.querySelector("input"))h.addEventListener("blur",
-function(a){this.focus()}),n=void 0!==a.properties[b]?a.properties[b]:"",n=JSON.stringify(n),h.value=n,h.addEventListener("keydown",function(a){13==a.keyCode&&(g(),a.preventDefault(),a.stopPropagation())})}else{var h=q.querySelector("select");h.addEventListener("change",function(a){e(a.target.value)})}q.querySelector("button").addEventListener("click",g);return q}};h.prototype.createDialog=function(a,b){b=b||{};var d=document.createElement("div");d.className="graphdialog";d.innerHTML=a;var g=this.canvas.getBoundingClientRect(),
-e=-20,f=-20;g&&(e-=g.left,f-=g.top);b.position?(e+=b.position[0],f+=b.position[1]):b.event?(e+=b.event.clientX,f+=b.event.clientY):(e+=0.5*this.canvas.width,f+=0.5*this.canvas.height);d.style.left=e+"px";d.style.top=f+"px";this.canvas.parentNode.appendChild(d);d.close=function(){this.parentNode&&this.parentNode.removeChild(this)};return d};h.prototype.createPanel=function(a,b){b=b||{};var d=b.window||window,g=document.createElement("div");g.className="litegraph dialog";g.innerHTML="";
-g.header=g.querySelector(".dialog-header");b.width&&(g.style.width=b.width+(b.width.constructor===Number?"px":""));b.height&&(g.style.height=b.height+(b.height.constructor===Number?"px":""));if(b.closable){var e=document.createElement("span");e.innerHTML="✕";e.classList.add("close");e.addEventListener("click",function(){g.close()});g.header.appendChild(e)}g.title_element=g.querySelector(".dialog-title");g.title_element.innerText=a;g.content=g.querySelector(".dialog-content");g.footer=g.querySelector(".dialog-footer");
-g.close=function(){this.parentNode.removeChild(this)};g.clear=function(){this.content.innerHTML=""};g.addHTML=function(a,b,d){var e=document.createElement("div");b&&(e.className=b);e.innerHTML=a;d?g.footer.appendChild(e):g.content.appendChild(e);return e};g.addButton=function(a,b,d){var e=document.createElement("button");e.innerText=a;e.options=d;e.classList.add("btn");e.addEventListener("click",b);g.footer.appendChild(e);return e};g.addSeparator=function(){var a=document.createElement("div");a.className=
-"separator";g.content.appendChild(a)};g.addWidget=function(a,b,e,c,k){function n(a,b){console.log("change",a,b);c.callback&&c.callback(a,b);k&&k(a,b)}c=c||{};var q=String(e);a=a.toLowerCase();"number"==a&&(q=e.toFixed(3));var F=document.createElement("div");F.className="property";F.innerHTML="";F.querySelector(".property_name").innerText=b;var v=F.querySelector(".property_value");v.innerText=q;F.dataset.property=b;F.dataset.type=
-c.type||a;F.options=c;F.value=e;if("boolean"==a)F.classList.add("boolean"),e&&F.classList.add("bool-on"),F.addEventListener("click",function(){var a=this.dataset.property;this.value=!this.value;this.classList.toggle("bool-on");this.querySelector(".property_value").innerText=this.value?"true":"false";n(a,this.value)});else if("string"==a||"number"==a)v.setAttribute("contenteditable",!0),v.addEventListener("keydown",function(a){"Enter"==a.code&&(a.preventDefault(),this.blur())}),v.addEventListener("blur",
-function(){var a=this.innerText,b=this.parentNode.dataset.property;"number"==this.parentNode.dataset.type&&(a=Number(a));n(b,a)});else if("enum"==a||"combo"==a)q=h.getPropertyPrintableValue(e,c.values);v.innerText=q;v.addEventListener("click",function(a){var b=this.parentNode.dataset.property,e=this;new f.ContextMenu(c.values||[],{event:a,className:"dark",callback:function(a,d,g){e.innerText=a;n(b,a);return!1}},d)});g.content.appendChild(F);return F};return g};h.getPropertyPrintableValue=function(a,
-b){if(!b||b.constructor===Array)return String(a);if(b.constructor===Object){var d="",g;for(g in b)if(b[g]==a){d=g;break}return String(a)+" ("+d+")"}};h.prototype.showShowNodePanel=function(a){window.SELECTED_NODE=a;var b=document.querySelector("#node-panel");b&&b.close();var d=this.getCanvasWindow(),b=this.createPanel(a.title||"",{closable:!0,window:d});b.id="node-panel";b.node=a;b.classList.add("settings");var g=this;(function(){b.content.innerHTML="";b.addHTML(""+a.type+
-""+(a.constructor.desc||"")+"");b.addHTML("Properties
");for(var d in a.properties){var f=a.properties[d],c=a.getPropertyInfo(d);a.onAddPropertyToPanel&&a.onAddPropertyToPanel(d,b)||b.addWidget(c.widget||c.type,d,f,c,function(b,d){g.graph.beforeChange(a);a.setProperty(b,d);g.graph.afterChange();g.dirty_canvas=!0})}b.addSeparator();if(a.onShowCustomPanelInfo)a.onShowCustomPanelInfo(b);b.addButton("Delete",function(){a.block_delete||
-(a.graph.remove(a),b.close())}).classList.add("delete")})();this.canvas.parentNode.appendChild(b)};h.prototype.showSubgraphPropertiesDialog=function(a){function b(){g.clear();if(a.inputs)for(var d=0;d✕ ","subgraph_property");c.dataset.name=f.name;c.dataset.slot=d;c.querySelector(".name").innerText=f.name;c.querySelector(".type").innerText=
-f.type;c.querySelector("button").addEventListener("click",function(d){a.removeInput(Number(this.parentNode.dataset.slot));b()})}}}console.log("showing subgraph properties dialog");var d=this.canvas.parentNode.querySelector(".subgraph_dialog");d&&d.close();var g=this.createPanel("Subgraph Inputs",{closable:!0,width:500});g.node=a;g.classList.add("subgraph_dialog");g.addHTML(" + NameType",
-"subgraph_property extra",!0).querySelector("button").addEventListener("click",function(d){d=this.parentNode;var g=d.querySelector(".name").value,f=d.querySelector(".type").value;g&&-1==a.findInputSlot(g)&&(a.addInput(g,f),d.querySelector(".name").value="",d.querySelector(".type").value="",b())});b();this.canvas.parentNode.appendChild(g);return g};h.prototype.checkPanels=function(){if(this.canvas)for(var a=this.canvas.parentNode.querySelectorAll(".litegraph.dialog"),b=0;bNo color"});for(var c in h.node_colors)a=h.node_colors[c],a={value:c,content:""+c+""},b.push(a);new f.ContextMenu(b,{event:d,callback:function(a){e&&((a=a.value?h.node_colors[a.value]:null)?
-e.constructor===f.LGraphGroup?e.color=a.groupcolor:(e.color=a.color,e.bgcolor=a.bgcolor):(delete e.color,delete e.bgcolor),e.setDirtyCanvas(!0,!0))},parentMenu:g,node:e});return!1};h.onMenuNodeShapes=function(a,b,d,g,e){if(!e)throw"no node passed";new f.ContextMenu(f.VALID_SHAPES,{event:d,callback:function(a){e&&(e.graph.beforeChange(e),e.shape=a,e.graph.afterChange(e),e.setDirtyCanvas(!0))},parentMenu:g,node:e});return!1};h.onMenuNodeRemove=function(a,b,d,g,e){if(!e)throw"no node passed";!1!==e.removable&&
-(a=e.graph,a.beforeChange(),a.remove(e),a.afterChange(),e.setDirtyCanvas(!0,!0))};h.onMenuNodeToSubgraph=function(a,b,d,g,e){a=e.graph;if(b=h.active_canvas)d=Object.values(b.selected_nodes||{}),d.length||(d=[e]),g=f.createNode("graph/subgraph"),g.pos=e.pos.concat(),a.add(g),g.buildFromNodes(d),b.deselectAllNodes(),e.setDirtyCanvas(!0,!0)};h.onMenuNodeClone=function(a,b,d,g,e){!1!=e.clonable&&(a=e.clone())&&(a.pos=[e.pos[0]+5,e.pos[1]+5],e.graph.beforeChange(),e.graph.add(a),e.graph.afterChange(),
-e.setDirtyCanvas(!0,!0))};h.node_colors={red:{color:"#322",bgcolor:"#533",groupcolor:"#A88"},brown:{color:"#332922",bgcolor:"#593930",groupcolor:"#b06634"},green:{color:"#232",bgcolor:"#353",groupcolor:"#8A8"},blue:{color:"#223",bgcolor:"#335",groupcolor:"#88A"},pale_blue:{color:"#2a363b",bgcolor:"#3f5159",groupcolor:"#3f789e"},cyan:{color:"#233",bgcolor:"#355",groupcolor:"#8AA"},purple:{color:"#323",bgcolor:"#535",groupcolor:"#a1309b"},yellow:{color:"#432",bgcolor:"#653",groupcolor:"#b58b2a"},black:{color:"#222",
-bgcolor:"#000",groupcolor:"#444"}};h.prototype.getCanvasMenuOptions=function(){var a=null;this.getMenuOptions?a=this.getMenuOptions():(a=[{content:"Add Node",has_submenu:!0,callback:h.onMenuAdd},{content:"Add Group",callback:h.onGroupAdd}],this._graph_stack&&0Name",
-e),k=c.querySelector("input");k&&f&&(k.value=f.label||"");c.querySelector("button").addEventListener("click",function(a){k.value&&(f&&(f.label=k.value),d.setDirty(!0));c.close()})}},extra:a};a&&(c.title=a.type);var k=null;a&&(k=a.getSlotInPosition(b.canvasX,b.canvasY),h.active_node=a);if(k){e=[];if(a.getSlotMenuOptions)e=a.getSlotMenuOptions(k);else{k&&k.output&&k.output.links&&k.output.links.length&&e.push({content:"Disconnect Links",slot:k});var s=k.input||k.output;e.push(s.locked?"Cannot remove":
-{content:"Remove Slot",slot:k});e.push(s.nameLocked?"Cannot rename":{content:"Rename Slot",slot:k})}c.title=(k.input?k.input.type:k.output.type)||"*";k.input&&k.input.type==f.ACTION&&(c.title="Action");k.output&&k.output.type==f.EVENT&&(c.title="Event")}else a?e=this.getNodeMenuOptions(a):(e=this.getCanvasMenuOptions(),(k=this.graph.getGroupOnPos(b.canvasX,b.canvasY))&&e.push(null,{content:"Edit Group",has_submenu:!0,submenu:{title:"Group",extra:k,options:this.getGroupMenuOptions(k)}}));e&&new f.ContextMenu(e,
-c,g)};"undefined"!=typeof window&&window.CanvasRenderingContext2D&&(window.CanvasRenderingContext2D.prototype.roundRect=function(a,b,d,g,e,f){void 0===e&&(e=5);void 0===f&&(f=e);this.moveTo(a+e,b);this.lineTo(a+d-e,b);this.quadraticCurveTo(a+d,b,a+d,b+e);this.lineTo(a+d,b+g-f);this.quadraticCurveTo(a+d,b+g,a+d-f,b+g);this.lineTo(a+f,b+g);this.quadraticCurveTo(a,b+g,a,b+g-f);this.lineTo(a,b+e);this.quadraticCurveTo(a,b,a+e,b)});f.compareObjects=function(a,b){for(var d in a)if(a[d]!=b[d])return!1;return!0};
-f.distance=C;f.colorToString=function(a){return"rgba("+Math.round(255*a[0]).toFixed()+","+Math.round(255*a[1]).toFixed()+","+Math.round(255*a[2]).toFixed()+","+(4==a.length?a[3].toFixed(2):"1.0")+")"};f.isInsideRectangle=x;f.growBounding=function(a,b,d){ba[2]&&(a[2]=b);da[3]&&(a[3]=d)};f.isInsideBounding=function(a,b){return a[0]b[1][0]||a[1]>b[1][1]?!1:!0};f.overlapBounding=G;f.hex2num=function(a){"#"==a.charAt(0)&&(a=a.slice(1));a=a.toUpperCase();
-for(var b=Array(3),d=0,g,e,f=0;6>f;f+=2)g="0123456789ABCDEF".indexOf(a.charAt(f)),e="0123456789ABCDEF".indexOf(a.charAt(f+1)),b[d]=16*g+e,d++;return b};f.num2hex=function(a){for(var b="#",d,g,e=0;3>e;e++)d=a[e]/16,g=a[e]%16,b+="0123456789ABCDEF".charAt(d)+"0123456789ABCDEF".charAt(g);return b};A.prototype.addItem=function(a,b,d){function g(a){var b=this.value;b&&b.has_submenu&&e.call(this,a)}function e(a){var b=this.value,e=!0;f.current_submenu&&f.current_submenu.close(a);if(d.callback){var g=d.callback.call(this,
-b,d,a,f,d.node);!0===g&&(e=!1)}if(b&&(b.callback&&!d.ignore_item_callbacks&&!0!==b.disabled&&(g=b.callback.call(this,b,d,a,f,d.extra),!0===g&&(e=!1)),b.submenu)){if(!b.submenu.options)throw"ContextMenu submenu needs options";new f.constructor(b.submenu.options,{callback:b.submenu.callback,event:a,parentMenu:f,ignore_item_callbacks:b.submenu.ignore_item_callbacks,title:b.submenu.title,extra:b.submenu.extra,autoopen:d.autoopen});e=!1}e&&!f.lock&&f.close()}var f=this;d=d||{};var c=document.createElement("div");
-c.className="litemenu-entry submenu";var k=!1;if(null===b)c.classList.add("separator");else{c.innerHTML=b&&b.title?b.title:a;if(c.value=b)b.disabled&&(k=!0,c.classList.add("disabled")),(b.submenu||b.has_submenu)&&c.classList.add("has_submenu");"function"==typeof b?(c.dataset.value=a,c.onclick_callback=b):c.dataset.value=b;b.className&&(c.className+=" "+b.className)}this.root.appendChild(c);k||c.addEventListener("click",e);d.autoopen&&c.addEventListener("mouseenter",g);return c};A.prototype.close=
-function(a,b){this.root.parentNode&&this.root.parentNode.removeChild(this.root);this.parentMenu&&!b&&(this.parentMenu.lock=!1,this.parentMenu.current_submenu=null,void 0===a?this.parentMenu.close():a&&!A.isCursorOverElement(a,this.parentMenu.root)&&A.trigger(this.parentMenu.root,"mouseleave",a));this.current_submenu&&this.current_submenu.close(a,!0);this.root.closing_timer&&clearTimeout(this.root.closing_timer)};A.trigger=function(a,b,d,g){var e=document.createEvent("CustomEvent");e.initCustomEvent(b,
-!0,!0,d);e.srcElement=g;a.dispatchEvent?a.dispatchEvent(e):a.__events&&a.__events.dispatchEvent(e);return e};A.prototype.getTopMenu=function(){return this.options.parentMenu?this.options.parentMenu.getTopMenu():this};A.prototype.getFirstEvent=function(){return this.options.parentMenu?this.options.parentMenu.getFirstEvent():this.options.event};A.isCursorOverElement=function(a,b){var d=a.clientX,g=a.clientY,e=b.getBoundingClientRect();return e?g>e.top&&ge.left&&dMath.abs(d))return g[1];d=(a-g[0])/d;return g[1]*(1-d)+e[1]*d}}return 0}};D.prototype.draw=function(a,b,d,g,e,f){if(d=this.points){this.size=b;var c=b[0]-2*this.margin;b=b[1]-2*this.margin;e=e||"#666";a.save();a.translate(this.margin,
-this.margin);g&&(a.fillStyle="#111",a.fillRect(0,0,c,b),a.fillStyle="#222",a.fillRect(0.5*c,0,1,b),a.strokeStyle="#333",a.strokeRect(0,0,c,b));a.strokeStyle=e;f&&(a.globalAlpha=0.5);a.beginPath();for(g=0;ga[1])){var g=this.size[0]-2*this.margin,e=this.size[1]-2*this.margin,f=a[0]-this.margin,c=a[1]-this.margin;this.selected=this.getCloserPoint([f,c],30/b.ds.scale);-1==this.selected&&(g=[f/g,1-c/e],d.push(g),d.sort(function(a,b){return a[0]-b[0]}),this.selected=d.indexOf(g),this.must_update=!0);if(-1!=this.selected)return!0}};D.prototype.onMouseMove=function(a,b){var d=this.points;if(d){var g=this.selected;if(!(0>g)){var e=(a[0]-this.margin)/(this.size[0]-2*this.margin),f=(a[1]-
-this.margin)/(this.size[1]-2*this.margin);this._nearest=this.getCloserPoint([a[0]-this.margin,a[1]-this.margin],30/b.ds.scale);var c=d[g];if(c){var k=0==g||g==d.length-1;!k&&(-10>a[0]||a[0]>this.size[0]+10||-10>a[1]||a[1]>this.size[1]+10)?(d.splice(g,1),this.selected=-1):(c[0]=k?0==g?0:1:Math.clamp(e,0,1),c[1]=1-Math.clamp(f,0,1),d.sort(function(a,b){return a[0]-b[0]}),this.selected=d.indexOf(c),this.must_update=!0)}}}};D.prototype.onMouseUp=function(a,b){this.selected=-1;return!1};D.prototype.getCloserPoint=
-function(a,b){var d=this.points;if(!d)return-1;b=b||30;for(var g=this.size[0]-2*this.margin,e=this.size[1]-2*this.margin,f=d.length,c=[0,0],k=1E6,n=-1,q=0;qk||h>b||(n=q,k=h)}return n};f.CurveEditor=D;f.getParameterNames=function(a){return(a+"").replace(/[/][/].*$/gm,"").replace(/\s+/g,"").replace(/[/][*][^/*]*[*][/]/g,"").split("){",1)[0].replace(/^[^(]*[(]/,"").replace(/=[^,]+/g,"").split(",").filter(Boolean)};Math.clamp=function(a,
-b,d){return b>a?b:d"+f.values[k]+""}s+=""}var q=this.createDialog(""+(f.label?f.label:b)+""+s+"",d);if("enum"!=c&&"combo"!=c||!f.values)if("boolean"==c)(h=q.querySelector("input"))&&h.addEventListener("click",function(a){e(!!h.checked)});else{if(h=q.querySelector("input"))h.addEventListener("blur",
+function(a){this.focus()}),n=void 0!==a.properties[b]?a.properties[b]:"","string"!==c&&(n=JSON.stringify(n)),h.value=n,h.addEventListener("keydown",function(a){13==a.keyCode&&(g(),a.preventDefault(),a.stopPropagation())})}else{var h=q.querySelector("select");h.addEventListener("change",function(a){e(a.target.value)})}q.querySelector("button").addEventListener("click",g);return q}};h.prototype.createDialog=function(a,b){b=b||{};var d=document.createElement("div");d.className="graphdialog";d.innerHTML=
+a;var g=this.canvas.getBoundingClientRect(),e=-20,f=-20;g&&(e-=g.left,f-=g.top);b.position?(e+=b.position[0],f+=b.position[1]):b.event?(e+=b.event.clientX,f+=b.event.clientY):(e+=0.5*this.canvas.width,f+=0.5*this.canvas.height);d.style.left=e+"px";d.style.top=f+"px";this.canvas.parentNode.appendChild(d);d.close=function(){this.parentNode&&this.parentNode.removeChild(this)};return d};h.prototype.createPanel=function(a,b){b=b||{};var d=b.window||window,g=document.createElement("div");g.className="litegraph dialog";
+g.innerHTML="";g.header=g.querySelector(".dialog-header");b.width&&(g.style.width=b.width+(b.width.constructor===Number?"px":""));b.height&&(g.style.height=b.height+(b.height.constructor===Number?"px":""));if(b.closable){var e=document.createElement("span");e.innerHTML="✕";e.classList.add("close");e.addEventListener("click",function(){g.close()});g.header.appendChild(e)}g.title_element=
+g.querySelector(".dialog-title");g.title_element.innerText=a;g.content=g.querySelector(".dialog-content");g.footer=g.querySelector(".dialog-footer");g.close=function(){this.parentNode.removeChild(this)};g.clear=function(){this.content.innerHTML=""};g.addHTML=function(a,b,d){var e=document.createElement("div");b&&(e.className=b);e.innerHTML=a;d?g.footer.appendChild(e):g.content.appendChild(e);return e};g.addButton=function(a,b,d){var e=document.createElement("button");e.innerText=a;e.options=d;e.classList.add("btn");
+e.addEventListener("click",b);g.footer.appendChild(e);return e};g.addSeparator=function(){var a=document.createElement("div");a.className="separator";g.content.appendChild(a)};g.addWidget=function(a,b,e,c,k){function n(a,b){console.log("change",a,b);c.callback&&c.callback(a,b);k&&k(a,b)}c=c||{};var q=String(e);a=a.toLowerCase();"number"==a&&(q=e.toFixed(3));var F=document.createElement("div");F.className="property";F.innerHTML="";
+F.querySelector(".property_name").innerText=b;var v=F.querySelector(".property_value");v.innerText=q;F.dataset.property=b;F.dataset.type=c.type||a;F.options=c;F.value=e;if("boolean"==a)F.classList.add("boolean"),e&&F.classList.add("bool-on"),F.addEventListener("click",function(){var a=this.dataset.property;this.value=!this.value;this.classList.toggle("bool-on");this.querySelector(".property_value").innerText=this.value?"true":"false";n(a,this.value)});else if("string"==a||"number"==a)v.setAttribute("contenteditable",
+!0),v.addEventListener("keydown",function(a){"Enter"==a.code&&(a.preventDefault(),this.blur())}),v.addEventListener("blur",function(){var a=this.innerText,b=this.parentNode.dataset.property;"number"==this.parentNode.dataset.type&&(a=Number(a));n(b,a)});else if("enum"==a||"combo"==a)q=h.getPropertyPrintableValue(e,c.values);v.innerText=q;v.addEventListener("click",function(a){var b=this.parentNode.dataset.property,e=this;new f.ContextMenu(c.values||[],{event:a,className:"dark",callback:function(a,
+d,g){e.innerText=a;n(b,a);return!1}},d)});g.content.appendChild(F);return F};return g};h.getPropertyPrintableValue=function(a,b){if(!b||b.constructor===Array)return String(a);if(b.constructor===Object){var d="",g;for(g in b)if(b[g]==a){d=g;break}return String(a)+" ("+d+")"}};h.prototype.showShowNodePanel=function(a){window.SELECTED_NODE=a;var b=document.querySelector("#node-panel");b&&b.close();var d=this.getCanvasWindow(),b=this.createPanel(a.title||"",{closable:!0,window:d});b.id="node-panel";b.node=
+a;b.classList.add("settings");var g=this;(function(){b.content.innerHTML="";b.addHTML(""+a.type+""+(a.constructor.desc||"")+"");b.addHTML("Properties
");for(var d in a.properties){var f=a.properties[d],c=a.getPropertyInfo(d);a.onAddPropertyToPanel&&a.onAddPropertyToPanel(d,b)||b.addWidget(c.widget||c.type,d,f,c,function(b,d){g.graph.beforeChange(a);a.setProperty(b,d);g.graph.afterChange();g.dirty_canvas=
+!0})}b.addSeparator();if(a.onShowCustomPanelInfo)a.onShowCustomPanelInfo(b);b.addButton("Delete",function(){a.block_delete||(a.graph.remove(a),b.close())}).classList.add("delete")})();this.canvas.parentNode.appendChild(b)};h.prototype.showSubgraphPropertiesDialog=function(a){function b(){g.clear();if(a.inputs)for(var d=0;d✕ ",
+"subgraph_property");c.dataset.name=f.name;c.dataset.slot=d;c.querySelector(".name").innerText=f.name;c.querySelector(".type").innerText=f.type;c.querySelector("button").addEventListener("click",function(d){a.removeInput(Number(this.parentNode.dataset.slot));b()})}}}console.log("showing subgraph properties dialog");var d=this.canvas.parentNode.querySelector(".subgraph_dialog");d&&d.close();var g=this.createPanel("Subgraph Inputs",{closable:!0,width:500});g.node=a;g.classList.add("subgraph_dialog");
+g.addHTML(" + NameType","subgraph_property extra",!0).querySelector("button").addEventListener("click",function(d){d=this.parentNode;var g=d.querySelector(".name").value,f=d.querySelector(".type").value;g&&-1==a.findInputSlot(g)&&(a.addInput(g,f),d.querySelector(".name").value="",d.querySelector(".type").value="",b())});b();this.canvas.parentNode.appendChild(g);return g};h.prototype.checkPanels=
+function(){if(this.canvas)for(var a=this.canvas.parentNode.querySelectorAll(".litegraph.dialog"),b=0;bNo color"});for(var c in h.node_colors)a=h.node_colors[c],a={value:c,content:""+c+""},b.push(a);new f.ContextMenu(b,{event:d,callback:function(a){e&&((a=a.value?h.node_colors[a.value]:null)?e.constructor===f.LGraphGroup?e.color=a.groupcolor:(e.color=a.color,e.bgcolor=a.bgcolor):(delete e.color,delete e.bgcolor),e.setDirtyCanvas(!0,!0))},parentMenu:g,node:e});return!1};h.onMenuNodeShapes=function(a,b,d,g,e){if(!e)throw"no node passed";new f.ContextMenu(f.VALID_SHAPES,{event:d,callback:function(a){e&&(e.graph.beforeChange(e),e.shape=a,e.graph.afterChange(e),e.setDirtyCanvas(!0))},
+parentMenu:g,node:e});return!1};h.onMenuNodeRemove=function(a,b,d,g,e){if(!e)throw"no node passed";!1!==e.removable&&(a=e.graph,a.beforeChange(),a.remove(e),a.afterChange(),e.setDirtyCanvas(!0,!0))};h.onMenuNodeToSubgraph=function(a,b,d,g,e){a=e.graph;if(b=h.active_canvas)d=Object.values(b.selected_nodes||{}),d.length||(d=[e]),g=f.createNode("graph/subgraph"),g.pos=e.pos.concat(),a.add(g),g.buildFromNodes(d),b.deselectAllNodes(),e.setDirtyCanvas(!0,!0)};h.onMenuNodeClone=function(a,b,d,g,e){!1!=e.clonable&&
+(a=e.clone())&&(a.pos=[e.pos[0]+5,e.pos[1]+5],e.graph.beforeChange(),e.graph.add(a),e.graph.afterChange(),e.setDirtyCanvas(!0,!0))};h.node_colors={red:{color:"#322",bgcolor:"#533",groupcolor:"#A88"},brown:{color:"#332922",bgcolor:"#593930",groupcolor:"#b06634"},green:{color:"#232",bgcolor:"#353",groupcolor:"#8A8"},blue:{color:"#223",bgcolor:"#335",groupcolor:"#88A"},pale_blue:{color:"#2a363b",bgcolor:"#3f5159",groupcolor:"#3f789e"},cyan:{color:"#233",bgcolor:"#355",groupcolor:"#8AA"},purple:{color:"#323",
+bgcolor:"#535",groupcolor:"#a1309b"},yellow:{color:"#432",bgcolor:"#653",groupcolor:"#b58b2a"},black:{color:"#222",bgcolor:"#000",groupcolor:"#444"}};h.prototype.getCanvasMenuOptions=function(){var a=null;this.getMenuOptions?a=this.getMenuOptions():(a=[{content:"Add Node",has_submenu:!0,callback:h.onMenuAdd},{content:"Add Group",callback:h.onGroupAdd}],this._graph_stack&&0Name",e),k=c.querySelector("input");k&&f&&(k.value=f.label||"");c.querySelector("button").addEventListener("click",function(a){k.value&&(f&&(f.label=k.value),d.setDirty(!0));c.close()})}},extra:a};a&&(c.title=a.type);var k=null;a&&(k=a.getSlotInPosition(b.canvasX,b.canvasY),h.active_node=a);if(k){e=[];if(a.getSlotMenuOptions)e=a.getSlotMenuOptions(k);else{k&&k.output&&k.output.links&&k.output.links.length&&
+e.push({content:"Disconnect Links",slot:k});var s=k.input||k.output;e.push(s.locked?"Cannot remove":{content:"Remove Slot",slot:k});e.push(s.nameLocked?"Cannot rename":{content:"Rename Slot",slot:k})}c.title=(k.input?k.input.type:k.output.type)||"*";k.input&&k.input.type==f.ACTION&&(c.title="Action");k.output&&k.output.type==f.EVENT&&(c.title="Event")}else a?e=this.getNodeMenuOptions(a):(e=this.getCanvasMenuOptions(),(k=this.graph.getGroupOnPos(b.canvasX,b.canvasY))&&e.push(null,{content:"Edit Group",
+has_submenu:!0,submenu:{title:"Group",extra:k,options:this.getGroupMenuOptions(k)}}));e&&new f.ContextMenu(e,c,g)};"undefined"!=typeof window&&window.CanvasRenderingContext2D&&(window.CanvasRenderingContext2D.prototype.roundRect=function(a,b,d,g,e,f){void 0===e&&(e=5);void 0===f&&(f=e);this.moveTo(a+e,b);this.lineTo(a+d-e,b);this.quadraticCurveTo(a+d,b,a+d,b+e);this.lineTo(a+d,b+g-f);this.quadraticCurveTo(a+d,b+g,a+d-f,b+g);this.lineTo(a+f,b+g);this.quadraticCurveTo(a,b+g,a,b+g-f);this.lineTo(a,b+
+e);this.quadraticCurveTo(a,b,a+e,b)});f.compareObjects=function(a,b){for(var d in a)if(a[d]!=b[d])return!1;return!0};f.distance=C;f.colorToString=function(a){return"rgba("+Math.round(255*a[0]).toFixed()+","+Math.round(255*a[1]).toFixed()+","+Math.round(255*a[2]).toFixed()+","+(4==a.length?a[3].toFixed(2):"1.0")+")"};f.isInsideRectangle=x;f.growBounding=function(a,b,d){ba[2]&&(a[2]=b);da[3]&&(a[3]=d)};f.isInsideBounding=function(a,b){return a[0]b[1][0]||a[1]>b[1][1]?!1:!0};f.overlapBounding=G;f.hex2num=function(a){"#"==a.charAt(0)&&(a=a.slice(1));a=a.toUpperCase();for(var b=Array(3),d=0,g,e,f=0;6>f;f+=2)g="0123456789ABCDEF".indexOf(a.charAt(f)),e="0123456789ABCDEF".indexOf(a.charAt(f+1)),b[d]=16*g+e,d++;return b};f.num2hex=function(a){for(var b="#",d,g,e=0;3>e;e++)d=a[e]/16,g=a[e]%16,b+="0123456789ABCDEF".charAt(d)+"0123456789ABCDEF".charAt(g);return b};A.prototype.addItem=function(a,b,d){function g(a){var b=this.value;b&&b.has_submenu&&
+e.call(this,a)}function e(a){var b=this.value,e=!0;f.current_submenu&&f.current_submenu.close(a);if(d.callback){var g=d.callback.call(this,b,d,a,f,d.node);!0===g&&(e=!1)}if(b&&(b.callback&&!d.ignore_item_callbacks&&!0!==b.disabled&&(g=b.callback.call(this,b,d,a,f,d.extra),!0===g&&(e=!1)),b.submenu)){if(!b.submenu.options)throw"ContextMenu submenu needs options";new f.constructor(b.submenu.options,{callback:b.submenu.callback,event:a,parentMenu:f,ignore_item_callbacks:b.submenu.ignore_item_callbacks,
+title:b.submenu.title,extra:b.submenu.extra,autoopen:d.autoopen});e=!1}e&&!f.lock&&f.close()}var f=this;d=d||{};var c=document.createElement("div");c.className="litemenu-entry submenu";var k=!1;if(null===b)c.classList.add("separator");else{c.innerHTML=b&&b.title?b.title:a;if(c.value=b)b.disabled&&(k=!0,c.classList.add("disabled")),(b.submenu||b.has_submenu)&&c.classList.add("has_submenu");"function"==typeof b?(c.dataset.value=a,c.onclick_callback=b):c.dataset.value=b;b.className&&(c.className+=" "+
+b.className)}this.root.appendChild(c);k||c.addEventListener("click",e);d.autoopen&&c.addEventListener("mouseenter",g);return c};A.prototype.close=function(a,b){this.root.parentNode&&this.root.parentNode.removeChild(this.root);this.parentMenu&&!b&&(this.parentMenu.lock=!1,this.parentMenu.current_submenu=null,void 0===a?this.parentMenu.close():a&&!A.isCursorOverElement(a,this.parentMenu.root)&&A.trigger(this.parentMenu.root,"mouseleave",a));this.current_submenu&&this.current_submenu.close(a,!0);this.root.closing_timer&&
+clearTimeout(this.root.closing_timer)};A.trigger=function(a,b,d,g){var e=document.createEvent("CustomEvent");e.initCustomEvent(b,!0,!0,d);e.srcElement=g;a.dispatchEvent?a.dispatchEvent(e):a.__events&&a.__events.dispatchEvent(e);return e};A.prototype.getTopMenu=function(){return this.options.parentMenu?this.options.parentMenu.getTopMenu():this};A.prototype.getFirstEvent=function(){return this.options.parentMenu?this.options.parentMenu.getFirstEvent():this.options.event};A.isCursorOverElement=function(a,
+b){var d=a.clientX,g=a.clientY,e=b.getBoundingClientRect();return e?g>e.top&&ge.left&&dMath.abs(d))return g[1];d=(a-g[0])/d;return g[1]*(1-d)+e[1]*d}}return 0}};D.prototype.draw=function(a,b,d,g,e,f){if(d=this.points){this.size=
+b;var c=b[0]-2*this.margin;b=b[1]-2*this.margin;e=e||"#666";a.save();a.translate(this.margin,this.margin);g&&(a.fillStyle="#111",a.fillRect(0,0,c,b),a.fillStyle="#222",a.fillRect(0.5*c,0,1,b),a.strokeStyle="#333",a.strokeRect(0,0,c,b));a.strokeStyle=e;f&&(a.globalAlpha=0.5);a.beginPath();for(g=0;ga[1])){var g=this.size[0]-2*this.margin,e=this.size[1]-2*this.margin,f=a[0]-this.margin,c=a[1]-this.margin;this.selected=this.getCloserPoint([f,c],30/b.ds.scale);-1==this.selected&&(g=[f/g,1-c/e],d.push(g),d.sort(function(a,b){return a[0]-b[0]}),this.selected=d.indexOf(g),this.must_update=!0);if(-1!=this.selected)return!0}};D.prototype.onMouseMove=function(a,b){var d=this.points;if(d){var g=
+this.selected;if(!(0>g)){var e=(a[0]-this.margin)/(this.size[0]-2*this.margin),f=(a[1]-this.margin)/(this.size[1]-2*this.margin);this._nearest=this.getCloserPoint([a[0]-this.margin,a[1]-this.margin],30/b.ds.scale);var c=d[g];if(c){var k=0==g||g==d.length-1;!k&&(-10>a[0]||a[0]>this.size[0]+10||-10>a[1]||a[1]>this.size[1]+10)?(d.splice(g,1),this.selected=-1):(c[0]=k?0==g?0:1:Math.clamp(e,0,1),c[1]=1-Math.clamp(f,0,1),d.sort(function(a,b){return a[0]-b[0]}),this.selected=d.indexOf(c),this.must_update=
+!0)}}}};D.prototype.onMouseUp=function(a,b){this.selected=-1;return!1};D.prototype.getCloserPoint=function(a,b){var d=this.points;if(!d)return-1;b=b||30;for(var g=this.size[0]-2*this.margin,e=this.size[1]-2*this.margin,f=d.length,c=[0,0],k=1E6,n=-1,q=0;qk||h>b||(n=q,k=h)}return n};f.CurveEditor=D;f.getParameterNames=function(a){return(a+"").replace(/[/][/].*$/gm,"").replace(/\s+/g,"").replace(/[/][*][^/*]*[*][/]/g,"").split("){",
+1)[0].replace(/^[^(]*[(]/,"").replace(/=[^,]+/g,"").split(",").filter(Boolean)};Math.clamp=function(a,b,d){return b>a?b:d 'A useful description',
+});
+```
diff --git a/src/litegraph.js b/src/litegraph.js
index eb2aeb442..4404dbc36 100755
--- a/src/litegraph.js
+++ b/src/litegraph.js
@@ -24,6 +24,7 @@
NODE_COLLAPSED_RADIUS: 10,
NODE_COLLAPSED_WIDTH: 80,
NODE_TITLE_COLOR: "#999",
+ NODE_SELECTED_TITLE_COLOR: "#FFF",
NODE_TEXT_SIZE: 14,
NODE_TEXT_COLOR: "#AAA",
NODE_SUBTEXT_SIZE: 12,
@@ -31,13 +32,14 @@
NODE_DEFAULT_BGCOLOR: "#353535",
NODE_DEFAULT_BOXCOLOR: "#666",
NODE_DEFAULT_SHAPE: "box",
+ NODE_BOX_OUTLINE_COLOR: "#FFF",
DEFAULT_SHADOW_COLOR: "rgba(0,0,0,0.5)",
DEFAULT_GROUP_FONT: 24,
- WIDGET_BGCOLOR: "#222",
- WIDGET_OUTLINE_COLOR: "#666",
- WIDGET_TEXT_COLOR: "#DDD",
- WIDGET_SECONDARY_TEXT_COLOR: "#999",
+ WIDGET_BGCOLOR: "#222",
+ WIDGET_OUTLINE_COLOR: "#666",
+ WIDGET_TEXT_COLOR: "#DDD",
+ WIDGET_SECONDARY_TEXT_COLOR: "#999",
LINK_COLOR: "#9A9",
EVENT_LINK_COLOR: "#A86",
@@ -94,6 +96,7 @@
Globals: {}, //used to store vars between graphs
searchbox_extras: {}, //used to add extra features to the search box
+ auto_sort_node_types: false, // If set to true, will automatically sort node types / categories in the context menus
/**
* Register a node class so it can be listed when the user wants to create a new one
@@ -414,7 +417,7 @@
}
}
- return r;
+ return this.auto_sort_node_types ? r.sort() : r;
},
/**
@@ -438,7 +441,7 @@
for (var i in categories) {
result.push(i);
}
- return result;
+ return this.auto_sort_node_types ? result.sort() : result;
},
//debug purposes: reloads all the js scripts that matches a wildcard
@@ -7964,7 +7967,7 @@ LGraphNode.prototype.executeAction = function(action)
var title = String(node.getTitle());
if (title) {
if (selected) {
- ctx.fillStyle = "white";
+ ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR;
} else {
ctx.fillStyle =
node.constructor.title_text_color ||
@@ -8067,7 +8070,7 @@ LGraphNode.prototype.executeAction = function(action)
Math.PI * 2
);
}
- ctx.strokeStyle = "#FFF";
+ ctx.strokeStyle = LiteGraph.NODE_BOX_OUTLINE_COLOR;
ctx.stroke();
ctx.strokeStyle = fgcolor;
ctx.globalAlpha = 1;
@@ -9450,7 +9453,7 @@ LGraphNode.prototype.executeAction = function(action)
entries.push({
content:
"" +
- i +
+ (info.label ? info.label : i) +
"" +
"" +
value +
@@ -10048,7 +10051,7 @@ LGraphNode.prototype.executeAction = function(action)
var dialog = this.createDialog(
"" +
- property +
+ (info.label ? info.label : property) +
"" +
input_html +
"",
@@ -10075,8 +10078,12 @@ LGraphNode.prototype.executeAction = function(action)
input.addEventListener("blur", function(e) {
this.focus();
});
+
var v = node.properties[property] !== undefined ? node.properties[property] : "";
- v = JSON.stringify(v);
+ if (type !== 'string') {
+ v = JSON.stringify(v);
+ }
+
input.value = v;
input.addEventListener("keydown", function(e) {
if (e.keyCode != 13) {