diff --git a/build/litegraph.js b/build/litegraph.js index 39b050c1e..88bc46de2 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -96,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 @@ -416,7 +417,7 @@ } } - return r; + return this.auto_sort_node_types ? r.sort() : r; }, /** @@ -440,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 diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 4055527ed..e85da2710 100644 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -288,7 +288,7 @@ $jscomp.polyfill("Object.values", function(x) { } var f = x.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:1000, 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) { + 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"; } @@ -423,7 +423,7 @@ $jscomp.polyfill("Object.values", function(x) { var g = this.registered_node_types[e]; g.filter == b && ("" == a ? null == g.category && d.push(g) : g.category == a && d.push(g)); } - return d; + return this.auto_sort_node_types ? d.sort() : d; }, getNodeTypesCategories:function(a) { var b = {"":1}, d; for (d in this.registered_node_types) { @@ -434,7 +434,7 @@ $jscomp.polyfill("Object.values", function(x) { for (d in b) { a.push(d); } - return a; + return this.auto_sort_node_types ? a.sort() : a; }, reloadNodes:function(a) { for (var b = document.getElementsByTagName("script"), d = [], e = 0; e < b.length; e++) { d.push(b[e]);