From 4fe32687d29fc224d4e16853b40657a477ec539e Mon Sep 17 00:00:00 2001 From: altarfinch Date: Fri, 8 May 2020 01:40:15 +0200 Subject: [PATCH] fixed mouse function for custom widget : take custom height into account --- build/litegraph.js | 10 +- build/litegraph.min.js | 1855 ++++++++++++++++++++-------------------- src/litegraph.d.ts | 5 +- src/litegraph.js | 10 +- 4 files changed, 941 insertions(+), 939 deletions(-) diff --git a/build/litegraph.js b/build/litegraph.js index a99693f42..8659453b5 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -20511,7 +20511,6 @@ LGraphNode.prototype.executeAction = function(action) var margin = 15; for (var i = 0; i < widgets.length; ++i) { - var h = H; var w = widgets[i]; var y = posY; if (w.y) { @@ -20682,11 +20681,11 @@ LGraphNode.prototype.executeAction = function(action) break; default: if (w.draw) { - h = w.draw(ctx, node, width, y, H) || H; + w.draw(ctx, node, width, y, H); } break; } - posY += h + 4; + posY += (w.computeSize ? w.computeSize(width)[1] : H) + 4; ctx.globalAlpha = this.editor_alpha; } @@ -20718,7 +20717,8 @@ LGraphNode.prototype.executeAction = function(action) var w = node.widgets[i]; if(!w || w.disabled) continue; - if ( w == active_widget || (x > 6 && x < width - 12 && y > w.last_y && y < w.last_y + LiteGraph.NODE_WIDGET_HEIGHT) ) { + var widget_height = w.computeSize ? w.computeSize(width)[1] : LiteGraph.NODE_WIDGET_HEIGHT; + if ( w == active_widget || (x > 6 && x < width - 12 && y > w.last_y && y < w.last_y + widget_height) ) { //inside widget switch (w.type) { case "button": @@ -20852,7 +20852,7 @@ LGraphNode.prototype.executeAction = function(action) break; default: if (w.mouse) { - w.mouse(ctx, event, [x, y], node); + this.dirty_canvas = w.mouse(event, [x, y], node); } break; } //end switch diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 7a0258a22..4f672d6da 100755 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -723,39 +723,39 @@ $jscomp.scope = {}; $jscomp.ASSUME_ES5 = !1; $jscomp.ASSUME_NO_NATIVE_MAP = !1; $jscomp.ASSUME_NO_NATIVE_SET = !1; -$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(w, c, p) { - w != Array.prototype && w != Object.prototype && (w[c] = p.value); +$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(v, c, q) { + v != Array.prototype && v != Object.prototype && (v[c] = q.value); }; -$jscomp.getGlobal = function(w) { - return "undefined" != typeof window && window === w ? w : "undefined" != typeof global && null != global ? global : w; +$jscomp.getGlobal = function(v) { + return "undefined" != typeof window && window === v ? v : "undefined" != typeof global && null != global ? global : v; }; $jscomp.global = $jscomp.getGlobal(this); -$jscomp.polyfill = function(w, c, p, m) { +$jscomp.polyfill = function(v, c, q, m) { if (c) { - p = $jscomp.global; - w = w.split("."); - for (m = 0; m < w.length - 1; m++) { - var g = w[m]; - g in p || (p[g] = {}); - p = p[g]; + q = $jscomp.global; + v = v.split("."); + for (m = 0; m < v.length - 1; m++) { + var g = v[m]; + g in q || (q[g] = {}); + q = q[g]; } - w = w[w.length - 1]; - m = p[w]; + v = v[v.length - 1]; + m = q[v]; c = c(m); - c != m && null != c && $jscomp.defineProperty(p, w, {configurable:!0, writable:!0, value:c}); + c != m && null != c && $jscomp.defineProperty(q, v, {configurable:!0, writable:!0, value:c}); } }; -$jscomp.polyfill("Array.prototype.fill", function(w) { - return w ? w : function(c, p, m) { +$jscomp.polyfill("Array.prototype.fill", function(v) { + return v ? v : function(c, q, m) { var g = this.length || 0; - 0 > p && (p = Math.max(0, g + p)); + 0 > q && (q = Math.max(0, g + q)); if (null == m || m > g) { m = g; } m = Number(m); 0 > m && (m = Math.max(0, g + m)); - for (p = Number(p || 0); p < m; p++) { - this[p] = c; + for (q = Number(q || 0); q < m; q++) { + this[q] = c; } return this; }; @@ -767,42 +767,42 @@ $jscomp.initSymbol = function() { $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); }; $jscomp.Symbol = function() { - var w = 0; + var v = 0; return function(c) { - return $jscomp.SYMBOL_PREFIX + (c || "") + w++; + return $jscomp.SYMBOL_PREFIX + (c || "") + v++; }; }(); $jscomp.initSymbolIterator = function() { $jscomp.initSymbol(); - var w = $jscomp.global.Symbol.iterator; - w || (w = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")); - "function" != typeof Array.prototype[w] && $jscomp.defineProperty(Array.prototype, w, {configurable:!0, writable:!0, value:function() { + var v = $jscomp.global.Symbol.iterator; + v || (v = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")); + "function" != typeof Array.prototype[v] && $jscomp.defineProperty(Array.prototype, v, {configurable:!0, writable:!0, value:function() { return $jscomp.arrayIterator(this); }}); $jscomp.initSymbolIterator = function() { }; }; -$jscomp.arrayIterator = function(w) { +$jscomp.arrayIterator = function(v) { var c = 0; return $jscomp.iteratorPrototype(function() { - return c < w.length ? {done:!1, value:w[c++]} : {done:!0}; + return c < v.length ? {done:!1, value:v[c++]} : {done:!0}; }); }; -$jscomp.iteratorPrototype = function(w) { +$jscomp.iteratorPrototype = function(v) { $jscomp.initSymbolIterator(); - w = {next:w}; - w[$jscomp.global.Symbol.iterator] = function() { + v = {next:v}; + v[$jscomp.global.Symbol.iterator] = function() { return this; }; - return w; + return v; }; -$jscomp.iteratorFromArray = function(w, c) { +$jscomp.iteratorFromArray = function(v, c) { $jscomp.initSymbolIterator(); - w instanceof String && (w += ""); - var p = 0, m = {next:function() { - if (p < w.length) { - var g = p++; - return {value:c(g, w[g]), done:!1}; + v instanceof String && (v += ""); + var q = 0, m = {next:function() { + if (q < v.length) { + var g = q++; + return {value:c(g, v[g]), done:!1}; } m.next = function() { return {done:!0, value:void 0}; @@ -814,40 +814,40 @@ $jscomp.iteratorFromArray = function(w, c) { }; return m; }; -$jscomp.polyfill("Array.prototype.values", function(w) { - return w ? w : function() { - return $jscomp.iteratorFromArray(this, function(c, p) { - return p; +$jscomp.polyfill("Array.prototype.values", function(v) { + return v ? v : function() { + return $jscomp.iteratorFromArray(this, function(c, q) { + return q; }); }; }, "es8", "es3"); -$jscomp.polyfill("Array.prototype.keys", function(w) { - return w ? w : function() { +$jscomp.polyfill("Array.prototype.keys", function(v) { + return v ? v : function() { return $jscomp.iteratorFromArray(this, function(c) { return c; }); }; }, "es6", "es3"); -$jscomp.owns = function(w, c) { - return Object.prototype.hasOwnProperty.call(w, c); +$jscomp.owns = function(v, c) { + return Object.prototype.hasOwnProperty.call(v, c); }; -$jscomp.polyfill("Object.values", function(w) { - return w ? w : function(c) { - var p = [], m; +$jscomp.polyfill("Object.values", function(v) { + return v ? v : function(c) { + var q = [], m; for (m in c) { - $jscomp.owns(c, m) && p.push(c[m]); + $jscomp.owns(c, m) && q.push(c[m]); } - return p; + return q; }; }, "es8", "es3"); -(function(w) { +(function(v) { function c(a) { e.debug && console.log("Graph created"); this.list_of_graphcanvas = null; this.clear(); a && this.configure(a); } - function p(a, b, d, h, f, e) { + function q(a, b, d, h, f, e) { this.id = a; this.type = b; this.origin_id = d; @@ -863,7 +863,7 @@ $jscomp.polyfill("Object.values", function(w) { function g(a) { this._ctor(a); } - function u(a, b) { + function r(a, b) { this.offset = new Float32Array([0, 0]); this.scale = 1; this.max_scale = 10; @@ -879,7 +879,7 @@ $jscomp.polyfill("Object.values", function(w) { d = d || {}; this.background_image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII="; a && a.constructor === String && (a = document.querySelector(a)); - this.ds = new u; + this.ds = new r; this.zoom_modify_alpha = !0; this.title_text_font = "" + e.NODE_TEXT_SIZE + "px Arial"; this.inner_text_font = "normal " + e.NODE_SUBTEXT_SIZE + "px Arial"; @@ -926,7 +926,7 @@ $jscomp.polyfill("Object.values", function(w) { function y(a, b, d, h, f, e) { return d < a && d + f > a && h < b && h + e > b ? !0 : !1; } - function v(a, b) { + function w(a, b) { var d = a[0] + a[2], h = a[1] + a[3], f = b[1] + b[3]; return a[0] > b[0] + b[2] || a[1] > f || d < b[0] || h < b[1] ? !1 : !0; } @@ -1004,7 +1004,7 @@ $jscomp.polyfill("Object.values", function(w) { this.must_update = !0; this.margin = 5; } - var e = w.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, + var e = v.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: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:{}, searchbox_extras:{}, registerNodeType:function(a, b) { if (!b.prototype) { @@ -1257,7 +1257,7 @@ $jscomp.polyfill("Object.values", function(w) { } : function() { return (new Date).getTime(); }; - w.LGraph = e.LGraph = c; + v.LGraph = e.LGraph = c; c.supported_types = ["number", "string", "boolean"]; c.prototype.getSupportedTypes = function() { return this.supported_types || c.supported_types; @@ -1426,24 +1426,24 @@ $jscomp.polyfill("Object.values", function(w) { }; c.prototype.computeExecutionOrder = function(a, b) { for (var d = [], h = [], f = {}, x = {}, c = {}, k = 0, n = this._nodes.length; k < n; ++k) { - var q = this._nodes[k]; - if (!a || q.onExecute) { - f[q.id] = q; + var p = this._nodes[k]; + if (!a || p.onExecute) { + f[p.id] = p; var l = 0; - if (q.inputs) { - for (var r = 0, g = q.inputs.length; r < g; r++) { - q.inputs[r] && null != q.inputs[r].link && (l += 1); + if (p.inputs) { + for (var t = 0, g = p.inputs.length; t < g; t++) { + p.inputs[t] && null != p.inputs[t].link && (l += 1); } } - 0 == l ? (h.push(q), b && (q._level = 1)) : (b && (q._level = 0), c[q.id] = l); + 0 == l ? (h.push(p), b && (p._level = 1)) : (b && (p._level = 0), c[p.id] = l); } } for (; 0 != h.length;) { - if (q = h.shift(), d.push(q), delete f[q.id], q.outputs) { - for (k = 0; k < q.outputs.length; k++) { - if (a = q.outputs[k], null != a && null != a.links && 0 != a.links.length) { - for (r = 0; r < a.links.length; r++) { - (n = this.links[a.links[r]]) && !x[n.id] && (l = this.getNodeById(n.target_id), null == l ? x[n.id] = !0 : (b && (!l._level || l._level <= q._level) && (l._level = q._level + 1), x[n.id] = !0, --c[l.id], 0 == c[l.id] && h.push(l))); + if (p = h.shift(), d.push(p), delete f[p.id], p.outputs) { + for (k = 0; k < p.outputs.length; k++) { + if (a = p.outputs[k], null != a && null != a.links && 0 != a.links.length) { + for (t = 0; t < a.links.length; t++) { + (n = this.links[a.links[t]]) && !x[n.id] && (l = this.getNodeById(n.target_id), null == l ? x[n.id] = !0 : (b && (!l._level || l._level <= p._level) && (l._level = p._level + 1), x[n.id] = !0, --c[l.id], 0 == c[l.id] && h.push(l))); } } } @@ -1878,7 +1878,7 @@ $jscomp.polyfill("Object.values", function(w) { var h = this.links[b]; if (!h.serialize) { console.warn("weird LLink bug, link info is not a LLink but a regular object"); - var f = new p; + var f = new q; for (b in h) { f[b] = h[b]; } @@ -1900,7 +1900,7 @@ $jscomp.polyfill("Object.values", function(w) { for (var d = [], h = 0; h < a.links.length; ++h) { var f = a.links[h]; if (f) { - var c = new p; + var c = new q; c.configure(f); d[c.id] = c; } else { @@ -1953,14 +1953,14 @@ $jscomp.polyfill("Object.values", function(w) { }; c.prototype.onNodeTrace = function(a, b, d) { }; - p.prototype.configure = function(a) { + q.prototype.configure = function(a) { a.constructor === Array ? (this.id = a[0], this.origin_id = a[1], this.origin_slot = a[2], this.target_id = a[3], this.target_slot = a[4], this.type = a[5]) : (this.id = a.id, this.type = a.type, this.origin_id = a.origin_id, this.origin_slot = a.origin_slot, this.target_id = a.target_id, this.target_slot = a.target_slot); }; - p.prototype.serialize = function() { + q.prototype.serialize = function() { return [this.id, this.origin_id, this.origin_slot, this.target_id, this.target_slot, this.type]; }; - e.LLink = p; - w.LGraphNode = e.LGraphNode = m; + e.LLink = q; + v.LGraphNode = e.LGraphNode = m; m.prototype._ctor = function(a) { this.title = a || "Unnamed"; this.size = [e.NODE_WIDTH, 60]; @@ -2384,7 +2384,7 @@ $jscomp.polyfill("Object.values", function(w) { a = Math.max(a, 1); var h = e.NODE_TEXT_SIZE, f = d(this.title), c = 0, k = 0; if (this.inputs) { - for (var n = 0, q = this.inputs.length; n < q; ++n) { + for (var n = 0, p = this.inputs.length; n < p; ++n) { var l = this.inputs[n]; l = l.label || l.name || ""; l = d(l); @@ -2392,7 +2392,7 @@ $jscomp.polyfill("Object.values", function(w) { } } if (this.outputs) { - for (n = 0, q = this.outputs.length; n < q; ++n) { + for (n = 0, p = this.outputs.length; n < p; ++n) { l = this.outputs[n], l = l.label || l.name || "", l = d(l), k < l && (k = l); } } @@ -2403,7 +2403,7 @@ $jscomp.polyfill("Object.values", function(w) { a = 0; if (this.widgets && this.widgets.length) { n = 0; - for (q = this.widgets.length; n < q; ++n) { + for (p = this.widgets.length; n < p; ++n) { a = this.widgets[n].computeSize ? a + (this.widgets[n].computeSize(b[0])[1] + 4) : a + (e.NODE_WIDGET_HEIGHT + 4); } a += 8; @@ -2561,7 +2561,7 @@ $jscomp.polyfill("Object.values", function(w) { } var f = b.inputs[d], c = null; if (e.isValidConnection(h.type, f.type)) { - c = new p(++this.graph.last_link_id, f.type, this.id, a, b.id, d); + c = new q(++this.graph.last_link_id, f.type, this.id, a, b.id, d); this.graph.links[c.id] = c; null == h.links && (h.links = []); h.links.push(c.id); @@ -2766,7 +2766,7 @@ $jscomp.polyfill("Object.values", function(w) { m.prototype.localToScreen = function(a, b, d) { return [(a + this.pos[0]) * d.scale + d.offset[0], (b + this.pos[1]) * d.scale + d.offset[1]]; }; - w.LGraphGroup = e.LGraphGroup = g; + v.LGraphGroup = e.LGraphGroup = g; g.prototype._ctor = function(a) { this.title = a || "Group"; this.font_size = 24; @@ -2813,13 +2813,13 @@ $jscomp.polyfill("Object.values", function(w) { for (var a = this.graph._nodes, b = new Float32Array(4), d = 0; d < a.length; ++d) { var h = a[d]; h.getBounding(b); - v(this._bounding, b) && this._nodes.push(h); + w(this._bounding, b) && this._nodes.push(h); } }; g.prototype.isPointInside = m.prototype.isPointInside; g.prototype.setDirtyCanvas = m.prototype.setDirtyCanvas; - e.DragAndScale = u; - u.prototype.bindEvents = function(a) { + e.DragAndScale = r; + r.prototype.bindEvents = function(a) { this.last_mouse = new Float32Array(2); this._binded_mouse_callback = this.onMouse.bind(this); a.addEventListener("mousedown", this._binded_mouse_callback); @@ -2827,7 +2827,7 @@ $jscomp.polyfill("Object.values", function(w) { a.addEventListener("mousewheel", this._binded_mouse_callback, !1); a.addEventListener("wheel", this._binded_mouse_callback, !1); }; - u.prototype.computeVisibleArea = function() { + r.prototype.computeVisibleArea = function() { if (this.element) { var a = -this.offset[0], b = -this.offset[1], d = a + this.element.width / this.scale, h = b + this.element.height / this.scale; this.visible_area[0] = a; @@ -2838,7 +2838,7 @@ $jscomp.polyfill("Object.values", function(w) { this.visible_area[0] = this.visible_area[1] = this.visible_area[2] = this.visible_area[3] = 0; } }; - u.prototype.onMouse = function(a) { + r.prototype.onMouse = function(a) { if (this.enabled) { var b = this.element, d = b.getBoundingClientRect(), h = a.clientX - d.left; d = a.clientY - d.top; @@ -2869,27 +2869,27 @@ $jscomp.polyfill("Object.values", function(w) { return !1; } }; - u.prototype.toCanvasContext = function(a) { + r.prototype.toCanvasContext = function(a) { a.scale(this.scale, this.scale); a.translate(this.offset[0], this.offset[1]); }; - u.prototype.convertOffsetToCanvas = function(a) { + r.prototype.convertOffsetToCanvas = function(a) { return [(a[0] + this.offset[0]) * this.scale, (a[1] + this.offset[1]) * this.scale]; }; - u.prototype.convertCanvasToOffset = function(a, b) { + r.prototype.convertCanvasToOffset = function(a, b) { b = b || [0, 0]; b[0] = a[0] / this.scale - this.offset[0]; b[1] = a[1] / this.scale - this.offset[1]; return b; }; - u.prototype.mouseDrag = function(a, b) { + r.prototype.mouseDrag = function(a, b) { this.offset[0] += a / this.scale; this.offset[1] += b / this.scale; if (this.onredraw) { this.onredraw(this); } }; - u.prototype.changeScale = function(a, b) { + r.prototype.changeScale = function(a, b) { a < this.min_scale ? a = this.min_scale : a > this.max_scale && (a = this.max_scale); if (a != this.scale && this.element) { var d = this.element.getBoundingClientRect(); @@ -2898,15 +2898,15 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - u.prototype.changeDeltaScale = function(a, b) { + r.prototype.changeDeltaScale = function(a, b) { this.changeScale(this.scale * a, b); }; - u.prototype.reset = function() { + r.prototype.reset = function() { this.scale = 1; this.offset[0] = 0; this.offset[1] = 0; }; - w.LGraphCanvas = e.LGraphCanvas = l; + v.LGraphCanvas = e.LGraphCanvas = l; l.link_type_colors = {"-1":e.EVENT_LINK_COLOR, number:"#AAA", node:"#DCA"}; l.gradients = {}; l.prototype.clear = function() { @@ -3092,10 +3092,10 @@ $jscomp.polyfill("Object.values", function(w) { } else { if (d.outputs) { for (var k = 0, n = d.outputs.length; k < n; ++k) { - var q = d.outputs[k], g = d.getConnectionPos(!1, k); + var p = d.outputs[k], g = d.getConnectionPos(!1, k); if (y(a.canvasX, a.canvasY, g[0] - 15, g[1] - 10, 30, 20)) { this.connecting_node = d; - this.connecting_output = q; + this.connecting_output = p; this.connecting_pos = d.getConnectionPos(!1, k); this.connecting_slot = k; a.shiftKey && d.disconnectOutput(k); @@ -3115,7 +3115,7 @@ $jscomp.polyfill("Object.values", function(w) { } if (d.inputs) { for (k = 0, n = d.inputs.length; k < n; ++k) { - if (q = d.inputs[k], g = d.getConnectionPos(!0, k), y(a.canvasX, a.canvasY, g[0] - 15, g[1] - 10, 30, 20)) { + if (p = d.inputs[k], g = d.getConnectionPos(!0, k), y(a.canvasX, a.canvasY, g[0] - 15, g[1] - 10, 30, 20)) { if (f) { if (d.onInputDblClick) { d.onInputDblClick(k, a); @@ -3125,8 +3125,8 @@ $jscomp.polyfill("Object.values", function(w) { d.onInputClick(k, a); } } - if (null !== q.link) { - h = this.graph.links[q.link]; + if (null !== p.link) { + h = this.graph.links[p.link]; d.disconnectInput(k); if (this.allow_reconnect_links || a.shiftKey) { this.connecting_node = this.graph._nodes_by_id[h.origin_id], this.connecting_slot = h.origin_slot, this.connecting_output = this.connecting_node.outputs[this.connecting_slot], this.connecting_pos = this.connecting_node.getConnectionPos(!1, this.connecting_slot); @@ -3308,7 +3308,7 @@ $jscomp.polyfill("Object.values", function(w) { this.dragging_rectangle[3] = f; f = []; for (c = 0; c < b.length; ++c) { - h = b[c], h.getBounding(d), v(this.dragging_rectangle, d) && f.push(h); + h = b[c], h.getBounding(d), w(this.dragging_rectangle, d) && f.push(h); } f.length && this.selectNodes(f); } @@ -3661,7 +3661,7 @@ $jscomp.polyfill("Object.values", function(w) { a = a || this.graph._nodes; for (var d = 0, h = a.length; d < h; ++d) { var f = a[d]; - (!this.live_mode || f.onDrawBackground || f.onDrawForeground) && v(this.visible_area, f.getBounding(C)) && b.push(f); + (!this.live_mode || f.onDrawBackground || f.onDrawForeground) && w(this.visible_area, f.getBounding(C)) && b.push(f); } return b; }; @@ -3836,8 +3836,8 @@ $jscomp.polyfill("Object.values", function(w) { var n = a.horizontal; if (a.flags.collapsed) { b.font = this.inner_text_font; - var q = a.getTitle ? a.getTitle() : a.title; - null != q && (a._collapsed_width = Math.min(a.size[0], b.measureText(q).width + 2 * e.NODE_TITLE_HEIGHT), D[0] = a._collapsed_width, D[1] = 0); + var p = a.getTitle ? a.getTitle() : a.title; + null != p && (a._collapsed_width = Math.min(a.size[0], b.measureText(p).width + 2 * e.NODE_TITLE_HEIGHT), D[0] = a._collapsed_width, D[1] = 0); } a.clip_area && (b.save(), b.beginPath(), k == e.BOX_SHAPE ? b.rect(0, 0, D[0], D[1]) : k == e.ROUND_SHAPE ? b.roundRect(0, 0, D[0], D[1], 10) : k == e.CIRCLE_SHAPE && b.arc(0.5 * D[0], 0.5 * D[1], 0.5 * D[0], 0, 2 * Math.PI), b.clip()); a.has_errors && (h = "red"); @@ -3851,7 +3851,7 @@ $jscomp.polyfill("Object.values", function(w) { h = !f; k = this.connecting_output; b.lineWidth = 1; - q = 0; + p = 0; var l = new Float32Array(2); if (!a.flags.collapsed) { if (a.inputs) { @@ -3860,16 +3860,16 @@ $jscomp.polyfill("Object.values", function(w) { b.globalAlpha = c; this.connecting_node && !e.isValidConnection(g.type, k.type) && (b.globalAlpha = 0.4 * c); b.fillStyle = null != g.link ? g.color_on || this.default_connection_color.input_on : g.color_off || this.default_connection_color.input_off; - var r = a.getConnectionPos(!0, d, l); - r[0] -= a.pos[0]; - r[1] -= a.pos[1]; - q < r[1] + 0.5 * e.NODE_SLOT_HEIGHT && (q = r[1] + 0.5 * e.NODE_SLOT_HEIGHT); + var t = a.getConnectionPos(!0, d, l); + t[0] -= a.pos[0]; + t[1] -= a.pos[1]; + p < t[1] + 0.5 * e.NODE_SLOT_HEIGHT && (p = t[1] + 0.5 * e.NODE_SLOT_HEIGHT); b.beginPath(); - g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(r[0] - 5 + 0.5, r[1] - 8 + 0.5, 10, 14) : b.rect(r[0] - 6 + 0.5, r[1] - 5 + 0.5, 14, 10) : g.shape === e.ARROW_SHAPE ? (b.moveTo(r[0] + 8, r[1] + 0.5), b.lineTo(r[0] - 4, r[1] + 6 + 0.5), b.lineTo(r[0] - 4, r[1] - 6 + 0.5), b.closePath()) : f ? b.rect(r[0] - 4, r[1] - 4, 8, 8) : b.arc(r[0], r[1], 4, 0, 2 * Math.PI); + g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : g.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI); b.fill(); if (h) { var m = null != g.label ? g.label : g.name; - m && (b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.UP ? b.fillText(m, r[0], r[1] - 10) : b.fillText(m, r[0] + 10, r[1] + 5)); + m && (b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.UP ? b.fillText(m, t[0], t[1] - 10) : b.fillText(m, t[0] + 10, t[1] + 5)); } } } @@ -3878,16 +3878,16 @@ $jscomp.polyfill("Object.values", function(w) { b.strokeStyle = "black"; if (a.outputs) { for (d = 0; d < a.outputs.length; d++) { - if (g = a.outputs[d], r = a.getConnectionPos(!1, d, l), r[0] -= a.pos[0], r[1] -= a.pos[1], q < r[1] + 0.5 * e.NODE_SLOT_HEIGHT && (q = r[1] + 0.5 * e.NODE_SLOT_HEIGHT), b.fillStyle = g.links && g.links.length ? g.color_on || this.default_connection_color.output_on : g.color_off || this.default_connection_color.output_off, b.beginPath(), g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(r[0] - 5 + 0.5, r[1] - 8 + 0.5, 10, 14) : b.rect(r[0] - 6 + 0.5, r[1] - 5 + 0.5, 14, 10) : - g.shape === e.ARROW_SHAPE ? (b.moveTo(r[0] + 8, r[1] + 0.5), b.lineTo(r[0] - 4, r[1] + 6 + 0.5), b.lineTo(r[0] - 4, r[1] - 6 + 0.5), b.closePath()) : f ? b.rect(r[0] - 4, r[1] - 4, 8, 8) : b.arc(r[0], r[1], 4, 0, 2 * Math.PI), b.fill(), f || b.stroke(), h && (m = null != g.label ? g.label : g.name)) { - b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.DOWN ? b.fillText(m, r[0], r[1] - 8) : b.fillText(m, r[0] - 10, r[1] + 5); + if (g = a.outputs[d], t = a.getConnectionPos(!1, d, l), t[0] -= a.pos[0], t[1] -= a.pos[1], p < t[1] + 0.5 * e.NODE_SLOT_HEIGHT && (p = t[1] + 0.5 * e.NODE_SLOT_HEIGHT), b.fillStyle = g.links && g.links.length ? g.color_on || this.default_connection_color.output_on : g.color_off || this.default_connection_color.output_off, b.beginPath(), g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : + g.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI), b.fill(), f || b.stroke(), h && (m = null != g.label ? g.label : g.name)) { + b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.DOWN ? b.fillText(m, t[0], t[1] - 8) : b.fillText(m, t[0] - 10, t[1] + 5); } } } b.textAlign = "left"; b.globalAlpha = 1; if (a.widgets) { - g = q; + g = p; if (n || a.widgets_up) { g = 2; } @@ -3946,22 +3946,22 @@ $jscomp.polyfill("Object.values", function(w) { a.fillText(b, d[0], d[1] - 15 - 24 * 0.3); } }; - var t = new Float32Array(4); + var u = new Float32Array(4); l.prototype.drawNodeShape = function(a, b, d, h, f, c, k) { b.strokeStyle = h; b.fillStyle = f; f = e.NODE_TITLE_HEIGHT; - var n = 0.5 > this.ds.scale, q = a._shape || a.constructor.shape || e.ROUND_SHAPE, x = a.constructor.title_mode, g = !0; + var n = 0.5 > this.ds.scale, p = a._shape || a.constructor.shape || e.ROUND_SHAPE, x = a.constructor.title_mode, g = !0; x == e.TRANSPARENT_TITLE ? g = !1 : x == e.AUTOHIDE_TITLE && k && (g = !0); - t[0] = 0; - t[1] = g ? -f : 0; - t[2] = d[0] + 1; - t[3] = g ? d[1] + f : d[1]; + u[0] = 0; + u[1] = g ? -f : 0; + u[2] = d[0] + 1; + u[3] = g ? d[1] + f : d[1]; k = b.globalAlpha; b.beginPath(); - q == e.BOX_SHAPE || n ? b.fillRect(t[0], t[1], t[2], t[3]) : q == e.ROUND_SHAPE || q == e.CARD_SHAPE ? b.roundRect(t[0], t[1], t[2], t[3], this.round_radius, q == e.CARD_SHAPE ? 0 : this.round_radius) : q == e.CIRCLE_SHAPE && b.arc(0.5 * d[0], 0.5 * d[1], 0.5 * d[0], 0, 2 * Math.PI); + p == e.BOX_SHAPE || n ? b.fillRect(u[0], u[1], u[2], u[3]) : p == e.ROUND_SHAPE || p == e.CARD_SHAPE ? b.roundRect(u[0], u[1], u[2], u[3], this.round_radius, p == e.CARD_SHAPE ? 0 : this.round_radius) : p == e.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, t[2], 2)); + a.flags.collapsed || (b.shadowColor = "transparent", b.fillStyle = "rgba(0,0,0,0.2)", b.fillRect(0, -1, u[2], 2)); b.shadowColor = "transparent"; if (a.onDrawBackground) { a.onDrawBackground(b, this, this.canvas); @@ -3974,14 +3974,14 @@ $jscomp.polyfill("Object.values", function(w) { g = a.constructor.title_color || h; a.flags.collapsed && (b.shadowColor = e.DEFAULT_SHADOW_COLOR); if (this.use_gradients) { - var r = l.gradients[g]; - r || (r = l.gradients[g] = b.createLinearGradient(0, 0, 400, 0), r.addColorStop(0, g), r.addColorStop(1, "#000")); - b.fillStyle = r; + var t = l.gradients[g]; + t || (t = l.gradients[g] = b.createLinearGradient(0, 0, 400, 0), t.addColorStop(0, g), t.addColorStop(1, "#000")); + b.fillStyle = t; } else { b.fillStyle = g; } b.beginPath(); - q == e.BOX_SHAPE || n ? b.rect(0, -f, d[0] + 1, f) : (q == e.ROUND_SHAPE || q == e.CARD_SHAPE) && b.roundRect(0, -f, d[0] + 1, f, this.round_radius, a.flags.collapsed ? this.round_radius : 0); + p == e.BOX_SHAPE || n ? b.rect(0, -f, d[0] + 1, f) : (p == e.ROUND_SHAPE || p == e.CARD_SHAPE) && b.roundRect(0, -f, d[0] + 1, f, this.round_radius, a.flags.collapsed ? this.round_radius : 0); b.fill(); b.shadowColor = "transparent"; } @@ -3989,7 +3989,7 @@ $jscomp.polyfill("Object.values", function(w) { if (a.onDrawTitleBox) { a.onDrawTitleBox(b, f, d, this.ds.scale); } else { - q == e.ROUND_SHAPE || q == e.CIRCLE_SHAPE || q == e.CARD_SHAPE ? (n && (b.fillStyle = "black", b.beginPath(), b.arc(0.5 * f, -0.5 * f, 6, 0, 2 * Math.PI), b.fill()), b.fillStyle = a.boxcolor || e.NODE_DEFAULT_BOXCOLOR, n ? b.fillRect(0.5 * f - 5, -0.5 * f - 5, 10, 10) : (b.beginPath(), b.arc(0.5 * f, -0.5 * f, 5, 0, 2 * Math.PI), b.fill())) : (n && (b.fillStyle = "black", b.fillRect(0.5 * (f - 10) - 1, -0.5 * (f + 10) - 1, 12, 12)), b.fillStyle = a.boxcolor || e.NODE_DEFAULT_BOXCOLOR, b.fillRect(0.5 * + p == e.ROUND_SHAPE || p == e.CIRCLE_SHAPE || p == e.CARD_SHAPE ? (n && (b.fillStyle = "black", b.beginPath(), b.arc(0.5 * f, -0.5 * f, 6, 0, 2 * Math.PI), b.fill()), b.fillStyle = a.boxcolor || e.NODE_DEFAULT_BOXCOLOR, n ? b.fillRect(0.5 * f - 5, -0.5 * f - 5, 10, 10) : (b.beginPath(), b.arc(0.5 * f, -0.5 * f, 5, 0, 2 * Math.PI), b.fill())) : (n && (b.fillStyle = "black", b.fillRect(0.5 * (f - 10) - 1, -0.5 * (f + 10) - 1, 12, 12)), b.fillStyle = a.boxcolor || e.NODE_DEFAULT_BOXCOLOR, b.fillRect(0.5 * (f - 10), -0.5 * (f + 10), 10, 10)); } b.globalAlpha = k; @@ -4003,20 +4003,20 @@ $jscomp.polyfill("Object.values", function(w) { } if (c) { if (a.onBounding) { - a.onBounding(t); + a.onBounding(u); } - x == e.TRANSPARENT_TITLE && (t[1] -= f, t[3] += f); + x == e.TRANSPARENT_TITLE && (u[1] -= f, u[3] += f); b.lineWidth = 1; b.globalAlpha = 0.8; b.beginPath(); - q == e.BOX_SHAPE ? b.rect(-6 + t[0], -6 + t[1], 12 + t[2], 12 + t[3]) : q == e.ROUND_SHAPE || q == e.CARD_SHAPE && a.flags.collapsed ? b.roundRect(-6 + t[0], -6 + t[1], 12 + t[2], 12 + t[3], 2 * this.round_radius) : q == e.CARD_SHAPE ? b.roundRect(-6 + t[0], -6 + t[1], 12 + t[2], 12 + t[3], 2 * this.round_radius, 2) : q == e.CIRCLE_SHAPE && b.arc(0.5 * d[0], 0.5 * d[1], 0.5 * d[0] + 6, 0, 2 * Math.PI); + p == e.BOX_SHAPE ? b.rect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3]) : p == e.ROUND_SHAPE || p == e.CARD_SHAPE && a.flags.collapsed ? b.roundRect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3], 2 * this.round_radius) : p == e.CARD_SHAPE ? b.roundRect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3], 2 * this.round_radius, 2) : p == e.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 = h; b.globalAlpha = 1; } }; - var G = new Float32Array(4), n = new Float32Array(4), q = new Float32Array(2), k = new Float32Array(2); + var G = new Float32Array(4), n = new Float32Array(4), p = new Float32Array(2), k = new Float32Array(2); l.prototype.drawConnections = function(a) { var b = e.getTime(), d = this.visible_area; G[0] = d[0] - 20; @@ -4036,24 +4036,24 @@ $jscomp.polyfill("Object.values", function(w) { if (g && null != g.link && (g = this.graph.links[g.link])) { var m = this.graph.getNodeById(g.origin_id); if (null != m) { - var u = g.origin_slot; - var A = -1 == u ? [m.pos[0] + 10, m.pos[1] + 10] : m.getConnectionPos(!1, u, q); - var r = c.getConnectionPos(!0, l, k); + var r = g.origin_slot; + var A = -1 == r ? [m.pos[0] + 10, m.pos[1] + 10] : m.getConnectionPos(!1, r, p); + var t = c.getConnectionPos(!0, l, k); n[0] = A[0]; n[1] = A[1]; - n[2] = r[0] - A[0]; - n[3] = r[1] - A[1]; + n[2] = t[0] - A[0]; + n[3] = t[1] - A[1]; 0 > n[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 (v(n, G)) { - var K = m.outputs[u]; - u = c.inputs[l]; - if (K && u && (m = K.dir || (m.horizontal ? e.DOWN : e.RIGHT), u = u.dir || (c.horizontal ? e.UP : e.LEFT), this.renderLink(a, A, r, g, !1, 0, null, m, u), g && g._last_time && 1000 > b - g._last_time)) { - K = 2.0 - 0.002 * (b - g._last_time); - var p = a.globalAlpha; - a.globalAlpha = p * K; - this.renderLink(a, A, r, g, !0, K, "white", m, u); - a.globalAlpha = p; + if (w(n, G)) { + var q = m.outputs[r]; + r = c.inputs[l]; + if (q && r && (m = q.dir || (m.horizontal ? e.DOWN : e.RIGHT), r = r.dir || (c.horizontal ? e.UP : e.LEFT), this.renderLink(a, A, t, g, !1, 0, null, m, r), g && g._last_time && 1000 > b - g._last_time)) { + q = 2.0 - 0.002 * (b - g._last_time); + var M = a.globalAlpha; + a.globalAlpha = M * q; + this.renderLink(a, A, t, g, !0, q, "white", m, r); + a.globalAlpha = M; } } } @@ -4063,24 +4063,24 @@ $jscomp.polyfill("Object.values", function(w) { } a.globalAlpha = 1; }; - l.prototype.renderLink = function(a, b, d, h, f, c, k, n, q, g) { + l.prototype.renderLink = function(a, b, d, h, f, c, k, n, p, g) { h && this.visible_links.push(h); !k && h && (k = h.color || l.link_type_colors[h.type]); k || (k = this.default_link_color); null != h && this.highlighted_links[h.id] && (k = "#FFF"); n = n || e.RIGHT; - q = q || e.LEFT; + p = p || e.LEFT; var x = B(b, d); this.render_connections_border && 0.6 < this.ds.scale && (a.lineWidth = this.connections_width + 4); a.lineJoin = "round"; g = g || 1; 1 < g && (a.lineWidth = 0.5); a.beginPath(); - for (var r = 0; r < g; r += 1) { - var m = 5 * (r - 0.5 * (g - 1)); + for (var t = 0; t < g; t += 1) { + var m = 5 * (t - 0.5 * (g - 1)); if (this.links_render_mode == e.SPLINE_LINK) { a.moveTo(b[0], b[1] + m); - var H = 0, u = 0, p = 0, I = 0; + var H = 0, r = 0, q = 0, I = 0; switch(n) { case e.LEFT: H = -0.25 * x; @@ -4089,17 +4089,17 @@ $jscomp.polyfill("Object.values", function(w) { H = 0.25 * x; break; case e.UP: - u = -0.25 * x; + r = -0.25 * x; break; case e.DOWN: - u = 0.25 * x; + r = 0.25 * x; } - switch(q) { + switch(p) { case e.LEFT: - p = -0.25 * x; + q = -0.25 * x; break; case e.RIGHT: - p = 0.25 * x; + q = 0.25 * x; break; case e.UP: I = -0.25 * x; @@ -4107,11 +4107,11 @@ $jscomp.polyfill("Object.values", function(w) { case e.DOWN: I = 0.25 * x; } - a.bezierCurveTo(b[0] + H, b[1] + u + m, d[0] + p, d[1] + I + m, d[0], d[1] + m); + a.bezierCurveTo(b[0] + H, b[1] + r + m, d[0] + q, d[1] + I + m, d[0], d[1] + m); } else { if (this.links_render_mode == e.LINEAR_LINK) { a.moveTo(b[0], b[1] + m); - I = p = u = H = 0; + I = q = r = H = 0; switch(n) { case e.LEFT: H = -1; @@ -4120,17 +4120,17 @@ $jscomp.polyfill("Object.values", function(w) { H = 1; break; case e.UP: - u = -1; + r = -1; break; case e.DOWN: - u = 1; + r = 1; } - switch(q) { + switch(p) { case e.LEFT: - p = -1; + q = -1; break; case e.RIGHT: - p = 1; + q = 1; break; case e.UP: I = -1; @@ -4138,12 +4138,12 @@ $jscomp.polyfill("Object.values", function(w) { case e.DOWN: I = 1; } - a.lineTo(b[0] + 15 * H, b[1] + 15 * u + m); - a.lineTo(d[0] + 15 * p, d[1] + 15 * I + m); + a.lineTo(b[0] + 15 * H, b[1] + 15 * r + m); + a.lineTo(d[0] + 15 * q, d[1] + 15 * I + m); a.lineTo(d[0], d[1] + m); } else { if (this.links_render_mode == e.STRAIGHT_LINK) { - a.moveTo(b[0], b[1]), m = b[0], H = b[1], u = d[0], p = d[1], n == e.RIGHT ? m += 10 : H += 10, q == e.LEFT ? u -= 10 : p -= 10, a.lineTo(m, H), a.lineTo(0.5 * (m + u), H), a.lineTo(0.5 * (m + u), p), a.lineTo(u, p), a.lineTo(d[0], d[1]); + a.moveTo(b[0], b[1]), m = b[0], H = b[1], r = d[0], q = d[1], n == e.RIGHT ? m += 10 : H += 10, p == e.LEFT ? r -= 10 : q -= 10, a.lineTo(m, H), a.lineTo(0.5 * (m + r), H), a.lineTo(0.5 * (m + r), q), a.lineTo(r, q), a.lineTo(d[0], d[1]); } else { return; } @@ -4154,13 +4154,13 @@ $jscomp.polyfill("Object.values", function(w) { a.lineWidth = this.connections_width; a.fillStyle = a.strokeStyle = k; a.stroke(); - f = this.computeConnectionPoint(b, d, 0.5, n, q); + f = this.computeConnectionPoint(b, d, 0.5, n, p); h && h._pos && (h._pos[0] = f[0], h._pos[1] = f[1]); - 0.6 <= this.ds.scale && this.highquality_render && q != e.CENTER && (this.render_connection_arrows && (r = this.computeConnectionPoint(b, d, 0.25, n, q), x = this.computeConnectionPoint(b, d, 0.26, n, q), h = this.computeConnectionPoint(b, d, 0.75, n, q), g = this.computeConnectionPoint(b, d, 0.76, n, q), this.render_curved_connections ? (x = -Math.atan2(x[0] - r[0], x[1] - r[1]), g = -Math.atan2(g[0] - h[0], g[1] - h[1])) : g = x = d[1] > b[1] ? 0 : Math.PI, a.save(), a.translate(r[0], r[1]), + 0.6 <= this.ds.scale && this.highquality_render && p != e.CENTER && (this.render_connection_arrows && (t = this.computeConnectionPoint(b, d, 0.25, n, p), x = this.computeConnectionPoint(b, d, 0.26, n, p), h = this.computeConnectionPoint(b, d, 0.75, n, p), g = this.computeConnectionPoint(b, d, 0.76, n, p), this.render_curved_connections ? (x = -Math.atan2(x[0] - t[0], x[1] - t[1]), g = -Math.atan2(g[0] - h[0], g[1] - h[1])) : g = x = d[1] > b[1] ? 0 : Math.PI, a.save(), a.translate(t[0], t[1]), a.rotate(x), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore(), a.save(), a.translate(h[0], h[1]), a.rotate(g), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore()), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill()); if (c) { - for (a.fillStyle = k, r = 0; 5 > r; ++r) { - c = (0.001 * e.getTime() + 0.2 * r) % 1, f = this.computeConnectionPoint(b, d, c, n, q), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill(); + for (a.fillStyle = k, t = 0; 5 > t; ++t) { + c = (0.001 * e.getTime() + 0.2 * t) % 1, f = this.computeConnectionPoint(b, d, c, n, p), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill(); } } }; @@ -4225,70 +4225,70 @@ $jscomp.polyfill("Object.values", function(w) { var k = e.NODE_WIDGET_HEIGHT, n = 0.5 < this.ds.scale; d.save(); d.globalAlpha = this.editor_alpha; - for (var q = e.WIDGET_OUTLINE_COLOR, l = e.WIDGET_BGCOLOR, g = e.WIDGET_TEXT_COLOR, r = e.WIDGET_SECONDARY_TEXT_COLOR, m = 0; m < c.length; ++m) { - var u = k, p = c[m], t = b; - p.y && (t = p.y); - p.last_y = t; - d.strokeStyle = q; + for (var p = e.WIDGET_OUTLINE_COLOR, l = e.WIDGET_BGCOLOR, g = e.WIDGET_TEXT_COLOR, t = e.WIDGET_SECONDARY_TEXT_COLOR, m = 0; m < c.length; ++m) { + var r = c[m], q = b; + r.y && (q = r.y); + r.last_y = q; + d.strokeStyle = p; d.fillStyle = "#222"; d.textAlign = "left"; - p.disabled && (d.globalAlpha *= 0.5); - switch(p.type) { + r.disabled && (d.globalAlpha *= 0.5); + switch(r.type) { case "button": - p.clicked && (d.fillStyle = "#AAA", p.clicked = !1, this.dirty_canvas = !0); - d.fillRect(15, t, f - 30, k); - n && d.strokeRect(15, t, f - 30, k); - n && (d.textAlign = "center", d.fillStyle = g, d.fillText(p.name, 0.5 * f, t + 0.7 * k)); + r.clicked && (d.fillStyle = "#AAA", r.clicked = !1, this.dirty_canvas = !0); + d.fillRect(15, q, f - 30, k); + n && d.strokeRect(15, q, f - 30, k); + n && (d.textAlign = "center", d.fillStyle = g, d.fillText(r.name, 0.5 * f, q + 0.7 * k)); break; case "toggle": d.textAlign = "left"; - d.strokeStyle = q; + d.strokeStyle = p; d.fillStyle = l; d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); n && d.stroke(); - d.fillStyle = p.value ? "#89A" : "#333"; + d.fillStyle = r.value ? "#89A" : "#333"; d.beginPath(); - d.arc(f - 30, t + 0.5 * k, 0.36 * k, 0, 2 * Math.PI); + d.arc(f - 30, q + 0.5 * k, 0.36 * k, 0, 2 * Math.PI); d.fill(); - n && (d.fillStyle = r, null != p.name && d.fillText(p.name, 30, t + 0.7 * k), d.fillStyle = p.value ? g : r, d.textAlign = "right", d.fillText(p.value ? p.options.on || "true" : p.options.off || "false", f - 40, t + 0.7 * k)); + n && (d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = r.value ? g : t, d.textAlign = "right", d.fillText(r.value ? r.options.on || "true" : r.options.off || "false", f - 40, q + 0.7 * k)); break; case "slider": d.fillStyle = l; - d.fillRect(15, t, f - 30, k); - var C = p.options.max - p.options.min, v = (p.value - p.options.min) / C; - d.fillStyle = h == p ? "#89A" : "#678"; - d.fillRect(15, t, v * (f - 30), k); - n && d.strokeRect(15, t, f - 30, k); - p.marker && (C = (p.marker - p.options.min) / C, d.fillStyle = "#AA9", d.fillRect(15 + C * (f - 30), t, 2, k)); - n && (d.textAlign = "center", d.fillStyle = g, d.fillText(p.name + " " + Number(p.value).toFixed(3), 0.5 * f, t + 0.7 * k)); + d.fillRect(15, q, f - 30, k); + var u = r.options.max - r.options.min, C = (r.value - r.options.min) / u; + d.fillStyle = h == r ? "#89A" : "#678"; + d.fillRect(15, q, C * (f - 30), k); + n && d.strokeRect(15, q, f - 30, k); + r.marker && (u = (r.marker - r.options.min) / u, d.fillStyle = "#AA9", d.fillRect(15 + u * (f - 30), q, 2, k)); + n && (d.textAlign = "center", d.fillStyle = g, d.fillText(r.name + " " + Number(r.value).toFixed(3), 0.5 * f, q + 0.7 * k)); break; case "number": case "combo": d.textAlign = "left"; - d.strokeStyle = q; + d.strokeStyle = p; d.fillStyle = l; d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); - n && (d.stroke(), d.fillStyle = g, d.beginPath(), d.moveTo(31, b + 5), d.lineTo(21, b + 0.5 * k), d.lineTo(31, b + k - 5), d.fill(), d.beginPath(), d.moveTo(f - 15 - 16, b + 5), d.lineTo(f - 15 - 6, b + 0.5 * k), d.lineTo(f - 15 - 16, b + k - 5), d.fill(), d.fillStyle = r, d.fillText(p.name, 35, t + 0.7 * k), d.fillStyle = g, d.textAlign = "right", "number" == p.type ? d.fillText(Number(p.value).toFixed(void 0 !== p.options.precision ? p.options.precision : 3), f - 30 - 20, t + 0.7 * k) : - (C = p.value, p.options.values && (v = p.options.values, v.constructor === Function && (v = v()), v && v.constructor !== Array && (C = v[p.value])), d.fillText(C, f - 30 - 20, t + 0.7 * k))); + n && (d.stroke(), d.fillStyle = g, d.beginPath(), d.moveTo(31, b + 5), d.lineTo(21, b + 0.5 * k), d.lineTo(31, b + k - 5), d.fill(), d.beginPath(), d.moveTo(f - 15 - 16, b + 5), d.lineTo(f - 15 - 6, b + 0.5 * k), d.lineTo(f - 15 - 16, b + k - 5), d.fill(), d.fillStyle = t, d.fillText(r.name, 35, q + 0.7 * k), d.fillStyle = g, d.textAlign = "right", "number" == r.type ? d.fillText(Number(r.value).toFixed(void 0 !== r.options.precision ? r.options.precision : 3), f - 30 - 20, q + 0.7 * k) : + (u = r.value, r.options.values && (C = r.options.values, C.constructor === Function && (C = C()), C && C.constructor !== Array && (u = C[r.value])), d.fillText(u, f - 30 - 20, q + 0.7 * k))); break; case "string": case "text": d.textAlign = "left"; - d.strokeStyle = q; + d.strokeStyle = p; d.fillStyle = l; d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); - n && (d.save(), d.beginPath(), d.rect(15, b, f - 30, k), d.clip(), d.stroke(), d.fillStyle = r, null != p.name && d.fillText(p.name, 30, t + 0.7 * k), d.fillStyle = g, d.textAlign = "right", d.fillText(String(p.value).substr(0, 30), f - 30, t + 0.7 * k), d.restore()); + n && (d.save(), d.beginPath(), d.rect(15, b, f - 30, k), d.clip(), d.stroke(), d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = g, d.textAlign = "right", d.fillText(String(r.value).substr(0, 30), f - 30, q + 0.7 * k), d.restore()); break; default: - p.draw && (u = p.draw(d, a, f, t, k) || k); + r.draw && r.draw(d, a, f, q, k); } - b += u + 4; + b += (r.computeSize ? r.computeSize(f)[1] : k) + 4; d.globalAlpha = this.editor_alpha; } d.restore(); @@ -4298,88 +4298,91 @@ $jscomp.polyfill("Object.values", function(w) { 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, q, a, b, d); + f.callback && f.callback(f.value, p, a, b, d); } if (!a.widgets || !a.widgets.length) { return null; } - for (var h = b[0] - a.pos[0], k = b[1] - a.pos[1], n = a.size[0], q = this, l = this.getCanvasWindow(), g = 0; g < a.widgets.length; ++g) { - var r = a.widgets[g]; - if (r && !r.disabled && (r == c || 6 < h && h < n - 12 && k > r.last_y && k < r.last_y + e.NODE_WIDGET_HEIGHT)) { - switch(r.type) { - case "button": - if ("mousemove" === d.type) { - break; - } - r.callback && setTimeout(function() { - r.callback(r, q, a, b, d); - }, 20); - this.dirty_canvas = r.clicked = !0; - break; - case "slider": - l = Math.clamp((h - 10) / (n - 20), 0, 1); - r.value = r.options.min + (r.options.max - r.options.min) * l; - r.callback && setTimeout(function() { - f(r, r.value); - }, 20); - this.dirty_canvas = !0; - break; - case "number": - case "combo": - c = r.value; - if ("mousemove" == d.type && "number" == r.type) { - r.value += 0.1 * d.deltaX * (r.options.step || 1), null != r.options.min && r.value < r.options.min && (r.value = r.options.min), null != r.options.max && r.value > r.options.max && (r.value = r.options.max); - } else { - if ("mousedown" == d.type) { - var m = r.options.values; - m && m.constructor === Function && (m = r.options.values(r, a)); - var p = null; - "number" != r.type && (p = m.constructor === Array ? m : Object.keys(m)); - h = 40 > h ? -1 : h > n - 40 ? 1 : 0; - if ("number" == r.type) { - r.value += 0.1 * h * (r.options.step || 1), null != r.options.min && r.value < r.options.min && (r.value = r.options.min), null != r.options.max && r.value > r.options.max && (r.value = r.options.max); - } else { - if (h) { - l = -1, l = m.constructor === Object ? p.indexOf(String(r.value)) + h : p.indexOf(r.value) + h, l >= p.length && (l = p.length - 1), 0 > l && (l = 0), r.value = m.constructor === Array ? m[l] : l; - } else { - var u = m != p ? Object.values(m) : m; - new e.ContextMenu(u, {scale:Math.max(1, this.ds.scale), event:d, className:"dark", callback:function(a, b, d) { - m != p && (a = u.indexOf(a)); - this.value = a; - f(this, a); - q.dirty_canvas = !0; - return !1; - }.bind(r)}, l); - } - } - } else { - "mouseup" == d.type && "number" == r.type && (h = 40 > h ? -1 : h > n - 40 ? 1 : 0, 200 > d.click_time && 0 == h && this.prompt("Value", r.value, function(a) { - this.value = Number(a); - f(this, this.value); - }.bind(r), d)); + for (var h = b[0] - a.pos[0], k = b[1] - a.pos[1], n = a.size[0], p = this, l = this.getCanvasWindow(), g = 0; g < a.widgets.length; ++g) { + var t = a.widgets[g]; + if (t && !t.disabled) { + var m = t.computeSize ? t.computeSize(n)[1] : e.NODE_WIDGET_HEIGHT; + if (t == c || 6 < h && h < n - 12 && k > t.last_y && k < t.last_y + m) { + switch(t.type) { + case "button": + if ("mousemove" === d.type) { + break; } - } - c != r.value && setTimeout(function() { - f(this, this.value); - }.bind(r), 20); - this.dirty_canvas = !0; - break; - case "toggle": - "mousedown" == d.type && (r.value = !r.value, setTimeout(function() { - f(r, r.value); - }, 20)); - break; - case "string": - case "text": - "mousedown" == d.type && this.prompt("Value", r.value, function(a) { - this.value = a; - f(this, a); - }.bind(r), d); - break; - default: - r.mouse && r.mouse(ctx, d, [h, k], a); + t.callback && setTimeout(function() { + t.callback(t, p, a, b, d); + }, 20); + this.dirty_canvas = t.clicked = !0; + break; + case "slider": + l = Math.clamp((h - 10) / (n - 20), 0, 1); + t.value = t.options.min + (t.options.max - t.options.min) * l; + t.callback && setTimeout(function() { + f(t, t.value); + }, 20); + this.dirty_canvas = !0; + break; + case "number": + case "combo": + c = t.value; + if ("mousemove" == d.type && "number" == t.type) { + t.value += 0.1 * d.deltaX * (t.options.step || 1), null != t.options.min && t.value < t.options.min && (t.value = t.options.min), null != t.options.max && t.value > t.options.max && (t.value = t.options.max); + } else { + if ("mousedown" == d.type) { + var r = t.options.values; + r && r.constructor === Function && (r = t.options.values(t, a)); + var q = null; + "number" != t.type && (q = r.constructor === Array ? r : Object.keys(r)); + h = 40 > h ? -1 : h > n - 40 ? 1 : 0; + if ("number" == t.type) { + t.value += 0.1 * h * (t.options.step || 1), null != t.options.min && t.value < t.options.min && (t.value = t.options.min), null != t.options.max && t.value > t.options.max && (t.value = t.options.max); + } else { + if (h) { + l = -1, l = r.constructor === Object ? q.indexOf(String(t.value)) + h : q.indexOf(t.value) + h, l >= q.length && (l = q.length - 1), 0 > l && (l = 0), t.value = r.constructor === Array ? r[l] : l; + } else { + var u = r != q ? Object.values(r) : r; + new e.ContextMenu(u, {scale:Math.max(1, this.ds.scale), event:d, className:"dark", callback:function(a, b, d) { + r != q && (a = u.indexOf(a)); + this.value = a; + f(this, a); + p.dirty_canvas = !0; + return !1; + }.bind(t)}, l); + } + } + } else { + "mouseup" == d.type && "number" == t.type && (h = 40 > h ? -1 : h > n - 40 ? 1 : 0, 200 > d.click_time && 0 == h && this.prompt("Value", t.value, function(a) { + this.value = Number(a); + f(this, this.value); + }.bind(t), d)); + } + } + c != t.value && setTimeout(function() { + f(this, this.value); + }.bind(t), 20); + this.dirty_canvas = !0; + break; + case "toggle": + "mousedown" == d.type && (t.value = !t.value, setTimeout(function() { + f(t, t.value); + }, 20)); + break; + case "string": + case "text": + "mousedown" == d.type && this.prompt("Value", t.value, function(a) { + this.value = a; + f(this, a); + }.bind(t), d); + break; + default: + t.mouse && (this.dirty_canvas = t.mouse(d, [h, k], a)); + } + return t; } - return r; } } return null; @@ -4391,7 +4394,7 @@ $jscomp.polyfill("Object.values", function(w) { b.globalAlpha = 0.5 * this.editor_alpha; for (var d = 0; d < a.length; ++d) { var h = a[d]; - if (v(this.visible_area, h._bounding)) { + if (w(this.visible_area, h._bounding)) { b.fillStyle = h.color || "#335"; b.strokeStyle = h.color || "#335"; var f = h._pos, c = h._size; @@ -4481,8 +4484,8 @@ $jscomp.polyfill("Object.values", function(w) { var k = l.active_canvas, n = k.getCanvasWindow(); a = e.getNodeTypesCategories(k.filter); b = []; - for (var q in a) { - a[q] && b.push({value:a[q], content:a[q], has_submenu:!0}); + for (var p in a) { + a[p] && b.push({value:a[p], content:a[p], has_submenu:!0}); } var g = new e.ContextMenu(b, {event:d, callback:function(a, b, d) { a = e.getNodeTypesInCategory(a.value, k.filter); @@ -4508,12 +4511,12 @@ $jscomp.polyfill("Object.values", function(w) { var k = []; if (b) { for (var n in b) { - var q = b[n]; - if (q) { - var g = q[0]; - q[2] && q[2].label && (g = q[2].label); - g = {content:g, value:q}; - q[1] == e.ACTION && (g.className = "event"); + var p = b[n]; + if (p) { + var g = p[0]; + p[2] && p[2].label && (g = p[2].label); + g = {content:g, value:p}; + p[1] == e.ACTION && (g.className = "event"); k.push(g); } else { k.push(null); @@ -4550,8 +4553,8 @@ $jscomp.polyfill("Object.values", function(w) { f.onGetOutputs && (b = f.onGetOutputs()); var n = []; if (b) { - for (var q in b) { - var g = b[q]; + for (var p in b) { + var g = b[p]; if (!g) { n.push(null); } else { @@ -4634,9 +4637,9 @@ $jscomp.polyfill("Object.values", function(w) { })); b = l.active_canvas.canvas; d = b.getBoundingClientRect(); - var q = c = -20; - d && (c -= d.left, q -= d.top); - event ? (k.style.left = event.clientX + c + "px", k.style.top = event.clientY + q + "px") : (k.style.left = 0.5 * b.width + c + "px", k.style.top = 0.5 * b.height + q + "px"); + var p = c = -20; + d && (c -= d.left, p -= d.top); + event ? (k.style.left = event.clientX + c + "px", k.style.top = event.clientY + p + "px") : (k.style.left = 0.5 * b.width + c + "px", k.style.top = 0.5 * b.height + p + "px"); k.querySelector("button").addEventListener("click", h); b.parentNode.appendChild(k); }; @@ -4680,9 +4683,9 @@ $jscomp.polyfill("Object.values", function(w) { }); a = l.active_canvas.canvas; b = a.getBoundingClientRect(); - var n = -20, q = -20; - b && (n -= b.left, q -= b.top); - c ? (e.style.left = c.clientX + n + "px", e.style.top = c.clientY + q + "px") : (e.style.left = 0.5 * a.width + n + "px", e.style.top = 0.5 * a.height + q + "px"); + var n = -20, p = -20; + b && (n -= b.left, p -= b.top); + c ? (e.style.left = c.clientX + n + "px", e.style.top = c.clientY + p + "px") : (e.style.left = 0.5 * a.width + n + "px", e.style.top = 0.5 * a.height + p + "px"); a.parentNode.appendChild(e); setTimeout(function() { k.focus(); @@ -4725,15 +4728,15 @@ $jscomp.polyfill("Object.values", function(w) { g.close(); } function d(a) { - var b = t; - t && t.classList.remove("selected"); - t ? (t = a ? t.nextSibling : t.previousSibling) || (t = b) : t = a ? p.childNodes[0] : p.childNodes[p.childNodes.length]; - t && (t.classList.add("selected"), t.scrollIntoView({block:"end", behavior:"smooth"})); + var b = u; + u && u.classList.remove("selected"); + u ? (u = a ? u.nextSibling : u.previousSibling) || (u = b) : u = a ? r.childNodes[0] : r.childNodes[r.childNodes.length]; + u && (u.classList.add("selected"), u.scrollIntoView({block:"end", behavior:"smooth"})); } function c() { function a(a, d) { var f = document.createElement("div"); - r || (r = a); + t || (t = a); f.innerText = a; f.dataset.type = escape(a); f.className = "litegraph lite-search-item"; @@ -4741,15 +4744,15 @@ $jscomp.polyfill("Object.values", function(w) { f.addEventListener("click", function(a) { b(unescape(this.dataset.type)); }); - p.appendChild(f); + r.appendChild(f); } - u = null; + q = null; var d = C.value; - r = null; - p.innerHTML = ""; + t = null; + r.innerHTML = ""; if (d) { if (f.onSearchBox) { - var c = f.onSearchBox(p, d, k); + var c = f.onSearchBox(r, d, k); if (c) { for (var h = 0; h < c.length; ++h) { a(c[h]); @@ -4758,16 +4761,16 @@ $jscomp.polyfill("Object.values", function(w) { } else { c = function(a) { var b = e.registered_node_types[a]; - return q && b.filter != q ? !1 : -1 !== a.toLowerCase().indexOf(d); + return p && b.filter != p ? !1 : -1 !== a.toLowerCase().indexOf(d); }; var n = 0; d = d.toLowerCase(); - var q = k.filter || k.graph.filter; + var p = k.filter || k.graph.filter; for (h in e.searchbox_extras) { var g = e.searchbox_extras[h]; if (-1 !== g.desc.toLowerCase().indexOf(d)) { - var m = e.registered_node_types[g.type]; - if (!m || !m.filter || m.filter == q) { + var x = e.registered_node_types[g.type]; + if (!x || !x.filter || x.filter == p) { if (a(g.desc, "searchbox_extra"), -1 !== l.search_limit && n++ > l.search_limit) { break; } @@ -4787,13 +4790,13 @@ $jscomp.polyfill("Object.values", function(w) { } } } - var f = this, k = l.active_canvas, n = k.canvas, q = n.ownerDocument || document, g = document.createElement("div"); + var f = this, k = l.active_canvas, n = k.canvas, p = n.ownerDocument || document, g = document.createElement("div"); g.className = "litegraph litesearchbox graphdialog rounded"; g.innerHTML = "Search
"; g.close = function() { f.search_box = null; - q.body.focus(); - q.body.style.overflow = ""; + p.body.focus(); + p.body.style.overflow = ""; setTimeout(function() { f.canvas.focus(); }, 20); @@ -4811,7 +4814,7 @@ $jscomp.polyfill("Object.values", function(w) { }); f.search_box && f.search_box.close(); f.search_box = g; - var p = g.querySelector(".helper"), r = null, u = null, t = null, C = g.querySelector("input"); + var r = g.querySelector(".helper"), t = null, q = null, u = null, C = g.querySelector("input"); C && (C.addEventListener("blur", function(a) { this.focus(); }), C.addEventListener("keydown", function(a) { @@ -4825,10 +4828,10 @@ $jscomp.polyfill("Object.values", function(w) { g.close(); } else { if (13 == a.keyCode) { - t ? b(t.innerHTML) : r ? b(r) : g.close(); + u ? b(u.innerHTML) : t ? b(t) : g.close(); } else { - u && clearInterval(u); - u = setTimeout(c, 10); + q && clearInterval(q); + q = setTimeout(c, 10); return; } } @@ -4839,18 +4842,18 @@ $jscomp.polyfill("Object.values", function(w) { a.stopImmediatePropagation(); return !0; })); - q.fullscreenElement ? q.fullscreenElement.appendChild(g) : (q.body.appendChild(g), q.body.style.overflow = "hidden"); + p.fullscreenElement ? p.fullscreenElement.appendChild(g) : (p.body.appendChild(g), p.body.style.overflow = "hidden"); n = n.getBoundingClientRect(); - var v = (a ? a.clientY : n.top + 0.5 * n.height) - 20; + var w = (a ? a.clientY : n.top + 0.5 * n.height) - 20; g.style.left = (a ? a.clientX : n.left + 0.5 * n.width) - 80 + "px"; - g.style.top = v + "px"; - a.layerY > n.height - 200 && (p.style.maxHeight = n.height - a.layerY - 20 + "px"); + g.style.top = w + "px"; + a.layerY > n.height - 200 && (r.style.maxHeight = n.height - a.layerY - 20 + "px"); C.focus(); return g; }; l.prototype.showEditPropertyValue = function(a, b, d) { function c() { - f(r.value); + f(t.value); } function f(f) { "number" == typeof a.properties[b] && (f = Number(f)); @@ -4876,9 +4879,9 @@ $jscomp.polyfill("Object.values", function(w) { } else { if ("enum" == k && e.values) { n = ""; } else { @@ -4892,20 +4895,20 @@ $jscomp.polyfill("Object.values", function(w) { } var l = this.createDialog("" + b + "" + n + "", d); if ("enum" == k && e.values) { - var r = l.querySelector("select"); - r.addEventListener("change", function(a) { + var t = l.querySelector("select"); + t.addEventListener("change", function(a) { f(a.target.value); }); } else { if ("boolean" == k) { - (r = l.querySelector("input")) && r.addEventListener("click", function(a) { - f(!!r.checked); + (t = l.querySelector("input")) && t.addEventListener("click", function(a) { + f(!!t.checked); }); } else { - if (r = l.querySelector("input")) { - r.addEventListener("blur", function(a) { + if (t = l.querySelector("input")) { + t.addEventListener("blur", function(a) { this.focus(); - }), g = void 0 !== a.properties[b] ? a.properties[b] : "", g = JSON.stringify(g), r.value = g, r.addEventListener("keydown", function(a) { + }), g = void 0 !== a.properties[b] ? a.properties[b] : "", g = JSON.stringify(g), t.value = g, t.addEventListener("keydown", function(a) { 13 == a.keyCode && (c(), a.preventDefault(), a.stopPropagation()); }); } @@ -5085,7 +5088,7 @@ $jscomp.polyfill("Object.values", function(w) { e.isInsideBounding = function(a, b) { return a[0] < b[0][0] || a[1] < b[0][1] || a[0] > b[1][0] || a[1] > b[1][1] ? !1 : !0; }; - e.overlapBounding = v; + e.overlapBounding = w; e.hex2num = function(a) { "#" == a.charAt(0) && (a = a.slice(1)); a = a.toUpperCase(); @@ -5269,14 +5272,14 @@ $jscomp.polyfill("Object.values", function(w) { return -1; } b = b || 30; - for (var c = this.size[0] - 2 * this.margin, f = this.size[1] - 2 * this.margin, e = d.length, k = [0, 0], n = 1000000, q = -1, g = 0; g < e; ++g) { + for (var c = this.size[0] - 2 * this.margin, f = this.size[1] - 2 * this.margin, e = d.length, k = [0, 0], n = 1000000, p = -1, g = 0; g < e; ++g) { var l = d[g]; k[0] = l[0] * c; k[1] = (1.0 - l[1]) * f; l = vec2.distance(a, k); - l > n || l > b || (q = g, n = l); + l > n || l > b || (p = g, n = l); } - return q; + return p; }; e.CurveEditor = z; e.getParameterNames = function(a) { @@ -5290,12 +5293,12 @@ $jscomp.polyfill("Object.values", function(w) { }); })(this); "undefined" != typeof exports && (exports.LiteGraph = this.LiteGraph); -(function(w) { +(function(v) { function c() { this.addOutput("in ms", "number"); this.addOutput("in sec", "number"); } - function p() { + function q() { this.size = [140, 80]; this.properties = {enabled:!0}; this.enabled = !0; @@ -5354,7 +5357,7 @@ $jscomp.polyfill("Object.values", function(w) { this.widgets_up = !0; this.size = [180, 60]; } - function u() { + function r() { this.addOutput("value", "number"); this.addProperty("value", 1.0); this.widget = this.addWidget("number", "value", 1, "value"); @@ -5383,7 +5386,7 @@ $jscomp.polyfill("Object.values", function(w) { this.widget = this.addWidget("text", "url", "", "url"); this._data = null; } - function v() { + function w() { this.addOutput("", ""); this.addProperty("value", ""); this.widget = this.addWidget("text", "json", "", "value"); @@ -5428,7 +5431,7 @@ $jscomp.polyfill("Object.values", function(w) { this.addOutput("keys", "array"); this.size = [140, 30]; } - function t() { + function u() { this.addInput("A", "object"); this.addInput("B", "object"); this.addOutput("", "object"); @@ -5457,7 +5460,7 @@ $jscomp.polyfill("Object.values", function(w) { a.value && a.downloadAsFile(); }); } - function q() { + function p() { this.size = [60, 30]; this.addInput("value", 0, {label:""}); this.value = 0; @@ -5494,7 +5497,7 @@ $jscomp.polyfill("Object.values", function(w) { this._func = null; this.data = {}; } - var h = w.LiteGraph; + var h = v.LiteGraph; c.title = "Time"; c.desc = "Time"; c.prototype.onExecute = function() { @@ -5502,13 +5505,13 @@ $jscomp.polyfill("Object.values", function(w) { this.setOutputData(1, this.graph.globaltime); }; h.registerNodeType("basic/time", c); - p.title = "Subgraph"; - p.desc = "Graph inside a node"; - p.title_color = "#334"; - p.prototype.onGetInputs = function() { + q.title = "Subgraph"; + q.desc = "Graph inside a node"; + q.title_color = "#334"; + q.prototype.onGetInputs = function() { return [["enabled", "boolean"]]; }; - p.prototype.onDrawTitle = function(a) { + q.prototype.onDrawTitle = function(a) { if (!this.flags.collapsed) { a.fillStyle = "#555"; var b = h.NODE_TITLE_HEIGHT, d = this.size[0] - b; @@ -5521,13 +5524,13 @@ $jscomp.polyfill("Object.values", function(w) { a.fill(); } }; - p.prototype.onDblClick = function(a, b, d) { + q.prototype.onDblClick = function(a, b, d) { var f = this; setTimeout(function() { d.openSubgraph(f.subgraph); }, 10); }; - p.prototype.onMouseDown = function(a, b, d) { + q.prototype.onMouseDown = function(a, b, d) { if (!this.flags.collapsed && b[0] > this.size[0] - h.NODE_TITLE_HEIGHT && 0 > b[1]) { var f = this; setTimeout(function() { @@ -5535,10 +5538,10 @@ $jscomp.polyfill("Object.values", function(w) { }, 10); } }; - p.prototype.onAction = function(a, b) { + q.prototype.onAction = function(a, b) { this.subgraph.onAction(a, b); }; - p.prototype.onExecute = function() { + q.prototype.onExecute = function() { if (this.enabled = this.getInputOrProperty("enabled")) { if (this.inputs) { for (var a = 0; a < this.inputs.length; a++) { @@ -5554,58 +5557,58 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - p.prototype.sendEventToAllNodes = function(a, b, d) { + q.prototype.sendEventToAllNodes = function(a, b, d) { this.enabled && this.subgraph.sendEventToAllNodes(a, b, d); }; - p.prototype.onSubgraphTrigger = function(a, b) { + q.prototype.onSubgraphTrigger = function(a, b) { a = this.findOutputSlot(a); -1 != a && this.triggerSlot(a); }; - p.prototype.onSubgraphNewInput = function(a, b) { + q.prototype.onSubgraphNewInput = function(a, b) { -1 == this.findInputSlot(a) && this.addInput(a, b); }; - p.prototype.onSubgraphRenamedInput = function(a, b) { + q.prototype.onSubgraphRenamedInput = function(a, b) { a = this.findInputSlot(a); -1 != a && (this.getInputInfo(a).name = b); }; - p.prototype.onSubgraphTypeChangeInput = function(a, b) { + q.prototype.onSubgraphTypeChangeInput = function(a, b) { a = this.findInputSlot(a); -1 != a && (this.getInputInfo(a).type = b); }; - p.prototype.onSubgraphRemovedInput = function(a) { + q.prototype.onSubgraphRemovedInput = function(a) { a = this.findInputSlot(a); -1 != a && this.removeInput(a); }; - p.prototype.onSubgraphNewOutput = function(a, b) { + q.prototype.onSubgraphNewOutput = function(a, b) { -1 == this.findOutputSlot(a) && this.addOutput(a, b); }; - p.prototype.onSubgraphRenamedOutput = function(a, b) { + q.prototype.onSubgraphRenamedOutput = function(a, b) { a = this.findOutputSlot(a); -1 != a && (this.getOutputInfo(a).name = b); }; - p.prototype.onSubgraphTypeChangeOutput = function(a, b) { + q.prototype.onSubgraphTypeChangeOutput = function(a, b) { a = this.findOutputSlot(a); -1 != a && (this.getOutputInfo(a).type = b); }; - p.prototype.onSubgraphRemovedOutput = function(a) { + q.prototype.onSubgraphRemovedOutput = function(a) { a = this.findInputSlot(a); -1 != a && this.removeOutput(a); }; - p.prototype.getExtraMenuOptions = function(a) { + q.prototype.getExtraMenuOptions = function(a) { var b = this; return [{content:"Open", callback:function() { a.openSubgraph(b.subgraph); }}]; }; - p.prototype.onResize = function(a) { + q.prototype.onResize = function(a) { a[1] += 20; }; - p.prototype.serialize = function() { + q.prototype.serialize = function() { var a = h.LGraphNode.prototype.serialize.call(this); a.subgraph = this.subgraph.serialize(); return a; }; - p.prototype.clone = function() { + q.prototype.clone = function() { var a = h.createNode(this.type), b = this.serialize(); delete b.id; delete b.inputs; @@ -5613,8 +5616,8 @@ $jscomp.polyfill("Object.values", function(w) { a.configure(b); return a; }; - h.Subgraph = p; - h.registerNodeType("graph/subgraph", p); + h.Subgraph = q; + h.registerNodeType("graph/subgraph", q); m.title = "Input"; m.desc = "Input of the graph"; m.prototype.onConfigure = function() { @@ -5670,28 +5673,28 @@ $jscomp.polyfill("Object.values", function(w) { }; h.GraphOutput = g; h.registerNodeType("graph/output", g); - u.title = "Const Number"; - u.desc = "Constant number"; - u.prototype.onExecute = function() { + r.title = "Const Number"; + r.desc = "Constant number"; + r.prototype.onExecute = function() { this.setOutputData(0, parseFloat(this.properties.value)); }; - u.prototype.getTitle = function() { + r.prototype.getTitle = function() { return this.flags.collapsed ? this.properties.value : this.title; }; - u.prototype.setValue = function(a) { + r.prototype.setValue = function(a) { this.setProperty("value", a); }; - u.prototype.onDrawBackground = function(a) { + r.prototype.onDrawBackground = function(a) { this.outputs[0].label = this.properties.value.toFixed(3); }; - h.registerNodeType("basic/const", u); + h.registerNodeType("basic/const", r); l.title = "Const Boolean"; l.desc = "Constant boolean"; - l.prototype.getTitle = u.prototype.getTitle; + l.prototype.getTitle = r.prototype.getTitle; l.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); }; - l.prototype.setValue = u.prototype.setValue; + l.prototype.setValue = r.prototype.setValue; l.prototype.onGetInputs = function() { return [["toggle", h.ACTION]]; }; @@ -5701,11 +5704,11 @@ $jscomp.polyfill("Object.values", function(w) { h.registerNodeType("basic/boolean", l); B.title = "Const String"; B.desc = "Constant string"; - B.prototype.getTitle = u.prototype.getTitle; + B.prototype.getTitle = r.prototype.getTitle; B.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); }; - B.prototype.setValue = u.prototype.setValue; + B.prototype.setValue = r.prototype.setValue; B.prototype.onDropFile = function(a) { var b = this, d = new FileReader; d.onload = function(a) { @@ -5725,7 +5728,7 @@ $jscomp.polyfill("Object.values", function(w) { !a || a == this._url && this._type == this.properties.type || this.fetchFile(a); this.setOutputData(0, this._data); }; - y.prototype.setValue = u.prototype.setValue; + y.prototype.setValue = r.prototype.setValue; y.prototype.fetchFile = function(a) { var b = this; a && a.constructor === String ? (this._url = a, this._type = this.properties.type, "http" == a.substr(0, 4) && h.proxy && (a = h.proxy + a.substr(a.indexOf(":") + 3)), fetch(a).then(function(a) { @@ -5778,9 +5781,9 @@ $jscomp.polyfill("Object.values", function(w) { } }; h.registerNodeType("basic/file", y); - v.title = "Const Data"; - v.desc = "Constant Data"; - v.prototype.onPropertyChanged = function(a, b) { + w.title = "Const Data"; + w.desc = "Constant Data"; + w.prototype.onPropertyChanged = function(a, b) { this.widget.value = b; if (null != b && "" != b) { try { @@ -5790,11 +5793,11 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - v.prototype.onExecute = function() { + w.prototype.onExecute = function() { this.setOutputData(0, this._value); }; - v.prototype.setValue = u.prototype.setValue; - h.registerNodeType("basic/data", v); + w.prototype.setValue = r.prototype.setValue; + h.registerNodeType("basic/data", w); E.title = "Const Array"; E.desc = "Constant Array"; E.prototype.onPropertyChanged = function(a, b) { @@ -5818,7 +5821,7 @@ $jscomp.polyfill("Object.values", function(w) { } this.setOutputData(0, this._value); }; - E.prototype.setValue = u.prototype.setValue; + E.prototype.setValue = r.prototype.setValue; h.registerNodeType("basic/array", E); z.title = "Array[i]"; z.desc = "Returns an element from an array"; @@ -5861,9 +5864,9 @@ $jscomp.polyfill("Object.values", function(w) { null != a && this.setOutputData(0, Object.keys(a)); }; h.registerNodeType("basic/object_keys", D); - t.title = "Merge Objects"; - t.desc = "Creates an object copying properties from others"; - t.prototype.onExecute = function() { + u.title = "Merge Objects"; + u.desc = "Creates an object copying properties from others"; + u.prototype.onExecute = function() { var a = this.getInputData(0), b = this.getInputData(1), d = this._result; if (a) { for (var c in a) { @@ -5877,13 +5880,13 @@ $jscomp.polyfill("Object.values", function(w) { } this.setOutputData(0, d); }; - h.registerNodeType("basic/merge_objects", t); + h.registerNodeType("basic/merge_objects", u); G.title = "Variable"; G.desc = "store/read variable value"; G.prototype.onExecute = function() { this.value = this.getInputData(0); this.graph && (this.graph.vars[this.properties.varname] = this.value); - this.properties.global && (w[this.properties.varname] = this.value); + this.properties.global && (v[this.properties.varname] = this.value); this.setOutputData(0, this.value); }; G.prototype.getTitle = function() { @@ -5926,15 +5929,15 @@ $jscomp.polyfill("Object.values", function(w) { return this.flags.collapsed ? this.properties.filename : this.title; }; h.registerNodeType("basic/download", n); - q.title = "Watch"; - q.desc = "Show value of input"; - q.prototype.onExecute = function() { + p.title = "Watch"; + p.desc = "Show value of input"; + p.prototype.onExecute = function() { this.inputs[0] && (this.value = this.getInputData(0)); }; - q.prototype.getTitle = function() { + p.prototype.getTitle = function() { return this.flags.collapsed ? this.inputs[0].label : this.title; }; - q.toString = function(a) { + p.toString = function(a) { if (null == a) { return "null"; } @@ -5943,16 +5946,16 @@ $jscomp.polyfill("Object.values", function(w) { } if (a.constructor === Array) { for (var b = "[", d = 0; d < a.length; ++d) { - b += q.toString(a[d]) + (d + 1 != a.length ? "," : ""); + b += p.toString(a[d]) + (d + 1 != a.length ? "," : ""); } return b + "]"; } return String(a); }; - q.prototype.onDrawBackground = function(a) { - this.inputs[0].label = q.toString(this.value); + p.prototype.onDrawBackground = function(a) { + this.inputs[0].label = p.toString(this.value); }; - h.registerNodeType("basic/watch", q); + h.registerNodeType("basic/watch", p); k.title = "Cast"; k.desc = "Allows to connect different types"; k.prototype.onExecute = function() { @@ -6028,68 +6031,68 @@ $jscomp.polyfill("Object.values", function(w) { }; h.registerNodeType("basic/script", d); })(this); -(function(w) { +(function(v) { function c() { this.size = [60, 30]; - this.addInput("event", v.ACTION); + this.addInput("event", w.ACTION); } - function p() { + function q() { this.size = [60, 30]; this.addInput("if", ""); - this.addOutput("true", v.EVENT); - this.addOutput("change", v.EVENT); - this.addOutput("false", v.EVENT); + this.addOutput("true", w.EVENT); + this.addOutput("change", w.EVENT); + this.addOutput("false", w.EVENT); this.properties = {only_on_change:!0}; this.prev = 0; } function m() { - this.addInput("", v.ACTION); - this.addInput("", v.ACTION); - this.addInput("", v.ACTION); - this.addInput("", v.ACTION); - this.addInput("", v.ACTION); - this.addInput("", v.ACTION); - this.addOutput("", v.EVENT); - this.addOutput("", v.EVENT); - this.addOutput("", v.EVENT); - this.addOutput("", v.EVENT); - this.addOutput("", v.EVENT); - this.addOutput("", v.EVENT); + this.addInput("", w.ACTION); + this.addInput("", w.ACTION); + this.addInput("", w.ACTION); + this.addInput("", w.ACTION); + this.addInput("", w.ACTION); + this.addInput("", w.ACTION); + this.addOutput("", w.EVENT); + this.addOutput("", w.EVENT); + this.addOutput("", w.EVENT); + this.addOutput("", w.EVENT); + this.addOutput("", w.EVENT); + this.addOutput("", w.EVENT); this.size = [120, 30]; this.flags = {horizontal:!0, render_box:!1}; } function g() { this.size = [60, 30]; - this.addInput("event", v.ACTION); - this.addOutput("event", v.EVENT); + this.addInput("event", w.ACTION); + this.addOutput("event", w.EVENT); this.properties = {equal_to:"", has_property:"", property_equal_to:""}; } - function u() { - this.addInput("inc", v.ACTION); - this.addInput("dec", v.ACTION); - this.addInput("reset", v.ACTION); - this.addOutput("change", v.EVENT); + function r() { + this.addInput("inc", w.ACTION); + this.addInput("dec", w.ACTION); + this.addInput("reset", w.ACTION); + this.addOutput("change", w.EVENT); this.addOutput("num", "number"); this.num = 0; } function l() { this.size = [60, 30]; this.addProperty("time_in_ms", 1000); - this.addInput("event", v.ACTION); - this.addOutput("on_time", v.EVENT); + this.addInput("event", w.ACTION); + this.addOutput("on_time", w.EVENT); this._pending = []; } function B() { this.addProperty("interval", 1000); this.addProperty("event", "tick"); - this.addOutput("on_tick", v.EVENT); + this.addOutput("on_tick", w.EVENT); this.time = 0; this.last_interval = 1000; this.triggered = !1; } function y() { this.addInput("data", ""); - this.addInput("assign", v.ACTION); + this.addInput("assign", w.ACTION); this.addOutput("data", ""); this._last_value = null; this.properties = {data:null, serialize:!0}; @@ -6098,16 +6101,16 @@ $jscomp.polyfill("Object.values", function(w) { c.properties.data = c._last_value; }); } - var v = w.LiteGraph; + var w = v.LiteGraph; c.title = "Log Event"; c.desc = "Log event in console"; c.prototype.onAction = function(c, g) { console.log(c, g); }; - v.registerNodeType("events/log", c); - p.title = "TriggerEvent"; - p.desc = "Triggers event if input evaluates to true"; - p.prototype.onExecute = function(c, g) { + w.registerNodeType("events/log", c); + q.title = "TriggerEvent"; + q.desc = "Triggers event if input evaluates to true"; + q.prototype.onExecute = function(c, g) { c = this.getInputData(0); var e = c != this.prev; 0 === this.prev && (e = !1); @@ -6117,7 +6120,7 @@ $jscomp.polyfill("Object.values", function(w) { e && this.triggerSlot(1, g); this.prev = c; }; - v.registerNodeType("events/trigger", p); + w.registerNodeType("events/trigger", q); m.title = "Sequencer"; m.desc = "Trigger events when an event arrives"; m.prototype.getTitle = function() { @@ -6130,7 +6133,7 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - v.registerNodeType("events/sequencer", m); + w.registerNodeType("events/sequencer", m); g.title = "Filter Event"; g.desc = "Blocks events that do not match the filter"; g.prototype.onAction = function(c, g) { @@ -6141,24 +6144,24 @@ $jscomp.polyfill("Object.values", function(w) { this.triggerSlot(0, g); } }; - v.registerNodeType("events/filter", g); - u.title = "Counter"; - u.desc = "Counts events"; - u.prototype.getTitle = function() { + w.registerNodeType("events/filter", g); + r.title = "Counter"; + r.desc = "Counts events"; + r.prototype.getTitle = function() { return this.flags.collapsed ? String(this.num) : this.title; }; - u.prototype.onAction = function(c, g) { + r.prototype.onAction = function(c, g) { g = this.num; "inc" == c ? this.num += 1 : "dec" == c ? --this.num : "reset" == c && (this.num = 0); this.num != g && this.trigger("change", this.num); }; - u.prototype.onDrawBackground = function(c) { + r.prototype.onDrawBackground = function(c) { this.flags.collapsed || (c.fillStyle = "#AAA", c.font = "20px Arial", c.textAlign = "center", c.fillText(this.num, 0.5 * this.size[0], 0.5 * this.size[1])); }; - u.prototype.onExecute = function() { + r.prototype.onExecute = function() { this.setOutputData(1, this.num); }; - v.registerNodeType("events/counter", u); + w.registerNodeType("events/counter", r); l.title = "Delay"; l.desc = "Delays one event"; l.prototype.onAction = function(c, g) { @@ -6175,9 +6178,9 @@ $jscomp.polyfill("Object.values", function(w) { } }; l.prototype.onGetInputs = function() { - return [["event", v.ACTION], ["time_in_ms", "number"]]; + return [["event", w.ACTION], ["time_in_ms", "number"]]; }; - v.registerNodeType("events/delay", l); + w.registerNodeType("events/delay", l); B.title = "Timer"; B.desc = "Sends an event every N milliseconds"; B.prototype.onStart = function() { @@ -6204,7 +6207,7 @@ $jscomp.polyfill("Object.values", function(w) { B.prototype.onGetOutputs = function() { return [["tick", "boolean"]]; }; - v.registerNodeType("events/timer", B); + w.registerNodeType("events/timer", B); y.title = "Data Store"; y.desc = "Stores data and only changes when event is received"; y.prototype.onExecute = function() { @@ -6217,9 +6220,9 @@ $jscomp.polyfill("Object.values", function(w) { y.prototype.onSerialize = function(c) { null != c.data && (0 == this.properties.serialize || c.data.constructor !== String && c.data.constructor !== Number && c.data.constructor !== Boolean && c.data.constructor !== Array && c.data.constructor !== Object) && (c.data = null); }; - v.registerNodeType("basic/data_store", y); + w.registerNodeType("basic/data_store", y); })(this); -(function(w) { +(function(v) { function c() { this.addOutput("", z.EVENT); this.addOutput("", "boolean"); @@ -6229,7 +6232,7 @@ $jscomp.polyfill("Object.values", function(w) { this.size = [164, 84]; this.clicked = !1; } - function p() { + function q() { this.addInput("", "boolean"); this.addInput("e", z.ACTION); this.addOutput("v", "boolean"); @@ -6260,7 +6263,7 @@ $jscomp.polyfill("Object.values", function(w) { c.triggerSlot(1, e); }, {property:"value", values:this._values}); } - function u() { + function r() { this.addOutput("", "number"); this.size = [64, 84]; this.properties = {min:0, max:1, value:0.5, color:"#7AF", precision:2}; @@ -6287,7 +6290,7 @@ $jscomp.polyfill("Object.values", function(w) { this.addInput("", "number"); this.properties = {min:0, max:1, value:0, color:"#AAF"}; } - function v() { + function w() { this.addInputs("", 0); this.properties = {value:"...", font:"Arial", fontsize:18, color:"#AAA", align:"left", glowSize:0, decimals:1}; } @@ -6295,7 +6298,7 @@ $jscomp.polyfill("Object.values", function(w) { this.size = [200, 100]; this.properties = {borderColor:"#ffffff", bgcolorTop:"#f0f0f0", bgcolorBottom:"#e0e0e0", shadowSize:2, borderRadius:3}; } - var z = w.LiteGraph; + var z = v.LiteGraph; c.title = "Button"; c.desc = "Triggers an event"; c.font = "Arial"; @@ -6321,9 +6324,9 @@ $jscomp.polyfill("Object.values", function(w) { this.clicked = !1; }; z.registerNodeType("widget/button", c); - p.title = "Toggle"; - p.desc = "Toggles between true or false"; - p.prototype.onDrawForeground = function(c) { + q.title = "Toggle"; + q.desc = "Toggles between true or false"; + q.prototype.onDrawForeground = function(c) { if (!this.flags.collapsed) { var e = 0.5 * this.size[1], g = 0.8 * this.size[1]; c.font = this.properties.font || (0.8 * e).toFixed(0) + "px Arial"; @@ -6339,21 +6342,21 @@ $jscomp.polyfill("Object.values", function(w) { c.textAlign = "left"; } }; - p.prototype.onAction = function(c) { + q.prototype.onAction = function(c) { this.properties.value = !this.properties.value; this.trigger("e", this.properties.value); }; - p.prototype.onExecute = function() { + q.prototype.onExecute = function() { var c = this.getInputData(0); null != c && (this.properties.value = c); this.setOutputData(0, this.properties.value); }; - p.prototype.onMouseDown = function(c, g) { + q.prototype.onMouseDown = function(c, g) { if (1 < g[0] && 1 < g[1] && g[0] < this.size[0] - 2 && g[1] < this.size[1] - 2) { return this.properties.value = !this.properties.value, this.graph._version++, this.trigger("e", this.properties.value), !0; } }; - z.registerNodeType("widget/toggle", p); + z.registerNodeType("widget/toggle", q); m.title = "Number"; m.desc = "Widget to select number value"; m.pixels_threshold = 10; @@ -6408,10 +6411,10 @@ $jscomp.polyfill("Object.values", function(w) { "values" == c ? (this._values = g.split(";"), this.widget.options.values = this._values) : "value" == c && (this.widget.value = g); }; z.registerNodeType("widget/combo", g); - u.title = "Knob"; - u.desc = "Circular controller"; - u.size = [80, 100]; - u.prototype.onDrawForeground = function(c) { + r.title = "Knob"; + r.desc = "Circular controller"; + r.size = [80, 100]; + r.prototype.onDrawForeground = function(c) { if (!this.flags.collapsed) { -1 == this.value && (this.value = (this.properties.value - this.properties.min) / (this.properties.max - this.properties.min)); var e = 0.5 * this.size[0], g = 0.5 * this.size[1], l = 0.5 * Math.min(this.size[0], this.size[1]) - 5; @@ -6450,11 +6453,11 @@ $jscomp.polyfill("Object.values", function(w) { c.fillText(this.properties.value.toFixed(this.properties.precision), e, g + 0.15 * l); } }; - u.prototype.onExecute = function() { + r.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); this.boxcolor = z.colorToString([this.value, this.value, this.value]); }; - u.prototype.onMouseDown = function(c) { + r.prototype.onMouseDown = function(c) { this.center = [0.5 * this.size[0], 0.5 * this.size[1] + 20]; this.radius = 0.5 * this.size[0]; if (20 > c.canvasY - this.pos[1] || z.distance([c.canvasX, c.canvasY], [this.pos[0] + this.center[0], this.pos[1] + this.center[1]]) > this.radius) { @@ -6464,7 +6467,7 @@ $jscomp.polyfill("Object.values", function(w) { this.captureInput(!0); return !0; }; - u.prototype.onMouseMove = function(c) { + r.prototype.onMouseMove = function(c) { if (this.oldmouse) { c = [c.canvasX - this.pos[0], c.canvasY - this.pos[1]]; var e = this.value; @@ -6476,15 +6479,15 @@ $jscomp.polyfill("Object.values", function(w) { this.setDirtyCanvas(!0); } }; - u.prototype.onMouseUp = function(c) { + r.prototype.onMouseUp = function(c) { this.oldmouse && (this.oldmouse = null, this.captureInput(!1)); }; - u.prototype.onPropertyChanged = function(c, g) { + r.prototype.onPropertyChanged = function(c, g) { if ("min" == c || "max" == c || "value" == c) { return this.properties[c] = parseFloat(g), !0; } }; - z.registerNodeType("widget/knob", u); + z.registerNodeType("widget/knob", r); l.title = "Inner Slider"; l.prototype.onPropertyChanged = function(c, g) { "value" == c && (this.slider.value = g); @@ -6552,10 +6555,10 @@ $jscomp.polyfill("Object.values", function(w) { c.fillRect(2, 2, (this.size[0] - 4) * e, this.size[1] - 4); }; z.registerNodeType("widget/progress", y); - v.title = "Text"; - v.desc = "Shows the input value"; - v.widgets = [{name:"resize", text:"Resize box", type:"button"}, {name:"led_text", text:"LED", type:"minibutton"}, {name:"normal_text", text:"Normal", type:"minibutton"}]; - v.prototype.onDrawForeground = function(c) { + w.title = "Text"; + w.desc = "Shows the input value"; + w.widgets = [{name:"resize", text:"Resize box", type:"button"}, {name:"led_text", text:"LED", type:"minibutton"}, {name:"normal_text", text:"Normal", type:"minibutton"}]; + w.prototype.onDrawForeground = function(c) { c.fillStyle = this.properties.color; var e = this.properties.value; this.properties.glowSize ? (c.shadowColor = this.properties.color, c.shadowOffsetX = 0, c.shadowOffsetY = 0, c.shadowBlur = this.properties.glowSize) : c.shadowColor = "transparent"; @@ -6573,11 +6576,11 @@ $jscomp.polyfill("Object.values", function(w) { this.last_ctx = c; c.textAlign = "left"; }; - v.prototype.onExecute = function() { + w.prototype.onExecute = function() { var c = this.getInputData(0); null != c && (this.properties.value = c); }; - v.prototype.resize = function() { + w.prototype.resize = function() { if (this.last_ctx) { var c = this.str.split("\\n"); this.last_ctx.font = this.properties.fontsize + "px " + this.properties.font; @@ -6591,12 +6594,12 @@ $jscomp.polyfill("Object.values", function(w) { this.setDirtyCanvas(!0); } }; - v.prototype.onPropertyChanged = function(c, g) { + w.prototype.onPropertyChanged = function(c, g) { this.properties[c] = g; this.str = "number" == typeof g ? g.toFixed(3) : g; return !0; }; - z.registerNodeType("widget/text", v); + z.registerNodeType("widget/text", w); E.title = "Panel"; E.desc = "Non interactive panel"; E.widgets = [{name:"update", text:"Update", type:"button"}]; @@ -6609,11 +6612,11 @@ $jscomp.polyfill("Object.values", function(w) { }; z.registerNodeType("widget/panel", E); })(this); -(function(w) { +(function(v) { function c() { this.addOutput("left_x_axis", "number"); this.addOutput("left_y_axis", "number"); - this.addOutput("button_pressed", p.EVENT); + this.addOutput("button_pressed", q.EVENT); this.properties = {gamepad_index:0, threshold:0.1}; this._left_axis = new Float32Array(2); this._right_axis = new Float32Array(2); @@ -6621,7 +6624,7 @@ $jscomp.polyfill("Object.values", function(w) { this._previous_buttons = new Uint8Array(17); this._current_buttons = new Uint8Array(17); } - var p = w.LiteGraph; + var q = v.LiteGraph; c.title = "Gamepad"; c.desc = "gets the input of the gamepad"; c.CENTER = 0; @@ -6636,11 +6639,11 @@ $jscomp.polyfill("Object.values", function(w) { m && (this._left_axis[0] = Math.abs(m.xbox.axes.lx) > g ? m.xbox.axes.lx : 0, this._left_axis[1] = Math.abs(m.xbox.axes.ly) > g ? m.xbox.axes.ly : 0, this._right_axis[0] = Math.abs(m.xbox.axes.rx) > g ? m.xbox.axes.rx : 0, this._right_axis[1] = Math.abs(m.xbox.axes.ry) > g ? m.xbox.axes.ry : 0, this._triggers[0] = Math.abs(m.xbox.axes.ltrigger) > g ? m.xbox.axes.ltrigger : 0, this._triggers[1] = Math.abs(m.xbox.axes.rtrigger) > g ? m.xbox.axes.rtrigger : 0); if (this.outputs) { for (g = 0; g < this.outputs.length; g++) { - var p = this.outputs[g]; - if (p.links && p.links.length) { + var r = this.outputs[g]; + if (r.links && r.links.length) { var l = null; if (m) { - switch(p.name) { + switch(r.name) { case "left_axis": l = this._left_axis; break; @@ -6711,12 +6714,12 @@ $jscomp.polyfill("Object.values", function(w) { l = m.xbox.buttons.back ? 1 : 0; break; case "button_pressed": - for (p = 0; p < this._current_buttons.length; ++p) { - this._current_buttons[p] && !this._previous_buttons[p] && this.triggerSlot(g, c.buttons[p]); + for (r = 0; r < this._current_buttons.length; ++r) { + this._current_buttons[r] && !this._previous_buttons[r] && this.triggerSlot(g, c.buttons[r]); } } } else { - switch(p.name) { + switch(r.name) { case "button_pressed": break; case "left_axis": @@ -6754,25 +6757,25 @@ $jscomp.polyfill("Object.values", function(w) { g.axes.rtrigger = m.buttons[7].value; g.hat = ""; g.hatmap = c.CENTER; - for (var p = 0; p < m.buttons.length; p++) { - if (this._current_buttons[p] = m.buttons[p].pressed, 12 > p) { - g.buttons[c.mapping_array[p]] = m.buttons[p].pressed, m.buttons[p].was_pressed && this.trigger(c.mapping_array[p] + "_button_event"); + for (var r = 0; r < m.buttons.length; r++) { + if (this._current_buttons[r] = m.buttons[r].pressed, 12 > r) { + g.buttons[c.mapping_array[r]] = m.buttons[r].pressed, m.buttons[r].was_pressed && this.trigger(c.mapping_array[r] + "_button_event"); } else { - switch(p) { + switch(r) { case 12: - m.buttons[p].pressed && (g.hat += "up", g.hatmap |= c.UP); + m.buttons[r].pressed && (g.hat += "up", g.hatmap |= c.UP); break; case 13: - m.buttons[p].pressed && (g.hat += "down", g.hatmap |= c.DOWN); + m.buttons[r].pressed && (g.hat += "down", g.hatmap |= c.DOWN); break; case 14: - m.buttons[p].pressed && (g.hat += "left", g.hatmap |= c.LEFT); + m.buttons[r].pressed && (g.hat += "left", g.hatmap |= c.LEFT); break; case 15: - m.buttons[p].pressed && (g.hat += "right", g.hatmap |= c.RIGHT); + m.buttons[r].pressed && (g.hat += "right", g.hatmap |= c.RIGHT); break; case 16: - g.buttons.home = m.buttons[p].pressed; + g.buttons.home = m.buttons[r].pressed; } } } @@ -6796,17 +6799,17 @@ $jscomp.polyfill("Object.values", function(w) { } }; c.prototype.onGetOutputs = function() { - return [["left_axis", "vec2"], ["right_axis", "vec2"], ["left_x_axis", "number"], ["left_y_axis", "number"], ["right_x_axis", "number"], ["right_y_axis", "number"], ["trigger_left", "number"], ["trigger_right", "number"], ["a_button", "number"], ["b_button", "number"], ["x_button", "number"], ["y_button", "number"], ["lb_button", "number"], ["rb_button", "number"], ["ls_button", "number"], ["rs_button", "number"], ["start_button", "number"], ["back_button", "number"], ["a_button_event", p.EVENT], - ["b_button_event", p.EVENT], ["x_button_event", p.EVENT], ["y_button_event", p.EVENT], ["lb_button_event", p.EVENT], ["rb_button_event", p.EVENT], ["ls_button_event", p.EVENT], ["rs_button_event", p.EVENT], ["start_button_event", p.EVENT], ["back_button_event", p.EVENT], ["hat_left", "number"], ["hat_right", "number"], ["hat_up", "number"], ["hat_down", "number"], ["hat", "number"], ["button_pressed", p.EVENT]]; + return [["left_axis", "vec2"], ["right_axis", "vec2"], ["left_x_axis", "number"], ["left_y_axis", "number"], ["right_x_axis", "number"], ["right_y_axis", "number"], ["trigger_left", "number"], ["trigger_right", "number"], ["a_button", "number"], ["b_button", "number"], ["x_button", "number"], ["y_button", "number"], ["lb_button", "number"], ["rb_button", "number"], ["ls_button", "number"], ["rs_button", "number"], ["start_button", "number"], ["back_button", "number"], ["a_button_event", q.EVENT], + ["b_button_event", q.EVENT], ["x_button_event", q.EVENT], ["y_button_event", q.EVENT], ["lb_button_event", q.EVENT], ["rb_button_event", q.EVENT], ["ls_button_event", q.EVENT], ["rs_button_event", q.EVENT], ["start_button_event", q.EVENT], ["back_button_event", q.EVENT], ["hat_left", "number"], ["hat_right", "number"], ["hat_up", "number"], ["hat_down", "number"], ["hat", "number"], ["button_pressed", q.EVENT]]; }; - p.registerNodeType("input/gamepad", c); + q.registerNodeType("input/gamepad", c); })(this); -(function(w) { +(function(v) { function c() { this.addInput("in", "*"); this.size = [80, 30]; } - function p() { + function q() { this.addInput("in"); this.addOutput("out"); this.size = [80, 30]; @@ -6826,7 +6829,7 @@ $jscomp.polyfill("Object.values", function(w) { this.addProperty("out_max", 1); this.size = [120, 50]; } - function u() { + function r() { this.addOutput("value", "number"); this.addProperty("min", 0); this.addProperty("max", 1); @@ -6855,7 +6858,7 @@ $jscomp.polyfill("Object.values", function(w) { this.addProperty("min", 0); this.addProperty("max", 1); } - function v() { + function w() { this.properties = {f:0.5}; this.addInput("A", "number"); this.addInput("B", "number"); @@ -6888,7 +6891,7 @@ $jscomp.polyfill("Object.values", function(w) { this.size = [80, 30]; this.addProperty("factor", 1); } - function t() { + function u() { this.addInput("v", "boolean"); this.addInput("A"); this.addInput("B"); @@ -6909,13 +6912,13 @@ $jscomp.polyfill("Object.values", function(w) { this.size = [80, 30]; this._value = null; } - function q() { + function p() { this.addInput("A", "number"); this.addInput("B", "number"); this.addOutput("=", "number"); this.addProperty("A", 1); this.addProperty("B", 1); - this.addProperty("OP", "+", "enum", {values:q.values}); + this.addProperty("OP", "+", "enum", {values:p.values}); } function k() { this.addInput("A", "number"); @@ -6991,13 +6994,13 @@ $jscomp.polyfill("Object.values", function(w) { this.addOutput("z", "number"); this.addOutput("w", "number"); } - function L() { + function K() { this.addInputs([["x", "number"], ["y", "number"], ["z", "number"], ["w", "number"]]); this.addOutput("vec4", "vec4"); this.properties = {x:0, y:0, z:0, w:0}; this._data = new Float32Array(4); } - var A = w.LiteGraph; + var A = v.LiteGraph; c.title = "Converter"; c.desc = "type A to type B"; c.prototype.onExecute = function() { @@ -7042,13 +7045,13 @@ $jscomp.polyfill("Object.values", function(w) { return [["number", "number"], ["vec2", "vec2"], ["vec3", "vec3"], ["vec4", "vec4"]]; }; A.registerNodeType("math/converter", c); - p.title = "Bypass"; - p.desc = "removes the type"; - p.prototype.onExecute = function() { + q.title = "Bypass"; + q.desc = "removes the type"; + q.prototype.onExecute = function() { var a = this.getInputData(0); this.setOutputData(0, a); }; - A.registerNodeType("math/bypass", p); + A.registerNodeType("math/bypass", q); m.title = "to Number"; m.desc = "Cast to number"; m.prototype.onExecute = function() { @@ -7086,9 +7089,9 @@ $jscomp.polyfill("Object.values", function(w) { return [["in_min", "number"], ["in_max", "number"], ["out_min", "number"], ["out_max", "number"]]; }; A.registerNodeType("math/range", g); - u.title = "Rand"; - u.desc = "Random number"; - u.prototype.onExecute = function() { + r.title = "Rand"; + r.desc = "Random number"; + r.prototype.onExecute = function() { if (this.inputs) { for (var a = 0; a < this.inputs.length; a++) { var b = this.inputs[a], d = this.getInputData(a); @@ -7099,13 +7102,13 @@ $jscomp.polyfill("Object.values", function(w) { this._last_v = Math.random() * (this.properties.max - a) + a; this.setOutputData(0, this._last_v); }; - u.prototype.onDrawBackground = function(a) { + r.prototype.onDrawBackground = function(a) { this.outputs[0].label = (this._last_v || 0).toFixed(3); }; - u.prototype.onGetInputs = function() { + r.prototype.onGetInputs = function() { return [["min", "number"], ["max", "number"]]; }; - A.registerNodeType("math/rand", u); + A.registerNodeType("math/rand", r); l.title = "Noise"; l.desc = "Random number with temporal continuity"; l.data = null; @@ -7160,9 +7163,9 @@ $jscomp.polyfill("Object.values", function(w) { return a; }; A.registerNodeType("math/clamp", y); - v.title = "Lerp"; - v.desc = "Linear Interpolation"; - v.prototype.onExecute = function() { + w.title = "Lerp"; + w.desc = "Linear Interpolation"; + w.prototype.onExecute = function() { var a = this.getInputData(0); null == a && (a = 0); var b = this.getInputData(1); @@ -7171,10 +7174,10 @@ $jscomp.polyfill("Object.values", function(w) { void 0 !== c && (d = c); this.setOutputData(0, a * (1 - d) + b * d); }; - v.prototype.onGetInputs = function() { + w.prototype.onGetInputs = function() { return [["f", "number"]]; }; - A.registerNodeType("math/lerp", v); + A.registerNodeType("math/lerp", w); E.title = "Abs"; E.desc = "Absolute"; E.prototype.onExecute = function() { @@ -7214,13 +7217,13 @@ $jscomp.polyfill("Object.values", function(w) { null != a && this.setOutputData(0, a * this.properties.factor); }; A.registerNodeType("math/scale", D); - t.title = "Gate"; - t.desc = "if v is true, then outputs A, otherwise B"; - t.prototype.onExecute = function() { + u.title = "Gate"; + u.desc = "if v is true, then outputs A, otherwise B"; + u.prototype.onExecute = function() { var a = this.getInputData(0); this.setOutputData(0, this.getInputData(a ? 1 : 2)); }; - A.registerNodeType("math/gate", t); + A.registerNodeType("math/gate", u); G.title = "Average"; G.desc = "Average Filter"; G.prototype.onExecute = function() { @@ -7253,19 +7256,19 @@ $jscomp.polyfill("Object.values", function(w) { this.setOutputData(0, this._value); }; A.registerNodeType("math/tendTo", n); - q.values = "+ - * / % ^ max min".split(" "); - q.title = "Operation"; - q.desc = "Easy math operators"; - q["@OP"] = {type:"enum", title:"operation", values:q.values}; - q.size = [100, 60]; - q.prototype.getTitle = function() { + p.values = "+ - * / % ^ max min".split(" "); + p.title = "Operation"; + p.desc = "Easy math operators"; + p["@OP"] = {type:"enum", title:"operation", values:p.values}; + p.size = [100, 60]; + p.prototype.getTitle = function() { return "max" == this.properties.OP || "min" == this.properties.OP ? this.properties.OP + "(A,B)" : "A " + this.properties.OP + " B"; }; - q.prototype.setValue = function(a) { + p.prototype.setValue = function(a) { "string" == typeof a && (a = parseFloat(a)); this.properties.value = a; }; - q.prototype.onExecute = function() { + p.prototype.onExecute = function() { var a = this.getInputData(0), b = this.getInputData(1); null != a ? this.properties.A = a : a = this.properties.A; null != b ? this.properties.B = b : b = this.properties.B; @@ -7302,10 +7305,10 @@ $jscomp.polyfill("Object.values", function(w) { } this.setOutputData(0, d); }; - q.prototype.onDrawBackground = function(a) { + p.prototype.onDrawBackground = function(a) { this.flags.collapsed || (a.font = "40px Arial", a.fillStyle = "#666", a.textAlign = "center", a.fillText(this.properties.OP, 0.5 * this.size[0], 0.5 * (this.size[1] + A.NODE_TITLE_HEIGHT)), a.textAlign = "left"); }; - A.registerNodeType("math/operation", q); + A.registerNodeType("math/operation", p); A.registerSearchboxExtra("math/operation", "MAX", {properties:{OP:"max"}, title:"MAX()"}); A.registerSearchboxExtra("math/operation", "MIN", {properties:{OP:"min"}, title:"MIN()"}); k.title = "Compare"; @@ -7460,7 +7463,7 @@ $jscomp.polyfill("Object.values", function(w) { this._func && this._func_code == this.properties.formula || (this._func = new Function("x", "y", "TIME", "return " + this.properties.formula), this._func_code = this.properties.formula); var d = this._func(a, b, this.graph.globaltime); this.boxcolor = null; - } catch (M) { + } catch (N) { this.boxcolor = "red"; } this.setOutputData(0, d); @@ -7524,9 +7527,9 @@ $jscomp.polyfill("Object.values", function(w) { null != a && (this.setOutputData(0, a[0]), this.setOutputData(1, a[1]), this.setOutputData(2, a[2]), this.setOutputData(3, a[3])); }; A.registerNodeType("math3d/vec4-to-xyzw", J); - L.title = "XYZW->Vec4"; - L.desc = "components to vector4"; - L.prototype.onExecute = function() { + K.title = "XYZW->Vec4"; + K.desc = "components to vector4"; + K.prototype.onExecute = function() { var a = this.getInputData(0); null == a && (a = this.properties.x); var b = this.getInputData(1); @@ -7542,9 +7545,9 @@ $jscomp.polyfill("Object.values", function(w) { k[3] = c; this.setOutputData(0, k); }; - A.registerNodeType("math3d/xyzw-to-vec4", L); + A.registerNodeType("math3d/xyzw-to-vec4", K); })(this); -(function(w) { +(function(v) { function c() { this.addInput("sel", "number"); this.addInput("A"); @@ -7554,7 +7557,7 @@ $jscomp.polyfill("Object.values", function(w) { this.addOutput("out"); this.selected = 0; } - function p() { + function q() { this.properties = {sequence:"A,B,C"}; this.addInput("index", "number"); this.addInput("seq"); @@ -7562,7 +7565,7 @@ $jscomp.polyfill("Object.values", function(w) { this.index = 0; this.values = this.properties.sequence.split(","); } - var m = w.LiteGraph; + var m = v.LiteGraph; c.title = "Selector"; c.desc = "selects an output"; c.prototype.onDrawBackground = function(c) { @@ -7589,12 +7592,12 @@ $jscomp.polyfill("Object.values", function(w) { return [["E", 0], ["F", 0], ["G", 0], ["H", 0]]; }; m.registerNodeType("logic/selector", c); - p.title = "Sequence"; - p.desc = "select one element from a sequence from a string"; - p.prototype.onPropertyChanged = function(c, m) { + q.title = "Sequence"; + q.desc = "select one element from a sequence from a string"; + q.prototype.onPropertyChanged = function(c, m) { "sequence" == c && (this.values = m.split(",")); }; - p.prototype.onExecute = function() { + q.prototype.onExecute = function() { var c = this.getInputData(1); c && c != this.current_sequence && (this.values = c.split(","), this.current_sequence = c); c = this.getInputData(0); @@ -7602,16 +7605,16 @@ $jscomp.polyfill("Object.values", function(w) { this.index = c = Math.round(c) % this.values.length; this.setOutputData(0, this.values[c]); }; - m.registerNodeType("logic/sequence", p); + m.registerNodeType("logic/sequence", q); })(this); -(function(w) { +(function(v) { 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 p() { + function q() { this.addInput("Texture", "Texture"); this.properties = {flipY:!1}; this.size = [c.image_preview_size, c.image_preview_size]; @@ -7631,10 +7634,10 @@ $jscomp.polyfill("Object.values", function(w) { this.properties = {value:1, pixelcode:"color + colorB * value", uvcode:"", precision:c.DEFAULT}; this.has_error = !1; } - function u() { + function r() { 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 = u.pixel_shader; + this.properties.code = r.pixel_shader; this._uniforms = {u_value:1, u_color:vec4.create(), in_texture:0, texSize:vec2.create(), time:0}; } function l() { @@ -7657,7 +7660,7 @@ $jscomp.polyfill("Object.values", function(w) { this.properties = {additive:!1, antialiasing:!1, filter:!0, disable_alpha:!1, gamma:1.0, viewport:[0, 0, 1, 1]}; this.size[0] = 130; } - function v() { + function w() { this.addInput("Texture", "Texture"); this.addOutput("", "Texture"); this.properties = {size:0, generate_mipmaps:!1, precision:c.DEFAULT}; @@ -7696,13 +7699,13 @@ $jscomp.polyfill("Object.values", function(w) { this.addOutput("", "Texture"); this.properties = {}; } - function t() { + function u() { this.addInput("Texture", "Texture"); this.addInput("LUT", "Texture"); this.addInput("Intensity", "number"); this.addOutput("", "Texture"); this.properties = {enabled:!0, intensity:1, precision:c.DEFAULT, texture:null}; - t._shader || (t._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, t.pixel_shader)); + u._shader || (u._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, u.pixel_shader)); } function G() { this.addInput("Texture", "Texture"); @@ -7722,7 +7725,7 @@ $jscomp.polyfill("Object.values", function(w) { this._color = vec4.create(); this._uniforms = {u_textureR:0, u_textureG:1, u_textureB:2, u_textureA:3, u_color:this._color}; } - function q() { + function p() { this.addOutput("Texture", "Texture"); this._tex_color = vec4.create(); this.properties = {color:vec4.create(), precision:c.DEFAULT}; @@ -7795,7 +7798,7 @@ $jscomp.polyfill("Object.values", function(w) { this.boxcolor = "black"; this.version = 0; } - function L() { + function K() { this.addInput("in", "Texture"); this.addInput("f", "number"); this.addOutput("out", "Texture"); @@ -7818,31 +7821,31 @@ $jscomp.polyfill("Object.values", function(w) { this.curve_offset = 68; this.size = [240, 160]; } - function r() { + function t() { this.addInput("in", "Texture"); this.addInput("exp", "number"); this.addOutput("out", "Texture"); this.properties = {exposition:1, precision:c.LOW}; this._uniforms = {u_texture:0, u_exposition:1}; } - function K() { + function L() { this.addInput("in", "Texture"); this.addInput("avg", "number,Texture"); this.addOutput("out", "Texture"); this.properties = {enabled:!0, scale:1, gamma:1, average_lum:1, lum_white:1, precision:c.LOW}; this._uniforms = {u_texture:0, u_lumwhite2:1, u_igamma:1, u_scale:1, u_average_lum:1}; } - function N() { + function M() { this.addOutput("out", "Texture"); this.properties = {width:512, height:512, seed:0, persistence:0.1, octaves:8, scale:1, offset:[0, 0], amplitude:1, precision:c.DEFAULT}; this._key = 0; this._texture = null; this._uniforms = {u_persistence:0.1, u_seed:0, u_offset:vec2.create(), u_scale:1, u_viewport:vec2.create()}; } - function M() { + function N() { this.addInput("v"); this.addOutput("out", "Texture"); - this.properties = {code:M.default_code, width:512, height:512, clear:!0, precision:c.DEFAULT, use_html_canvas:!1}; + this.properties = {code:N.default_code, width:512, height:512, clear:!0, precision:c.DEFAULT, use_html_canvas:!1}; this._temp_texture = this._func = null; this.compileCode(); } @@ -7857,9 +7860,9 @@ $jscomp.polyfill("Object.values", function(w) { this.addOutput("out", "texture"); this.properties = {yaw:0}; } - var F = w.LiteGraph; - w.LGraphTexture = null; - "undefined" != typeof GL && (LGraphCanvas.link_type_colors.Texture = "#987", w.LGraphTexture = c, c.title = "Texture", c.desc = "Texture", c.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}, c.loadTextureCallback = null, c.image_preview_size = 256, c.PASS_THROUGH = 1, c.COPY = 2, c.LOW = 3, c.HIGH = 4, c.REUSE = 5, c.DEFAULT = 2, c.MODE_VALUES = {"pass through":c.PASS_THROUGH, copy:c.COPY, low:c.LOW, high:c.HIGH, reuse:c.REUSE, default:c.DEFAULT}, c.getTexturesContainer = function() { + var F = v.LiteGraph; + v.LGraphTexture = null; + "undefined" != typeof GL && (LGraphCanvas.link_type_colors.Texture = "#987", v.LGraphTexture = c, c.title = "Texture", c.desc = "Texture", c.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}, c.loadTextureCallback = null, c.image_preview_size = 256, c.PASS_THROUGH = 1, c.COPY = 2, c.LOW = 3, c.HIGH = 4, c.REUSE = 5, c.DEFAULT = 2, c.MODE_VALUES = {"pass through":c.PASS_THROUGH, copy:c.COPY, low:c.LOW, high:c.HIGH, reuse:c.REUSE, default:c.DEFAULT}, c.getTexturesContainer = function() { return gl.textures; }, c.loadTexture = function(a, b) { b = b || {}; @@ -7991,12 +7994,12 @@ $jscomp.polyfill("Object.values", function(w) { a = a.replace(/[\{\}]/g, ""); return b[a] || ""; }); - }, F.registerNodeType("texture/texture", c), p.title = "Preview", p.desc = "Show a texture in the graph canvas", p.allow_preview = !1, p.prototype.onDrawBackground = function(a) { - if (!this.flags.collapsed && (a.webgl || p.allow_preview)) { + }, F.registerNodeType("texture/texture", c), q.title = "Preview", q.desc = "Show a texture in the graph canvas", q.allow_preview = !1, q.prototype.onDrawBackground = function(a) { + if (!this.flags.collapsed && (a.webgl || q.allow_preview)) { var b = this.getInputData(0); b && (b = !b.handle && a.webgl ? b : c.generateLowResTexturePreview(b), a.save(), this.properties.flipY && (a.translate(0, this.size[1]), a.scale(1, -1)), a.drawImage(b, 0, 0, this.size[0], this.size[1]), a.restore()); } - }, F.registerNodeType("texture/preview", p), m.title = "Save", m.desc = "Save a texture in the repository", m.prototype.getPreviewTexture = function() { + }, F.registerNodeType("texture/preview", q), m.title = "Save", m.desc = "Save a texture in the repository", m.prototype.getPreviewTexture = function() { return this._texture; }, m.prototype.onExecute = function() { var a = this.getInputData(0); @@ -8042,8 +8045,8 @@ $jscomp.polyfill("Object.values", function(w) { this._shader_code = f + "|" + h; } if (this._shader) { - var q = this.getInputData(2); - null != q ? this.properties.value = q : q = parseFloat(this.properties.value); + var p = this.getInputData(2); + null != p ? this.properties.value = p : p = parseFloat(this.properties.value); var l = this.graph.getTime(); this._tex.drawTo(function() { gl.disable(gl.DEPTH_TEST); @@ -8052,7 +8055,7 @@ $jscomp.polyfill("Object.values", function(w) { a && a.bind(0); b && b.bind(1); var c = Mesh.getScreenQuad(); - e.uniforms({u_texture:0, u_textureB:1, value:q, texSize:[d, k], time:l}).draw(c); + e.uniforms({u_texture:0, u_textureB:1, value:p, texSize:[d, k], time:l}).draw(c); }); this.setOutputData(0, this._tex); } @@ -8070,7 +8073,7 @@ $jscomp.polyfill("Object.values", function(w) { var c = g.presets[d]; c && (b.setProperty("pixelcode", c), b.title = d, a.refresh()); }}); - }, F.registerNodeType("texture/operation", g), u.title = "Shader", u.desc = "Texture shader", u.widgets_info = {code:{type:"code", lang:"glsl"}, precision:{widget:"combo", values:c.MODE_VALUES}}, u.prototype.onPropertyChanged = function(a, b) { + }, F.registerNodeType("texture/operation", g), r.title = "Shader", r.desc = "Texture shader", r.widgets_info = {code:{type:"code", lang:"glsl"}, precision:{widget:"combo", values:c.MODE_VALUES}}, r.prototype.onPropertyChanged = function(a, b) { if ("code" == a && (a = this.getShader())) { b = a.uniformInfo; if (this.inputs) { @@ -8118,14 +8121,14 @@ $jscomp.polyfill("Object.values", function(w) { } } } - }, u.prototype.getShader = function() { + }, r.prototype.getShader = function() { if (this._shader && this._shader_code == this.properties.code) { return this._shader; } this._shader_code = this.properties.code; this._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, this.properties.code), this.boxcolor = "green"; return this._shader; - }, u.prototype.onExecute = function() { + }, r.prototype.onExecute = function() { if (this.isOutputConnected(0)) { var a = this.getShader(); if (a) { @@ -8154,7 +8157,7 @@ $jscomp.polyfill("Object.values", function(w) { this.setOutputData(0, this._tex); } } - }, u.pixel_shader = "precision highp float;\n\r\n\n\r\nvarying vec2 v_coord;\n\r\nuniform float time; //time in seconds\n\r\nuniform vec2 texSize; //tex resolution\n\r\nuniform float u_value;\n\r\nuniform vec4 u_color;\n\n\r\nvoid main() {\n\r\n\tvec2 uv = v_coord;\n\r\n\tvec3 color = vec3(0.0);\n\r\n\t//your code here\n\r\n\tcolor.xy=uv;\n\n\r\n\tgl_FragColor = vec4(color, 1.0);\n\r\n}\n\r\n", F.registerNodeType("texture/shader", u), l.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, + }, r.pixel_shader = "precision highp float;\n\r\n\n\r\nvarying vec2 v_coord;\n\r\nuniform float time; //time in seconds\n\r\nuniform vec2 texSize; //tex resolution\n\r\nuniform float u_value;\n\r\nuniform vec4 u_color;\n\n\r\nvoid main() {\n\r\n\tvec2 uv = v_coord;\n\r\n\tvec3 color = vec3(0.0);\n\r\n\t//your code here\n\r\n\tcolor.xy=uv;\n\n\r\n\tgl_FragColor = vec4(color, 1.0);\n\r\n}\n\r\n", F.registerNodeType("texture/shader", r), l.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, l.title = "Scale/Offset", l.desc = "Applies an scaling and offseting", l.prototype.onExecute = function() { var a = this.getInputData(0); if (this.isOutputConnected(0) && a) { @@ -8231,8 +8234,8 @@ $jscomp.polyfill("Object.values", function(w) { }, y.prototype.onGetInputs = function() { return [["gamma", "number"]]; }, y.aa_pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec2 uViewportSize;\n\r\n\t\tuniform vec2 inverseVP;\n\r\n\t\tuniform float u_igamma;\n\r\n\t\t#define FXAA_REDUCE_MIN (1.0/ 128.0)\n\r\n\t\t#define FXAA_REDUCE_MUL (1.0 / 8.0)\n\r\n\t\t#define FXAA_SPAN_MAX 8.0\n\r\n\t\t\n\r\n\t\t/* from mitsuhiko/webgl-meincraft based on the code on geeks3d.com */\n\r\n\t\tvec4 applyFXAA(sampler2D tex, vec2 fragCoord)\n\r\n\t\t{\n\r\n\t\t\tvec4 color = vec4(0.0);\n\r\n\t\t\t/*vec2 inverseVP = vec2(1.0 / uViewportSize.x, 1.0 / uViewportSize.y);*/\n\r\n\t\t\tvec3 rgbNW = texture2D(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;\n\r\n\t\t\tvec3 rgbNE = texture2D(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;\n\r\n\t\t\tvec3 rgbSW = texture2D(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;\n\r\n\t\t\tvec3 rgbSE = texture2D(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;\n\r\n\t\t\tvec3 rgbM = texture2D(tex, fragCoord * inverseVP).xyz;\n\r\n\t\t\tvec3 luma = vec3(0.299, 0.587, 0.114);\n\r\n\t\t\tfloat lumaNW = dot(rgbNW, luma);\n\r\n\t\t\tfloat lumaNE = dot(rgbNE, luma);\n\r\n\t\t\tfloat lumaSW = dot(rgbSW, luma);\n\r\n\t\t\tfloat lumaSE = dot(rgbSE, luma);\n\r\n\t\t\tfloat lumaM = dot(rgbM, luma);\n\r\n\t\t\tfloat lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n\r\n\t\t\tfloat lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\r\n\t\t\t\n\r\n\t\t\tvec2 dir;\n\r\n\t\t\tdir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n\r\n\t\t\tdir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\r\n\t\t\t\n\r\n\t\t\tfloat dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\r\n\t\t\t\n\r\n\t\t\tfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n\r\n\t\t\tdir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * inverseVP;\n\r\n\t\t\t\n\r\n\t\t\tvec3 rgbA = 0.5 * (texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + \n\r\n\t\t\t\ttexture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n\r\n\t\t\tvec3 rgbB = rgbA * 0.5 + 0.25 * (texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + \n\r\n\t\t\t\ttexture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\r\n\t\t\t\n\r\n\t\t\t//return vec4(rgbA,1.0);\n\r\n\t\t\tfloat lumaB = dot(rgbB, luma);\n\r\n\t\t\tif ((lumaB < lumaMin) || (lumaB > lumaMax))\n\r\n\t\t\t\tcolor = vec4(rgbA, 1.0);\n\r\n\t\t\telse\n\r\n\t\t\t\tcolor = vec4(rgbB, 1.0);\n\r\n\t\t\tif(u_igamma != 1.0)\n\r\n\t\t\t\tcolor.xyz = pow( color.xyz, vec3(u_igamma) );\n\r\n\t\t\treturn color;\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t gl_FragColor = applyFXAA( u_texture, v_coord * uViewportSize) ;\n\r\n\t\t}\n\r\n\t\t", - y.gamma_pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_igamma;\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = texture2D( u_texture, v_coord);\n\r\n\t\t\tcolor.xyz = pow(color.xyz, vec3(u_igamma) );\n\r\n\t\t gl_FragColor = color;\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/toviewport", y), v.title = "Copy", v.desc = "Copy Texture", v.widgets_info = {size:{widget:"combo", - values:[0, 32, 64, 128, 256, 512, 1024, 2048]}, precision:{widget:"combo", values:c.MODE_VALUES}}, v.prototype.onExecute = function() { + y.gamma_pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_igamma;\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = texture2D( u_texture, v_coord);\n\r\n\t\t\tcolor.xyz = pow(color.xyz, vec3(u_igamma) );\n\r\n\t\t gl_FragColor = color;\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/toviewport", y), w.title = "Copy", w.desc = "Copy Texture", w.widgets_info = {size:{widget:"combo", + values:[0, 32, 64, 128, 256, 512, 1024, 2048]}, precision:{widget:"combo", values:c.MODE_VALUES}}, w.prototype.onExecute = function() { var a = this.getInputData(0); if ((a || this._temp_texture) && this.isOutputConnected(0)) { if (a) { @@ -8246,7 +8249,7 @@ $jscomp.polyfill("Object.values", function(w) { } this.setOutputData(0, this._temp_texture); } - }, F.registerNodeType("texture/copy", v), E.title = "Downsample", E.desc = "Downsample Texture", E.widgets_info = {iterations:{type:"number", step:1, precision:0, min:0}, precision:{widget:"combo", values:c.MODE_VALUES}}, E.prototype.onExecute = function() { + }, F.registerNodeType("texture/copy", w), E.title = "Downsample", E.desc = "Downsample Texture", E.widgets_info = {iterations:{type:"number", step:1, precision:0, min:0}, precision:{widget:"combo", values:c.MODE_VALUES}}, E.prototype.onExecute = function() { var a = this.getInputData(0); if ((a || this._temp_texture) && this.isOutputConnected(0) && a && a.texture_type === GL.TEXTURE_2D) { if (1 > this.properties.iterations) { @@ -8258,7 +8261,7 @@ $jscomp.polyfill("Object.values", function(w) { this.properties.precision === c.LOW ? f = gl.UNSIGNED_BYTE : this.properties.precision === c.HIGH && (f = gl.HIGH_PRECISION_FORMAT); var h = this.properties.iterations || 1, e = a, n = []; f = {type:f, format:a.format}; - var g = vec2.create(), q = {u_offset:g}; + var g = vec2.create(), p = {u_offset:g}; this._texture && GL.Texture.releaseTemporary(this._texture); for (var l = 0; l < h; ++l) { g[0] = 1 / d; @@ -8268,7 +8271,7 @@ $jscomp.polyfill("Object.values", function(w) { a = GL.Texture.getTemporary(d, k, f); n.push(a); e.setParameter(GL.TEXTURE_MAG_FILTER, GL.NEAREST); - e.copyTo(a, b, q); + e.copyTo(a, b, p); if (1 == d && 1 == k) { break; } @@ -8395,7 +8398,7 @@ $jscomp.polyfill("Object.values", function(w) { this.setOutputData(0, this._temp_texture); } } - }, F.registerNodeType("texture/imageToTexture", D), t.widgets_info = {texture:{widget:"texture"}, precision:{widget:"combo", values:c.MODE_VALUES}}, t.title = "LUT", t.desc = "Apply LUT to Texture", t.prototype.onExecute = function() { + }, F.registerNodeType("texture/imageToTexture", D), u.widgets_info = {texture:{widget:"texture"}, precision:{widget:"combo", values:c.MODE_VALUES}}, u.title = "LUT", u.desc = "Apply LUT to Texture", u.prototype.onExecute = function() { if (this.isOutputConnected(0)) { var a = this.getInputData(0); if (this.properties.precision === c.PASS_THROUGH || !1 === this.properties.enabled) { @@ -8415,7 +8418,7 @@ $jscomp.polyfill("Object.values", function(w) { this._tex = c.getTargetTexture(a, this._tex, this.properties.precision); this._tex.drawTo(function() { b.bind(1); - a.toViewport(t._shader, {u_texture:0, u_textureB:1, u_amount:d}); + a.toViewport(u._shader, {u_texture:0, u_textureB:1, u_amount:d}); }); this.setOutputData(0, this._tex); } else { @@ -8424,8 +8427,8 @@ $jscomp.polyfill("Object.values", function(w) { } } } - }, t.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tuniform float u_amount;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\t lowp vec4 textureColor = clamp( texture2D(u_texture, v_coord), vec4(0.0), vec4(1.0) );\n\r\n\t\t\t mediump float blueColor = textureColor.b * 63.0;\n\r\n\t\t\t mediump vec2 quad1;\n\r\n\t\t\t quad1.y = floor(floor(blueColor) / 8.0);\n\r\n\t\t\t quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\r\n\t\t\t mediump vec2 quad2;\n\r\n\t\t\t quad2.y = floor(ceil(blueColor) / 8.0);\n\r\n\t\t\t quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\r\n\t\t\t highp vec2 texPos1;\n\r\n\t\t\t texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos1.y = 1.0 - ((quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t highp vec2 texPos2;\n\r\n\t\t\t texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos2.y = 1.0 - ((quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t lowp vec4 newColor1 = texture2D(u_textureB, texPos1);\n\r\n\t\t\t lowp vec4 newColor2 = texture2D(u_textureB, texPos2);\n\r\n\t\t\t lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\r\n\t\t\t gl_FragColor = vec4( mix( textureColor.rgb, newColor.rgb, u_amount), textureColor.w);\n\r\n\t\t}\n\r\n\t\t", - F.registerNodeType("texture/LUT", t), G.title = "Texture to Channels", G.desc = "Split texture channels", G.prototype.onExecute = function() { + }, u.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tuniform float u_amount;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\t lowp vec4 textureColor = clamp( texture2D(u_texture, v_coord), vec4(0.0), vec4(1.0) );\n\r\n\t\t\t mediump float blueColor = textureColor.b * 63.0;\n\r\n\t\t\t mediump vec2 quad1;\n\r\n\t\t\t quad1.y = floor(floor(blueColor) / 8.0);\n\r\n\t\t\t quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\r\n\t\t\t mediump vec2 quad2;\n\r\n\t\t\t quad2.y = floor(ceil(blueColor) / 8.0);\n\r\n\t\t\t quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\r\n\t\t\t highp vec2 texPos1;\n\r\n\t\t\t texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos1.y = 1.0 - ((quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t highp vec2 texPos2;\n\r\n\t\t\t texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos2.y = 1.0 - ((quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t lowp vec4 newColor1 = texture2D(u_textureB, texPos1);\n\r\n\t\t\t lowp vec4 newColor2 = texture2D(u_textureB, texPos2);\n\r\n\t\t\t lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\r\n\t\t\t gl_FragColor = vec4( mix( textureColor.rgb, newColor.rgb, u_amount), textureColor.w);\n\r\n\t\t}\n\r\n\t\t", + F.registerNodeType("texture/LUT", u), G.title = "Texture to Channels", G.desc = "Split texture channels", G.prototype.onExecute = function() { var a = this.getInputData(0); if (a) { this._channels || (this._channels = Array(4)); @@ -8453,8 +8456,8 @@ $jscomp.polyfill("Object.values", function(w) { n._shader || (n._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, n.pixel_shader)); var e = n._shader; a = Math.max(b.width, d.width, k.width, f.width); - var g = Math.max(b.height, d.height, k.height, f.height), q = this.properties.precision == c.HIGH ? c.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; - this._texture && this._texture.width == a && this._texture.height == g && this._texture.type == q || (this._texture = new GL.Texture(a, g, {type:q, format:gl.RGBA, filter:gl.LINEAR})); + var g = Math.max(b.height, d.height, k.height, f.height), p = this.properties.precision == c.HIGH ? c.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; + this._texture && this._texture.width == a && this._texture.height == g && this._texture.type == p || (this._texture = new GL.Texture(a, g, {type:p, format:gl.RGBA, filter:gl.LINEAR})); a = this._color; a[0] = this.properties.R; a[1] = this.properties.G; @@ -8470,11 +8473,11 @@ $jscomp.polyfill("Object.values", function(w) { }); this.setOutputData(0, this._texture); }, n.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_textureR;\n\r\n\t\tuniform sampler2D u_textureG;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tuniform sampler2D u_textureA;\n\r\n\t\tuniform vec4 u_color;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t gl_FragColor = u_color * vec4( \r\n\t\t\t\t\ttexture2D(u_textureR, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureG, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureB, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureA, v_coord).r);\n\r\n\t\t}\n\r\n\t\t", - F.registerNodeType("texture/channelsTexture", n), q.title = "Color", q.desc = "Generates a 1x1 texture with a constant color", q.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, q.prototype.onDrawBackground = function(a) { + F.registerNodeType("texture/channelsTexture", n), p.title = "Color", p.desc = "Generates a 1x1 texture with a constant color", p.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, p.prototype.onDrawBackground = function(a) { var b = this.properties.color; a.fillStyle = "rgb(" + Math.floor(255 * Math.clamp(b[0], 0, 1)) + "," + Math.floor(255 * Math.clamp(b[1], 0, 1)) + "," + Math.floor(255 * Math.clamp(b[2], 0, 1)) + ")"; this.flags.collapsed ? this.boxcolor = a.fillStyle : a.fillRect(0, 0, this.size[0], this.size[1]); - }, q.prototype.onExecute = function() { + }, p.prototype.onExecute = function() { var a = this.properties.precision == c.HIGH ? c.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; this._tex && this._tex.type == a || (this._tex = new GL.Texture(1, 1, {format:gl.RGBA, type:a, minFilter:gl.NEAREST})); a = this.properties.color; @@ -8504,9 +8507,9 @@ $jscomp.polyfill("Object.values", function(w) { } 0.001 < vec4.sqrDist(this._tex_color, a) && (this._tex_color.set(a), this._tex.fill(a)); this.setOutputData(0, this._tex); - }, q.prototype.onGetInputs = function() { + }, p.prototype.onGetInputs = function() { return [["RGB", "vec3"], ["RGBA", "vec4"], ["R", "number"], ["G", "number"], ["B", "number"], ["A", "number"]]; - }, F.registerNodeType("texture/color", q), k.title = "Gradient", k.desc = "Generates a gradient", k["@A"] = {type:"color"}, k["@B"] = {type:"color"}, k["@texture_size"] = {type:"enum", values:[32, 64, 128, 256, 512]}, k.prototype.onExecute = function() { + }, F.registerNodeType("texture/color", p), k.title = "Gradient", k.desc = "Generates a gradient", k["@A"] = {type:"color"}, k["@B"] = {type:"color"}, k["@texture_size"] = {type:"enum", values:[32, 64, 128, 256, 512]}, k.prototype.onExecute = function() { gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); var a = GL.Mesh.getScreenQuad(), b = k._shader, d = this.getInputData(0); @@ -8679,51 +8682,51 @@ $jscomp.polyfill("Object.values", function(w) { h.u_threshold = this.getInputOrProperty("threshold"); var g = e[0] = GL.Texture.getTemporary(b, d, k); a.blit(g, n.uniforms(h)); - var q = g, l = this.getInputOrProperty("iterations"); + var p = g, l = this.getInputOrProperty("iterations"); l = Math.clamp(l, 1, 16) | 0; - var m = h.u_texel_size, p = this.getInputOrProperty("intensity"); + var m = h.u_texel_size, r = this.getInputOrProperty("intensity"); h.u_intensity = 1; h.u_delta = this.properties.scale; n = x._shader; n || (n = x._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.scale_pixel_shader)); - for (var r = 1; r < l; r++) { + for (var q = 1; q < l; q++) { b >>= 1; 1 < (d | 0) && (d >>= 1); if (2 > b) { break; } - g = e[r] = GL.Texture.getTemporary(b, d, k); - m[0] = 1 / q.width; - m[1] = 1 / q.height; - q.blit(g, n.uniforms(h)); - q = g; + g = e[q] = GL.Texture.getTemporary(b, d, k); + m[0] = 1 / p.width; + m[1] = 1 / p.height; + p.blit(g, n.uniforms(h)); + p = g; } - this.isOutputConnected(2) && (b = this._average_texture, b && b.type == a.type && b.format == a.format || (b = this._average_texture = new GL.Texture(1, 1, {type:a.type, format:a.format, filter:gl.LINEAR})), m[0] = 1 / q.width, m[1] = 1 / q.height, h.u_intensity = p, h.u_delta = 1, q.blit(b, n.uniforms(h)), this.setOutputData(2, b)); + this.isOutputConnected(2) && (b = this._average_texture, b && b.type == a.type && b.format == a.format || (b = this._average_texture = new GL.Texture(1, 1, {type:a.type, format:a.format, filter:gl.LINEAR})), m[0] = 1 / p.width, m[1] = 1 / p.height, h.u_intensity = r, h.u_delta = 1, p.blit(b, n.uniforms(h)), this.setOutputData(2, b)); gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE); h.u_intensity = this.getInputOrProperty("persistence"); h.u_delta = 0.5; - for (r -= 2; 0 <= r; r--) { - g = e[r], e[r] = null, m[0] = 1 / q.width, m[1] = 1 / q.height, q.blit(g, n.uniforms(h)), GL.Texture.releaseTemporary(q), q = g; + for (q -= 2; 0 <= q; q--) { + g = e[q], e[q] = null, m[0] = 1 / p.width, m[1] = 1 / p.height, p.blit(g, n.uniforms(h)), GL.Texture.releaseTemporary(p), p = g; } gl.disable(gl.BLEND); - this.isOutputConnected(1) && (e = this._glow_texture, e && e.width == a.width && e.height == a.height && e.type == f && e.format == a.format || (e = this._glow_texture = new GL.Texture(a.width, a.height, {type:f, format:a.format, filter:gl.LINEAR})), q.blit(e), this.setOutputData(1, e)); + this.isOutputConnected(1) && (e = this._glow_texture, e && e.width == a.width && e.height == a.height && e.type == f && e.format == a.format || (e = this._glow_texture = new GL.Texture(a.width, a.height, {type:f, format:a.format, filter:gl.LINEAR})), p.blit(e), this.setOutputData(1, e)); if (this.isOutputConnected(0)) { e = this._final_texture; e && e.width == a.width && e.height == a.height && e.type == f && e.format == a.format || (e = this._final_texture = new GL.Texture(a.width, a.height, {type:f, format:a.format, filter:gl.LINEAR})); - var u = this.getInputData(1), t = this.getInputOrProperty("dirt_factor"); - h.u_intensity = p; - n = u ? x._dirt_final_shader : x._final_shader; - n || (n = u ? x._dirt_final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader, {USE_DIRT:""}) : x._final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader)); + var t = this.getInputData(1), u = this.getInputOrProperty("dirt_factor"); + h.u_intensity = r; + n = t ? x._dirt_final_shader : x._final_shader; + n || (n = t ? x._dirt_final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader, {USE_DIRT:""}) : x._final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader)); e.drawTo(function() { a.bind(0); - q.bind(1); - u && (n.setUniform("u_dirt_factor", t), n.setUniform("u_dirt_texture", u.bind(2))); + p.bind(1); + t && (n.setUniform("u_dirt_factor", u), n.setUniform("u_dirt_texture", t.bind(2))); n.toViewport(h); }); this.setOutputData(0, e); } - GL.Texture.releaseTemporary(q); + GL.Texture.releaseTemporary(p); } } }, x.cut_pixel_shader = "precision highp float;\n\r\n\tvarying vec2 v_coord;\n\r\n\tuniform sampler2D u_texture;\n\r\n\tuniform float u_threshold;\n\r\n\tvoid main() {\n\r\n\t\tgl_FragColor = max( texture2D( u_texture, v_coord ) - vec4( u_threshold ), vec4(0.0) );\n\r\n\t}", x.scale_pixel_shader = "precision highp float;\n\r\n\tvarying vec2 v_coord;\n\r\n\tuniform sampler2D u_texture;\n\r\n\tuniform vec2 u_texel_size;\n\r\n\tuniform float u_delta;\n\r\n\tuniform float u_intensity;\n\r\n\t\n\r\n\tvec4 sampleBox(vec2 uv) {\n\r\n\t\tvec4 o = u_texel_size.xyxy * vec2(-u_delta, u_delta).xxyy;\n\r\n\t\tvec4 s = texture2D( u_texture, uv + o.xy ) + texture2D( u_texture, uv + o.zy) + texture2D( u_texture, uv + o.xw) + texture2D( u_texture, uv + o.zw);\n\r\n\t\treturn s * 0.25;\n\r\n\t}\n\r\n\tvoid main() {\n\r\n\t\tgl_FragColor = u_intensity * sampleBox( v_coord );\n\r\n\t}", @@ -8837,9 +8840,9 @@ $jscomp.polyfill("Object.values", function(w) { } }, J.prototype.onGetOutputs = function() { return [["width", "number"], ["height", "number"], ["stream_ready", F.EVENT], ["stream_closed", F.EVENT], ["stream_error", F.EVENT]]; - }, F.registerNodeType("texture/webcam", J), L.title = "Lens FX", L.desc = "distortion and chromatic aberration", L.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, L.prototype.onGetInputs = function() { + }, F.registerNodeType("texture/webcam", J), K.title = "Lens FX", K.desc = "distortion and chromatic aberration", K.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, K.prototype.onGetInputs = function() { return [["enabled", "boolean"]]; - }, L.prototype.onExecute = function() { + }, K.prototype.onExecute = function() { var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { if (this.properties.precision === c.PASS_THROUGH || !1 === this.getInputOrProperty("enabled")) { @@ -8847,8 +8850,8 @@ $jscomp.polyfill("Object.values", function(w) { } else { var b = this._temp_texture; b && b.width == a.width && b.height == a.height && b.type == a.type || (b = this._temp_texture = new GL.Texture(a.width, a.height, {type:a.type, format:gl.RGBA, filter:gl.LINEAR})); - var d = L._shader; - d || (d = L._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, L.pixel_shader)); + var d = K._shader; + d || (d = K._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, K.pixel_shader)); var k = this.getInputData(1); null == k && (k = this.properties.factor); var f = this._uniforms; @@ -8861,8 +8864,8 @@ $jscomp.polyfill("Object.values", function(w) { this.setOutputData(0, b); } } - }, L.pixel_shader = "precision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_factor;\n\r\n\t\tvec2 barrelDistortion(vec2 coord, float amt) {\n\r\n\t\t\tvec2 cc = coord - 0.5;\n\r\n\t\t\tfloat dist = dot(cc, cc);\n\r\n\t\t\treturn coord + cc * dist * amt;\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat sat( float t )\n\r\n\t\t{\n\r\n\t\t\treturn clamp( t, 0.0, 1.0 );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat linterp( float t ) {\n\r\n\t\t\treturn sat( 1.0 - abs( 2.0*t - 1.0 ) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat remap( float t, float a, float b ) {\n\r\n\t\t\treturn sat( (t - a) / (b - a) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tvec4 spectrum_offset( float t ) {\n\r\n\t\t\tvec4 ret;\n\r\n\t\t\tfloat lo = step(t,0.5);\n\r\n\t\t\tfloat hi = 1.0-lo;\n\r\n\t\t\tfloat w = linterp( remap( t, 1.0/6.0, 5.0/6.0 ) );\n\r\n\t\t\tret = vec4(lo,1.0,hi, 1.) * vec4(1.0-w, w, 1.0-w, 1.);\n\r\n\t\t\n\r\n\t\t\treturn pow( ret, vec4(1.0/2.2) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tconst float max_distort = 2.2;\n\r\n\t\tconst int num_iter = 12;\n\r\n\t\tconst float reci_num_iter_f = 1.0 / float(num_iter);\n\r\n\t\t\n\r\n\t\tvoid main()\n\r\n\t\t{\t\n\r\n\t\t\tvec2 uv=v_coord;\n\r\n\t\t\tvec4 sumcol = vec4(0.0);\n\r\n\t\t\tvec4 sumw = vec4(0.0);\t\n\r\n\t\t\tfor ( int i=0; i c; ++c) { this.valid_notes[c] = -1 != this.notes_pitches.indexOf(c); } @@ -9948,7 +9951,7 @@ $jscomp.polyfill("Object.values", function(w) { var c = this.getInputData(1); null != c && c != this._current_scale && this.processScale(c); }; - t.registerNodeType("midi/quantize", z); + u.registerNodeType("midi/quantize", z); e.title = "MIDI fromFile"; e.desc = "Plays a MIDI file"; e.color = "#243"; @@ -9984,7 +9987,7 @@ $jscomp.polyfill("Object.values", function(w) { }; e.prototype.loadMIDIFile = function(c) { var e = this; - t.fetchFile(c, "arraybuffer", function(c) { + u.fetchFile(c, "arraybuffer", function(c) { e.boxcolor = "#AFA"; e._midi = MidiParser.parse(new Uint8Array(c)); e.properties.autoplay && e.play(); @@ -9997,7 +10000,7 @@ $jscomp.polyfill("Object.values", function(w) { this.properties.url = ""; this.loadMIDIFile(c); }; - t.registerNodeType("midi/fromFile", e); + u.registerNodeType("midi/fromFile", e); C.title = "MIDI Play"; C.desc = "Plays a MIDI note"; C.color = "#243"; @@ -10019,7 +10022,7 @@ $jscomp.polyfill("Object.values", function(w) { c = this.getInputData(2); null != c && (this.properties.duration = c); }; - t.registerNodeType("midi/play", C); + u.registerNodeType("midi/play", C); D.title = "MIDI Keys"; D.desc = "Keyboard to play notes"; D.color = "#243"; @@ -10097,9 +10100,9 @@ $jscomp.polyfill("Object.values", function(w) { return e = this.getKeyIndex(g), this.keys[e] = !1, this._last_key = -1, e = 12 * (this.properties.start_octave - 1) + 29 + e, g = new c, g.setup([c.NOTEOFF, e, 100]), this.trigger("note", g), !0; } }; - t.registerNodeType("midi/keys", D); + u.registerNodeType("midi/keys", D); })(this); -(function(w) { +(function(v) { function c() { this.properties = {src:"", gain:0.5, loop:!0, autoplay:!0, playbackRate:1}; this._loading_audio = !1; @@ -10108,24 +10111,24 @@ $jscomp.polyfill("Object.values", function(w) { this._last_sourcenode = null; this.addOutput("out", "audio"); this.addInput("gain", "number"); - this.audionode = q.getAudioContext().createGain(); + this.audionode = p.getAudioContext().createGain(); this.audionode.graphnode = this; this.audionode.gain.value = this.properties.gain; this.properties.src && this.loadSound(this.properties.src); } - function p() { + function q() { this.properties = {gain:0.5}; this._audionodes = []; this._media_stream = null; this.addOutput("out", "audio"); this.addInput("gain", "number"); - this.audionode = q.getAudioContext().createGain(); + this.audionode = p.getAudioContext().createGain(); this.audionode.graphnode = this; this.audionode.gain.value = this.properties.gain; } function m() { this.properties = {fftSize:2048, minDecibels:-100, maxDecibels:-10, smoothingTimeConstant:0.5}; - this.audionode = q.getAudioContext().createAnalyser(); + this.audionode = p.getAudioContext().createAnalyser(); this.audionode.graphnode = this; this.audionode.fftSize = this.properties.fftSize; this.audionode.minDecibels = this.properties.minDecibels; @@ -10138,36 +10141,36 @@ $jscomp.polyfill("Object.values", function(w) { } function g() { this.properties = {gain:1}; - this.audionode = q.getAudioContext().createGain(); + this.audionode = p.getAudioContext().createGain(); this.addInput("in", "audio"); this.addInput("gain", "number"); this.addOutput("out", "audio"); } - function u() { + function r() { this.properties = {impulse_src:"", normalize:!0}; - this.audionode = q.getAudioContext().createConvolver(); + this.audionode = p.getAudioContext().createConvolver(); this.addInput("in", "audio"); this.addOutput("out", "audio"); } function l() { this.properties = {threshold:-50, knee:40, ratio:12, reduction:-20, attack:0, release:0.25}; - this.audionode = q.getAudioContext().createDynamicsCompressor(); + this.audionode = p.getAudioContext().createDynamicsCompressor(); this.addInput("in", "audio"); this.addOutput("out", "audio"); } function B() { this.properties = {}; - this.audionode = q.getAudioContext().createWaveShaper(); + this.audionode = p.getAudioContext().createWaveShaper(); this.addInput("in", "audio"); this.addInput("shape", "waveshape"); this.addOutput("out", "audio"); } function y() { this.properties = {gain1:0.5, gain2:0.5}; - this.audionode = q.getAudioContext().createGain(); - this.audionode1 = q.getAudioContext().createGain(); + this.audionode = p.getAudioContext().createGain(); + this.audionode1 = p.getAudioContext().createGain(); this.audionode1.gain.value = this.properties.gain1; - this.audionode2 = q.getAudioContext().createGain(); + this.audionode2 = p.getAudioContext().createGain(); this.audionode2.gain.value = this.properties.gain2; this.audionode1.connect(this.audionode); this.audionode2.connect(this.audionode); @@ -10177,9 +10180,9 @@ $jscomp.polyfill("Object.values", function(w) { this.addInput("in2 gain", "number"); this.addOutput("out", "audio"); } - function v() { + function w() { this.properties = {A:0.1, D:0.1, S:0.1, R:0.1}; - this.audionode = q.getAudioContext().createGain(); + this.audionode = p.getAudioContext().createGain(); this.audionode.gain.value = 0; this.addInput("in", "audio"); this.addInput("gate", "bool"); @@ -10188,7 +10191,7 @@ $jscomp.polyfill("Object.values", function(w) { } function E() { this.properties = {delayTime:0.5}; - this.audionode = q.getAudioContext().createDelay(10); + this.audionode = p.getAudioContext().createDelay(10); this.audionode.delayTime.value = this.properties.delayTime; this.addInput("in", "audio"); this.addInput("time", "number"); @@ -10197,14 +10200,14 @@ $jscomp.polyfill("Object.values", function(w) { function z() { this.properties = {frequency:350, detune:0, Q:1}; this.addProperty("type", "lowpass", "enum", {values:"lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ")}); - this.audionode = q.getAudioContext().createBiquadFilter(); + this.audionode = p.getAudioContext().createBiquadFilter(); this.addInput("in", "audio"); this.addOutput("out", "audio"); } function e() { this.properties = {frequency:440, detune:0, type:"sine"}; this.addProperty("type", "sine", "enum", {values:["sine", "square", "sawtooth", "triangle", "custom"]}); - this.audionode = q.getAudioContext().createOscillator(); + this.audionode = p.getAudioContext().createOscillator(); this.addOutput("out", "audio"); } function C() { @@ -10219,26 +10222,26 @@ $jscomp.polyfill("Object.values", function(w) { this.addInput("freqs", "array"); this.addOutput("signal", "number"); } - function t() { - if (!t.default_code) { - var c = t.default_function.toString(), a = c.indexOf("{") + 1, b = c.lastIndexOf("}"); - t.default_code = c.substr(a, b - a); + function u() { + if (!u.default_code) { + var c = u.default_function.toString(), a = c.indexOf("{") + 1, b = c.lastIndexOf("}"); + u.default_code = c.substr(a, b - a); } - this.properties = {code:t.default_code}; - c = q.getAudioContext(); + this.properties = {code:u.default_code}; + c = p.getAudioContext(); c.createScriptProcessor ? this.audionode = c.createScriptProcessor(4096, 1, 1) : (console.warn("ScriptProcessorNode deprecated"), this.audionode = c.createGain()); this.processCode(); - t._bypass_function || (t._bypass_function = this.audionode.onaudioprocess); + u._bypass_function || (u._bypass_function = this.audionode.onaudioprocess); this.addInput("in", "audio"); this.addOutput("out", "audio"); } function G() { - this.audionode = q.getAudioContext().destination; + this.audionode = p.getAudioContext().destination; this.addInput("in", "audio"); } - var n = w.LiteGraph, q = {}; - w.LGAudio = q; - q.getAudioContext = function() { + var n = v.LiteGraph, p = {}; + v.LGAudio = p; + p.getAudioContext = function() { if (!this._audio_context) { window.AudioContext = window.AudioContext || window.webkitAudioContext; if (!window.AudioContext) { @@ -10257,21 +10260,21 @@ $jscomp.polyfill("Object.values", function(w) { } return this._audio_context; }; - q.connect = function(c, a) { + p.connect = function(c, a) { try { c.connect(a); } catch (b) { console.warn("LGraphAudio:", b); } }; - q.disconnect = function(c, a) { + p.disconnect = function(c, a) { try { c.disconnect(a); } catch (b) { console.warn("LGraphAudio:", b); } }; - q.changeAllAudiosConnections = function(c, a) { + p.changeAllAudiosConnections = function(c, a) { if (c.inputs) { for (var b = 0; b < c.inputs.length; ++b) { var d = c.graph.links[c.inputs[b].link]; @@ -10279,7 +10282,7 @@ $jscomp.polyfill("Object.values", function(w) { var e = c.graph.getNodeById(d.origin_id); e = e.getAudioNodeInOutputSlot ? e.getAudioNodeInOutputSlot(d.origin_slot) : e.audionode; d = c.getAudioNodeInInputSlot ? c.getAudioNodeInInputSlot(b) : c.audionode; - a ? q.connect(e, d) : q.disconnect(e, d); + a ? p.connect(e, d) : p.disconnect(e, d); } } } @@ -10290,42 +10293,42 @@ $jscomp.polyfill("Object.values", function(w) { e = c.getAudioNodeInOutputSlot ? c.getAudioNodeInOutputSlot(b) : c.audionode; var l = c.graph.getNodeById(d.target_id); d = l.getAudioNodeInInputSlot ? l.getAudioNodeInInputSlot(d.target_slot) : l.audionode; - a ? q.connect(e, d) : q.disconnect(e, d); + a ? p.connect(e, d) : p.disconnect(e, d); } } } } }; - q.onConnectionsChange = function(c, a, b, d) { - c == n.OUTPUT && (c = null, d && (c = this.graph.getNodeById(d.target_id)), c && (a = this.getAudioNodeInOutputSlot ? this.getAudioNodeInOutputSlot(a) : this.audionode, d = c.getAudioNodeInInputSlot ? c.getAudioNodeInInputSlot(d.target_slot) : c.audionode, b ? q.connect(a, d) : q.disconnect(a, d))); + p.onConnectionsChange = function(c, a, b, d) { + c == n.OUTPUT && (c = null, d && (c = this.graph.getNodeById(d.target_id)), c && (a = this.getAudioNodeInOutputSlot ? this.getAudioNodeInOutputSlot(a) : this.audionode, d = c.getAudioNodeInInputSlot ? c.getAudioNodeInInputSlot(d.target_slot) : c.audionode, b ? p.connect(a, d) : p.disconnect(a, d))); }; - q.createAudioNodeWrapper = function(c) { + p.createAudioNodeWrapper = function(c) { var a = c.prototype.onPropertyChanged; c.prototype.onPropertyChanged = function(b, d) { a && a.call(this, b, d); this.audionode && void 0 !== this.audionode[b] && (void 0 !== this.audionode[b].value ? this.audionode[b].value = d : this.audionode[b] = d); }; - c.prototype.onConnectionsChange = q.onConnectionsChange; + c.prototype.onConnectionsChange = p.onConnectionsChange; }; - q.cached_audios = {}; - q.loadSound = function(c, a, b) { + p.cached_audios = {}; + p.loadSound = function(c, a, b) { function d(a) { console.log("Audio loading sample error:", a); b && b(a); } - if (q.cached_audios[c] && -1 == c.indexOf("blob:")) { - a && a(q.cached_audios[c]); + if (p.cached_audios[c] && -1 == c.indexOf("blob:")) { + a && a(p.cached_audios[c]); } else { - q.onProcessAudioURL && (c = q.onProcessAudioURL(c)); + p.onProcessAudioURL && (c = p.onProcessAudioURL(c)); var e = new XMLHttpRequest; e.open("GET", c, !0); e.responseType = "arraybuffer"; - var k = q.getAudioContext(); + var k = p.getAudioContext(); e.onload = function() { console.log("AudioSource loaded"); k.decodeAudioData(e.response, function(b) { console.log("AudioSource decoded"); - q.cached_audios[c] = b; + p.cached_audios[c] = b; a && a(b); }, d); }; @@ -10364,10 +10367,10 @@ $jscomp.polyfill("Object.values", function(w) { this._audionodes.length = 0; }; c.prototype.pauseAllSounds = function() { - q.getAudioContext().suspend(); + p.getAudioContext().suspend(); }; c.prototype.unpauseAllSounds = function() { - q.getAudioContext().resume(); + p.getAudioContext().resume(); }; c.prototype.onExecute = function() { if (this.inputs) { @@ -10418,7 +10421,7 @@ $jscomp.polyfill("Object.values", function(w) { } }; c.prototype.playBuffer = function(c) { - var a = this, b = q.getAudioContext().createBufferSource(); + var a = this, b = p.getAudioContext().createBufferSource(); this._last_sourcenode = b; b.graphnode = this; b.buffer = c; @@ -10441,7 +10444,7 @@ $jscomp.polyfill("Object.values", function(w) { this._request && (this._request.abort(), this._request = null); this._audiobuffer = null; this._loading_audio = !1; - c && (this._request = q.loadSound(c, function(b) { + c && (this._request = p.loadSound(c, function(b) { this.boxcolor = n.NODE_DEFAULT_BOXCOLOR; a._audiobuffer = b; a._loading_audio = !1; @@ -10450,7 +10453,7 @@ $jscomp.polyfill("Object.values", function(w) { } }), this._loading_audio = !0, this.boxcolor = "#AA4"); }; - c.prototype.onConnectionsChange = q.onConnectionsChange; + c.prototype.onConnectionsChange = p.onConnectionsChange; c.prototype.onGetInputs = function() { return [["playbackRate", "number"], ["src", "string"], ["Play", n.ACTION], ["Stop", n.ACTION]]; }; @@ -10467,24 +10470,24 @@ $jscomp.polyfill("Object.values", function(w) { c.title = "Source"; c.desc = "Plays audio"; n.registerNodeType("audio/source", c); - p.prototype.onAdded = function(c) { + q.prototype.onAdded = function(c) { if (c.status === LGraph.STATUS_RUNNING) { this.onStart(); } }; - p.prototype.onStart = function() { + q.prototype.onStart = function() { null != this._media_stream || this._waiting_confirmation || this.openStream(); }; - p.prototype.onStop = function() { + q.prototype.onStop = function() { this.audionode.gain.value = 0; }; - p.prototype.onPause = function() { + q.prototype.onPause = function() { this.audionode.gain.value = 0; }; - p.prototype.onUnpause = function() { + q.prototype.onUnpause = function() { this.audionode.gain.value = this.properties.gain; }; - p.prototype.onRemoved = function() { + q.prototype.onRemoved = function() { this.audionode.gain.value = 0; this.audiosource_node && (this.audiosource_node.disconnect(this.audionode), this.audiosource_node = null); if (this._media_stream) { @@ -10492,7 +10495,7 @@ $jscomp.polyfill("Object.values", function(w) { c.length && c[0].stop(); } }; - p.prototype.openStream = function() { + q.prototype.openStream = function() { if (navigator.mediaDevices) { this._waiting_confirmation = !0; navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(this.streamReady.bind(this)).catch(function(a) { @@ -10505,15 +10508,15 @@ $jscomp.polyfill("Object.values", function(w) { console.log("getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags"); } }; - p.prototype.streamReady = function(c) { + q.prototype.streamReady = function(c) { this._media_stream = c; this.audiosource_node && this.audiosource_node.disconnect(this.audionode); - this.audiosource_node = q.getAudioContext().createMediaStreamSource(c); + this.audiosource_node = p.getAudioContext().createMediaStreamSource(c); this.audiosource_node.graphnode = this; this.audiosource_node.connect(this.audionode); this.boxcolor = "white"; }; - p.prototype.onExecute = function() { + q.prototype.onExecute = function() { null != this._media_stream || this._waiting_confirmation || this.openStream(); if (this.inputs) { for (var c = 0; c < this.inputs.length; ++c) { @@ -10525,19 +10528,19 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - p.prototype.onAction = function(c) { + q.prototype.onAction = function(c) { "Play" == c ? this.audionode.gain.value = this.properties.gain : "Stop" == c && (this.audionode.gain.value = 0); }; - p.prototype.onPropertyChanged = function(c, a) { + q.prototype.onPropertyChanged = function(c, a) { "gain" == c && (this.audionode.gain.value = a); }; - p.prototype.onConnectionsChange = q.onConnectionsChange; - p.prototype.onGetInputs = function() { + q.prototype.onConnectionsChange = p.onConnectionsChange; + q.prototype.onGetInputs = function() { return [["playbackRate", "number"], ["Play", n.ACTION], ["Stop", n.ACTION]]; }; - p.title = "MediaSource"; - p.desc = "Plays microphone"; - n.registerNodeType("audio/media_source", p); + q.title = "MediaSource"; + q.desc = "Plays microphone"; + n.registerNodeType("audio/media_source", q); m.prototype.onPropertyChanged = function(c, a) { this.audionode[c] = a; }; @@ -10574,39 +10577,39 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - q.createAudioNodeWrapper(g); + p.createAudioNodeWrapper(g); g.title = "Gain"; g.desc = "Audio gain"; n.registerNodeType("audio/gain", g); - q.createAudioNodeWrapper(u); - u.prototype.onRemove = function() { + p.createAudioNodeWrapper(r); + r.prototype.onRemove = function() { this._dropped_url && URL.revokeObjectURL(this._dropped_url); }; - u.prototype.onPropertyChanged = function(c, a) { + r.prototype.onPropertyChanged = function(c, a) { "impulse_src" == c ? this.loadImpulse(a) : "normalize" == c && (this.audionode.normalize = a); }; - u.prototype.onDropFile = function(c) { + r.prototype.onDropFile = function(c) { this._dropped_url && URL.revokeObjectURL(this._dropped_url); this._dropped_url = URL.createObjectURL(c); this.properties.impulse_src = this._dropped_url; this.loadImpulse(this._dropped_url); }; - u.prototype.loadImpulse = function(c) { + r.prototype.loadImpulse = function(c) { var a = this; this._request && (this._request.abort(), this._request = null); this._impulse_buffer = null; this._loading_impulse = !1; - c && (this._request = q.loadSound(c, function(b) { + c && (this._request = p.loadSound(c, function(b) { a._impulse_buffer = b; a.audionode.buffer = b; console.log("Impulse signal set"); a._loading_impulse = !1; }), this._loading_impulse = !0); }; - u.title = "Convolver"; - u.desc = "Convolves the signal (used for reverb)"; - n.registerNodeType("audio/convolver", u); - q.createAudioNodeWrapper(l); + r.title = "Convolver"; + r.desc = "Convolves the signal (used for reverb)"; + n.registerNodeType("audio/convolver", r); + p.createAudioNodeWrapper(l); l.prototype.onExecute = function() { if (this.inputs && this.inputs.length) { for (var c = 1; c < this.inputs.length; ++c) { @@ -10633,7 +10636,7 @@ $jscomp.polyfill("Object.values", function(w) { B.prototype.setWaveShape = function(c) { this.audionode.curve = c; }; - q.createAudioNodeWrapper(B); + p.createAudioNodeWrapper(B); y.prototype.getAudioNodeInInputSlot = function(c) { if (0 == c) { return this.audionode1; @@ -10653,23 +10656,23 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - q.createAudioNodeWrapper(y); + p.createAudioNodeWrapper(y); y.title = "Mixer"; y.desc = "Audio mixer"; n.registerNodeType("audio/mixer", y); - v.prototype.onExecute = function() { - var c = q.getAudioContext().currentTime, a = this.audionode.gain, b = this.getInputData(1), d = this.getInputOrProperty("A"), e = this.getInputOrProperty("D"), f = this.getInputOrProperty("S"), g = this.getInputOrProperty("R"); + w.prototype.onExecute = function() { + var c = p.getAudioContext().currentTime, a = this.audionode.gain, b = this.getInputData(1), d = this.getInputOrProperty("A"), e = this.getInputOrProperty("D"), f = this.getInputOrProperty("S"), g = this.getInputOrProperty("R"); !this.gate && b ? (a.cancelScheduledValues(0), a.setValueAtTime(0, c), a.linearRampToValueAtTime(1, c + d), a.linearRampToValueAtTime(f, c + d + e)) : this.gate && !b && (a.cancelScheduledValues(0), a.setValueAtTime(a.value, c), a.linearRampToValueAtTime(0, c + g)); this.gate = b; }; - v.prototype.onGetInputs = function() { + w.prototype.onGetInputs = function() { return [["A", "number"], ["D", "number"], ["S", "number"], ["R", "number"]]; }; - q.createAudioNodeWrapper(v); - v.title = "ADSR"; - v.desc = "Audio envelope"; - n.registerNodeType("audio/adsr", v); - q.createAudioNodeWrapper(E); + p.createAudioNodeWrapper(w); + w.title = "ADSR"; + w.desc = "Audio envelope"; + n.registerNodeType("audio/adsr", w); + p.createAudioNodeWrapper(E); E.prototype.onExecute = function() { var c = this.getInputData(1); void 0 !== c && (this.audionode.delayTime.value = c); @@ -10691,7 +10694,7 @@ $jscomp.polyfill("Object.values", function(w) { z.prototype.onGetInputs = function() { return [["frequency", "number"], ["detune", "number"], ["Q", "number"]]; }; - q.createAudioNodeWrapper(z); + p.createAudioNodeWrapper(z); z.title = "BiquadFilter"; z.desc = "Audio filter"; n.registerNodeType("audio/biquadfilter", z); @@ -10727,7 +10730,7 @@ $jscomp.polyfill("Object.values", function(w) { e.prototype.onGetInputs = function() { return [["frequency", "number"], ["detune", "number"], ["type", "string"]]; }; - q.createAudioNodeWrapper(e); + p.createAudioNodeWrapper(e); e.title = "Oscillator"; e.desc = "Oscillator"; n.registerNodeType("audio/oscillator", e); @@ -10756,7 +10759,7 @@ $jscomp.polyfill("Object.values", function(w) { } } c.stroke(); - 0 <= this.properties.mark && (a = q.getAudioContext().sampleRate / a.length, e = this.properties.mark / a * 2 / b, e >= this.size[0] && (e = this.size[0] - 1), c.strokeStyle = "red", c.beginPath(), c.moveTo(e, d), c.lineTo(e, 0), c.stroke()); + 0 <= this.properties.mark && (a = p.getAudioContext().sampleRate / a.length, e = this.properties.mark / a * 2 / b, e >= this.size[0] && (e = this.size[0] - 1), c.strokeStyle = "red", c.beginPath(), c.moveTo(e, d), c.lineTo(e, 0), c.stroke()); } }; C.title = "Visualization"; @@ -10766,7 +10769,7 @@ $jscomp.polyfill("Object.values", function(w) { if (this._freqs = this.getInputData(0)) { var c = this.properties.band, a = this.getInputData(1); void 0 !== a && (c = a); - a = q.getAudioContext().sampleRate / this._freqs.length; + a = p.getAudioContext().sampleRate / this._freqs.length; a = c / a * 2; a >= this._freqs.length ? a = this._freqs[this._freqs.length - 1] : (c = a | 0, a -= c, a = this._freqs[c] * (1 - a) + this._freqs[c + 1] * a); this.setOutputData(0, a / 255 * this.properties.amplitude); @@ -10778,38 +10781,38 @@ $jscomp.polyfill("Object.values", function(w) { D.title = "Signal"; D.desc = "extract the signal of some frequency"; n.registerNodeType("audio/signal", D); - t.prototype.onAdded = function(c) { + u.prototype.onAdded = function(c) { c.status == LGraph.STATUS_RUNNING && (this.audionode.onaudioprocess = this._callback); }; - t["@code"] = {widget:"code", type:"code"}; - t.prototype.onStart = function() { + u["@code"] = {widget:"code", type:"code"}; + u.prototype.onStart = function() { this.audionode.onaudioprocess = this._callback; }; - t.prototype.onStop = function() { - this.audionode.onaudioprocess = t._bypass_function; + u.prototype.onStop = function() { + this.audionode.onaudioprocess = u._bypass_function; }; - t.prototype.onPause = function() { - this.audionode.onaudioprocess = t._bypass_function; + u.prototype.onPause = function() { + this.audionode.onaudioprocess = u._bypass_function; }; - t.prototype.onUnpause = function() { + u.prototype.onUnpause = function() { this.audionode.onaudioprocess = this._callback; }; - t.prototype.onExecute = function() { + u.prototype.onExecute = function() { }; - t.prototype.onRemoved = function() { - this.audionode.onaudioprocess = t._bypass_function; + u.prototype.onRemoved = function() { + this.audionode.onaudioprocess = u._bypass_function; }; - t.prototype.processCode = function() { + u.prototype.processCode = function() { try { this._script = new (new Function("properties", this.properties.code))(this.properties), this._old_code = this.properties.code, this._callback = this._script.onaudioprocess; } catch (k) { - console.error("Error in onaudioprocess code", k), this._callback = t._bypass_function, this.audionode.onaudioprocess = this._callback; + console.error("Error in onaudioprocess code", k), this._callback = u._bypass_function, this.audionode.onaudioprocess = this._callback; } }; - t.prototype.onPropertyChanged = function(c, a) { + u.prototype.onPropertyChanged = function(c, a) { "code" == c && (this.properties.code = a, this.processCode(), this.graph && this.graph.status == LGraph.STATUS_RUNNING && (this.audionode.onaudioprocess = this._callback)); }; - t.default_function = function() { + u.default_function = function() { this.onaudioprocess = function(c) { var a = c.inputBuffer; c = c.outputBuffer; @@ -10820,15 +10823,15 @@ $jscomp.polyfill("Object.values", function(w) { } }; }; - q.createAudioNodeWrapper(t); - t.title = "Script"; - t.desc = "apply script to signal"; - n.registerNodeType("audio/script", t); + p.createAudioNodeWrapper(u); + u.title = "Script"; + u.desc = "apply script to signal"; + n.registerNodeType("audio/script", u); G.title = "Destination"; G.desc = "Audio output"; n.registerNodeType("audio/destination", G); })(this); -(function(w) { +(function(v) { function c() { this.size = [60, 20]; this.addInput("send", m.ACTION); @@ -10840,7 +10843,7 @@ $jscomp.polyfill("Object.values", function(w) { this._last_sent_data = []; this._last_received_data = []; } - function p() { + function q() { this.room_widget = this.addWidget("text", "Room", "lgraph", this.setRoom.bind(this)); this.addWidget("button", "Reconnect", null, this.connectSocket.bind(this)); this.addInput("send", m.ACTION); @@ -10854,7 +10857,7 @@ $jscomp.polyfill("Object.values", function(w) { this._last_received_data = []; "undefined" == typeof SillyClient && console.warn("remember to add SillyClient.js to your project: https://tamats.com/projects/sillyserver/src/sillyclient.js"); } - var m = w.LiteGraph; + var m = v.LiteGraph; c.title = "WebSocket"; c.desc = "Send data through a websocket"; c.prototype.onPropertyChanged = function(c, m) { @@ -10864,14 +10867,14 @@ $jscomp.polyfill("Object.values", function(w) { !this._ws && this.properties.url && this.connectSocket(); if (this._ws && this._ws.readyState == WebSocket.OPEN) { for (var c = this.properties.room, m = this.properties.only_send_changes, l = 1; l < this.inputs.length; ++l) { - var p = this.getInputData(l); - if (null != p) { + var q = this.getInputData(l); + if (null != q) { try { - var w = JSON.stringify({type:0, room:c, channel:l, data:p}); - } catch (v) { + var v = JSON.stringify({type:0, room:c, channel:l, data:q}); + } catch (w) { continue; } - m && this._last_sent_data[l] == w || (this._last_sent_data[l] = w, this._ws.send(w)); + m && this._last_sent_data[l] == v || (this._last_sent_data[l] = v, this._ws.send(v)); } } for (l = 1; l < this.outputs.length; ++l) { @@ -10881,9 +10884,9 @@ $jscomp.polyfill("Object.values", function(w) { } }; c.prototype.connectSocket = function() { - var c = this, p = this.properties.url; - "ws" != p.substr(0, 2) && (p = "ws://" + p); - this._ws = new WebSocket(p); + var c = this, r = this.properties.url; + "ws" != r.substr(0, 2) && (r = "ws://" + r); + this._ws = new WebSocket(r); this._ws.onopen = function() { console.log("ready"); c.boxcolor = "#6C6"; @@ -10929,18 +10932,18 @@ $jscomp.polyfill("Object.values", function(w) { return [["out", 0]]; }; m.registerNodeType("network/websocket", c); - p.title = "SillyClient"; - p.desc = "Connects to SillyServer to broadcast messages"; - p.prototype.onPropertyChanged = function(c, m) { + q.title = "SillyClient"; + q.desc = "Connects to SillyServer to broadcast messages"; + q.prototype.onPropertyChanged = function(c, m) { "room" == c && (this.room_widget.value = m); this.connectSocket(); }; - p.prototype.setRoom = function(c) { + q.prototype.setRoom = function(c) { this.properties.room = c; this.room_widget.value = c; this.connectSocket(); }; - p.prototype.onDrawForeground = function() { + q.prototype.onDrawForeground = function() { for (var c = 1; c < this.inputs.length; ++c) { var m = this.inputs[c]; m.label = "in_" + c; @@ -10949,32 +10952,32 @@ $jscomp.polyfill("Object.values", function(w) { m = this.outputs[c], m.label = "out_" + c; } }; - p.prototype.onExecute = function() { + q.prototype.onExecute = function() { if (this._server && this._server.is_connected) { for (var c = this.properties.only_send_changes, m = 1; m < this.inputs.length; ++m) { - var l = this.getInputData(m), p = this._last_sent_data[m]; + var l = this.getInputData(m), q = this._last_sent_data[m]; if (null != l) { if (c) { - var w = !0; - if (l && l.length && p && p.length == l.length && l.constructor !== String) { - for (var v = 0; v < l.length; ++v) { - if (p[v] != l[v]) { - w = !1; + var v = !0; + if (l && l.length && q && q.length == l.length && l.constructor !== String) { + for (var w = 0; w < l.length; ++w) { + if (q[w] != l[w]) { + v = !1; break; } } } else { - this._last_sent_data[m] != l && (w = !1); + this._last_sent_data[m] != l && (v = !1); } - if (w) { + if (v) { continue; } } this._server.sendMessage({type:0, channel:m, data:l}); if (l.length && l.constructor !== String) { if (this._last_sent_data[m]) { - for (this._last_sent_data[m].length = l.length, v = 0; v < l.length; ++v) { - this._last_sent_data[m][v] = l[v]; + for (this._last_sent_data[m].length = l.length, w = 0; w < l.length; ++w) { + this._last_sent_data[m][w] = l[w]; } } else { this._last_sent_data[m] = l.constructor === Array ? l.concat() : new l.constructor(l); @@ -10990,7 +10993,7 @@ $jscomp.polyfill("Object.values", function(w) { "#AFA" == this.boxcolor && (this.boxcolor = "#6C6"); } }; - p.prototype.connectSocket = function() { + q.prototype.connectSocket = function() { var c = this; if ("undefined" == typeof SillyClient) { this._error || console.error("SillyClient node cannot be used, you must include SillyServer.js"), this._error = !0; @@ -11029,8 +11032,8 @@ $jscomp.polyfill("Object.values", function(w) { }, this.properties.url && this.properties.room) { try { this._server.connect(this.properties.url, this.properties.room); - } catch (u) { - console.error("SillyServer error: " + u); + } catch (r) { + console.error("SillyServer error: " + r); this._server = null; return; } @@ -11038,19 +11041,19 @@ $jscomp.polyfill("Object.values", function(w) { } } }; - p.prototype.send = function(c) { + q.prototype.send = function(c) { this._server && this._server.is_connected && this._server.sendMessage({type:1, data:c}); }; - p.prototype.onAction = function(c, m) { + q.prototype.onAction = function(c, m) { this._server && this._server.is_connected && this._server.sendMessage({type:1, action:c, data:m}); }; - p.prototype.onGetInputs = function() { + q.prototype.onGetInputs = function() { return [["in", 0]]; }; - p.prototype.onGetOutputs = function() { + q.prototype.onGetOutputs = function() { return [["out", 0]]; }; - m.registerNodeType("network/sillyclient", p); + m.registerNodeType("network/sillyclient", q); })(this); >>>>>>> custom widget custom size support diff --git a/src/litegraph.d.ts b/src/litegraph.d.ts index da611ae96..9e534315d 100644 --- a/src/litegraph.d.ts +++ b/src/litegraph.d.ts @@ -62,17 +62,16 @@ export interface IWidget { width: number, posY: number, height: number - ): number | undefined; + ): void; /** * Called by `LGraphCanvas.processNodeWidgets` * https://github.com/jagenjo/litegraph.js/issues/76 */ mouse?( - ctx: undefined, event: MouseEvent, pos: Vector2, node: LGraphNode - ): void; + ): boolean; /** Called by `LGraphNode.computeSize` */ computeSize?(width: number): [number, number]; } diff --git a/src/litegraph.js b/src/litegraph.js index 54b9a5ee2..2960c3bbf 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -8257,7 +8257,6 @@ LGraphNode.prototype.executeAction = function(action) var margin = 15; for (var i = 0; i < widgets.length; ++i) { - var h = H; var w = widgets[i]; var y = posY; if (w.y) { @@ -8428,11 +8427,11 @@ LGraphNode.prototype.executeAction = function(action) break; default: if (w.draw) { - h = w.draw(ctx, node, width, y, H) || H; + w.draw(ctx, node, width, y, H); } break; } - posY += h + 4; + posY += (w.computeSize ? w.computeSize(width)[1] : H) + 4; ctx.globalAlpha = this.editor_alpha; } @@ -8464,7 +8463,8 @@ LGraphNode.prototype.executeAction = function(action) var w = node.widgets[i]; if(!w || w.disabled) continue; - if ( w == active_widget || (x > 6 && x < width - 12 && y > w.last_y && y < w.last_y + LiteGraph.NODE_WIDGET_HEIGHT) ) { + var widget_height = w.computeSize ? w.computeSize(width)[1] : LiteGraph.NODE_WIDGET_HEIGHT; + if ( w == active_widget || (x > 6 && x < width - 12 && y > w.last_y && y < w.last_y + widget_height) ) { //inside widget switch (w.type) { case "button": @@ -8598,7 +8598,7 @@ LGraphNode.prototype.executeAction = function(action) break; default: if (w.mouse) { - w.mouse(ctx, event, [x, y], node); + this.dirty_canvas = w.mouse(event, [x, y], node); } break; } //end switch