fix the canvas event bug

This commit is contained in:
tamat
2014-06-06 21:04:12 +02:00
parent 59df75f45d
commit 5991fb6b8b
11 changed files with 1805 additions and 384 deletions

View File

@@ -1446,6 +1446,12 @@ LGraphNode.prototype.isPointInsideNode = function(x,y)
return false;
}
/**
* returns the input slot with a given name (used for dynamic slots), -1 if not found
* @method findInputSlot
* @param {string} name the name of the slot
* @return {number} the slot (-1 if not found)
*/
LGraphNode.prototype.findInputSlot = function(name)
{
if(!this.inputs) return -1;
@@ -1455,6 +1461,12 @@ LGraphNode.prototype.findInputSlot = function(name)
return -1;
}
/**
* returns the output slot with a given name (used for dynamic slots), -1 if not found
* @method findOutputSlot
* @param {string} name the name of the slot
* @return {number} the slot (-1 if not found)
*/
LGraphNode.prototype.findOutputSlot = function(name)
{
if(!this.outputs) return -1;
@@ -1871,8 +1883,8 @@ LGraphNode.prototype.localToScreen = function(x,y, graphcanvas)
*
* @class LGraphCanvas
* @constructor
* @param {HTMLCanvas} canvas the canvas where you want to render (it accepts a selector in string format)
* @param {LGraph} graph
* @param {HTMLCanvas} canvas the canvas where you want to render (it accepts a selector in string format or the canvas itself)
* @param {LGraph} graph [optional]
*/
function LGraphCanvas(canvas, graph)
{
@@ -1897,6 +1909,12 @@ function LGraphCanvas(canvas, graph)
LGraphCanvas.link_type_colors = {'number':"#AAC",'node':"#DCA"};
/**
* clears all the data inside
*
* @method clear
*/
LGraphCanvas.prototype.clear = function()
{
this.frame = 0;
@@ -1946,6 +1964,12 @@ LGraphCanvas.prototype.clear = function()
//this.UIinit();
}
/**
* assigns a graph, you can reasign graphs to the same canvas
*
* @method setGraph
* @param {LGraph} assigns a graph
*/
LGraphCanvas.prototype.setGraph = function(graph)
{
if(this.graph == graph) return;
@@ -1968,6 +1992,12 @@ LGraphCanvas.prototype.setGraph = function(graph)
this.setDirty(true,true);
}
/**
* assigns a canvas
*
* @method setCanvas
* @param {Canvas} assigns a canvas
*/
LGraphCanvas.prototype.setCanvas = function(canvas)
{
var that = this;
@@ -2006,7 +2036,7 @@ LGraphCanvas.prototype.setCanvas = function(canvas)
this._mousemove_callback = this.processMouseMove.bind(this);
this._mouseup_callback = this.processMouseUp.bind(this);
this.canvas.addEventListener("mousedown", this.processMouseDown.bind(this) ); //down do not need to store the binded
this.canvas.addEventListener("mousedown", this.processMouseDown.bind(this), true ); //down do not need to store the binded
this.canvas.addEventListener("mousemove", this._mousemove_callback);
this.canvas.addEventListener("contextmenu", function(e) { e.preventDefault(); return false; });
@@ -2084,6 +2114,14 @@ LGraphCanvas.prototype.UIinit = function()
}
*/
/**
* marks as dirty the canvas, this way it will be rendered again
*
* @class LGraphCanvas
* @method setDirty
* @param {bool} fgcanvas if the foreground canvas is dirty (the one containing the nodes)
* @param {bool} bgcanvas if the background canvas is dirty (the one containing the wires)
*/
LGraphCanvas.prototype.setDirty = function(fgcanvas,bgcanvas)
{
if(fgcanvas)
@@ -2092,13 +2130,23 @@ LGraphCanvas.prototype.setDirty = function(fgcanvas,bgcanvas)
this.dirty_bgcanvas = true;
}
//Used to attach the canvas in a popup
/**
* Used to attach the canvas in a popup
*
* @method getCanvasWindow
* @return {window} returns the window where the canvas is attached (the DOM root node)
*/
LGraphCanvas.prototype.getCanvasWindow = function()
{
var doc = this.canvas.ownerDocument;
return doc.defaultView || doc.parentWindow;
}
/**
* starts rendering the content of the canvas when needed
*
* @method startRendering
*/
LGraphCanvas.prototype.startRendering = function()
{
if(this.is_rendering) return; //already rendering
@@ -2125,6 +2173,11 @@ LGraphCanvas.prototype.startRendering = function()
*/
}
/**
* stops rendering the content of the canvas (to save resources)
*
* @method stopRendering
*/
LGraphCanvas.prototype.stopRendering = function()
{
this.is_rendering = false;
@@ -2149,8 +2202,8 @@ LGraphCanvas.prototype.processMouseDown = function(e)
var document = ref_window.document;
this.canvas.removeEventListener("mousemove", this._mousemove_callback );
ref_window.document.addEventListener("mousemove", this._mousemove_callback ); //catch for the entire window
ref_window.document.addEventListener("mouseup", this._mouseup_callback );
ref_window.document.addEventListener("mousemove", this._mousemove_callback, true ); //catch for the entire window
ref_window.document.addEventListener("mouseup", this._mouseup_callback, true );
var n = this.graph.getNodeOnPos(e.canvasX, e.canvasY, this.visible_nodes);
var skip_dragging = false;
@@ -5429,7 +5482,6 @@ function MathOperation()
this.addInput("A","number");
this.addInput("B","number");
this.addOutput("A+B","number");
this.size = [80,20];
this.properties = {A:1.0, B:1.0};
}
@@ -5535,12 +5587,34 @@ MathCompare.prototype.onGetOutputs = function()
LiteGraph.registerNodeType("math/compare",MathCompare);
function MathAccumulate()
{
this.addInput("inc","number");
this.addOutput("total","number");
this.properties = { increment: 0, value: 0 };
}
MathAccumulate.title = "Accumulate";
MathAccumulate.desc = "Increments a value every time";
MathAccumulate.prototype.onExecute = function()
{
var inc = this.getInputData(0);
if(inc !== null)
this.properties.value += inc;
else
this.properties.value += this.properties.increment;
this.setOutputData(0, this.properties.value );
}
LiteGraph.registerNodeType("math/accumulate", MathAccumulate);
//Math Trigonometry
function MathTrigonometry()
{
this.addInput("v","number");
this.addOutput("sin","number");
this.properties = {amplitude:1.0};
this.properties = {amplitude:1.0, offset: 0};
this.bgImageUrl = "nodes/imgs/icon-sin.png";
}
@@ -5550,7 +5624,15 @@ MathTrigonometry.desc = "Sin Cos Tan";
MathTrigonometry.prototype.onExecute = function()
{
var v = this.getInputData(0);
var amp = this.properties["amplitude"];
var amplitude = this.properties["amplitude"];
var slot = this.findInputSlot("amplitude");
if(slot != -1)
amplitude = this.getInputData(slot);
var offset = this.properties["offset"];
slot = this.findInputSlot("offset");
if(slot != -1)
offset = this.getInputData(slot);
for(var i = 0, l = this.outputs.length; i < l; ++i)
{
var output = this.outputs[i];
@@ -5563,10 +5645,16 @@ MathTrigonometry.prototype.onExecute = function()
case "acos": value = Math.acos(v); break;
case "atan": value = Math.atan(v); break;
}
this.setOutputData(i, amp * value );
this.setOutputData(i, amplitude * value + offset);
}
}
MathTrigonometry.prototype.onGetInputs = function()
{
return [["v","number"],["amplitude","number"],["offset","number"]];
}
MathTrigonometry.prototype.onGetOutputs = function()
{
return [["sin","number"],["cos","number"],["tan","number"],["asin","number"],["acos","number"],["atan","number"]];
@@ -5656,6 +5744,7 @@ if(window.glMatrix)
{
this.addInputs([["x","number"],["y","number"],["z","number"]]);
this.addOutput("vec3","vec3");
this.properties = {x:0, y:0, z:0};
}
Math3DXYZToVec3.title = "XYZ->Vec3";
@@ -5664,11 +5753,11 @@ if(window.glMatrix)
Math3DXYZToVec3.prototype.onExecute = function()
{
var x = this.getInputData(0);
if(x == null) x = 0;
if(x == null) x = this.properties.x;
var y = this.getInputData(1);
if(y == null) y = 0;
if(y == null) y = this.properties.y;
var z = this.getInputData(2);
if(z == null) z = 0;
if(z == null) z = this.properties.z;
this.setOutputData( 0, vec3.fromValues(x,y,z) );
}

View File

@@ -10,8 +10,8 @@ LGraph.prototype.start=function(a){if(this.status!=LGraph.STATUS_RUNNING){this.s
LGraph.prototype.stop=function(){if(this.status!=LGraph.STATUS_STOPPED){this.status=LGraph.STATUS_STOPPED;if(this.onStopEvent)this.onStopEvent();null!=this.execution_timer_id&&clearInterval(this.execution_timer_id);this.execution_timer_id=null;this.sendEventToAllNodes("onStop")}};
LGraph.prototype.runStep=function(a){a=a||1;var b=LiteGraph.getTime();this.globaltime=0.001*(b-this.starttime);try{for(var c=0;c<a;c++)if(this.sendEventToAllNodes("onExecute"),this.fixedtime+=this.fixedtime_lapse,this.onExecuteStep)this.onExecuteStep();if(this.onAfterExecute)this.onAfterExecute();this.errors_in_execution=!1}catch(d){this.errors_in_execution=!0;if(LiteGraph.throw_errors)throw d;LiteGraph.debug&&console.log("Error during execution: "+d);this.stop()}a=LiteGraph.getTime()-b;0==a&&(a=
1);this.elapsed_time=0.001*a;this.globaltime+=0.001*a;this.iteration+=1};LGraph.prototype.updateExecutionOrder=function(){this._nodes_in_order=this.computeExecutionOrder()};
LGraph.prototype.computeExecutionOrder=function(){var a=[],b=[],c={},d={},e={},f;for(f in this._nodes){var g=this._nodes[f];c[g.id]=g;var h=0;if(g.inputs)for(var l=0,k=g.inputs.length;l<k;l++)g.inputs[l]&&null!=g.inputs[l].link&&(h+=1);0==h?b.push(g):e[g.id]=h}for(;0!=b.length;)if(g=b.shift(),a.push(g),delete c[g.id],g.outputs)for(f=0;f<g.outputs.length;f++)if(h=g.outputs[f],null!=h&&null!=h.links&&0!=h.links.length)for(l=0;l<h.links.length;l++)if((k=this.links[h.links[l]])&&!d[k.id]){var n=this.getNodeById(k.target_id);
null==n?d[k.id]=!0:(d[k.id]=!0,e[n.id]-=1,0==e[n.id]&&b.push(n))}for(f in c)a.push(c[f]);a.length!=this._nodes.length&&LiteGraph.debug&&console.log("something went wrong, nodes missing");for(f in a)a[f].order=f;return a};LGraph.prototype.getTime=function(){return this.globaltime};LGraph.prototype.getFixedTime=function(){return this.fixedtime};LGraph.prototype.getElapsedTime=function(){return this.elapsed_time};
LGraph.prototype.computeExecutionOrder=function(){var a=[],b=[],c={},d={},e={},f;for(f in this._nodes){var g=this._nodes[f];c[g.id]=g;var h=0;if(g.inputs)for(var l=0,n=g.inputs.length;l<n;l++)g.inputs[l]&&null!=g.inputs[l].link&&(h+=1);0==h?b.push(g):e[g.id]=h}for(;0!=b.length;)if(g=b.shift(),a.push(g),delete c[g.id],g.outputs)for(f=0;f<g.outputs.length;f++)if(h=g.outputs[f],null!=h&&null!=h.links&&0!=h.links.length)for(l=0;l<h.links.length;l++)if((n=this.links[h.links[l]])&&!d[n.id]){var k=this.getNodeById(n.target_id);
null==k?d[n.id]=!0:(d[n.id]=!0,e[k.id]-=1,0==e[k.id]&&b.push(k))}for(f in c)a.push(c[f]);a.length!=this._nodes.length&&LiteGraph.debug&&console.log("something went wrong, nodes missing");for(f in a)a[f].order=f;return a};LGraph.prototype.getTime=function(){return this.globaltime};LGraph.prototype.getFixedTime=function(){return this.fixedtime};LGraph.prototype.getElapsedTime=function(){return this.elapsed_time};
LGraph.prototype.sendEventToAllNodes=function(a,b){var c=this._nodes_in_order?this._nodes_in_order:this._nodes,d;for(d in c)if(c[d][a])c[d][a](b)};LGraph.prototype.sendActionToCanvas=function(a,b){if(this.list_of_graphcanvas)for(var c in this.list_of_graphcanvas){var d=this.list_of_graphcanvas[c];d[a]&&d[a].apply(d,b)}};
LGraph.prototype.add=function(a,b){if(a&&(-1==a.id||null==this._nodes_by_id[a.id])){if(this._nodes.length>=LiteGraph.MAX_NUMBER_OF_NODES)throw"LiteGraph: max number of nodes in a graph reached";if(null==a.id||-1==a.id)a.id=this.last_node_id++;a.graph=this;this._nodes.push(a);this._nodes_by_id[a.id]=a;if(a.onAdded)a.onAdded();this.config.align_to_grid&&a.alignToGrid();b||this.updateExecutionOrder();if(this.onNodeAdded)this.onNodeAdded(a);this.setDirtyCanvas(!0);this.change();return a}};
LGraph.prototype.remove=function(a){if(null!=this._nodes_by_id[a.id]&&!a.ignore_remove){if(a.inputs)for(var b=0;b<a.inputs.length;b++){var c=a.inputs[b];null!=c.link&&a.disconnectInput(b)}if(a.outputs)for(b=0;b<a.outputs.length;b++)c=a.outputs[b],null!=c.links&&c.links.length&&a.disconnectOutput(b);a.id=-1;if(a.onRemoved)a.onRemoved();a.graph=null;for(b in this.list_of_graphcanvas)c=this.list_of_graphcanvas[b],c.selected_nodes[a.id]&&delete c.selected_nodes[a.id],c.node_dragged==a&&(c.node_dragged=
@@ -53,11 +53,11 @@ LGraphNode.prototype.pin=function(a){this.flags.pinned=void 0===a?!this.flags.pi
LGraphCanvas.prototype.clear=function(){this.fps=this.render_time=this.last_draw_time=this.frame=0;this.scale=1;this.offset=[0,0];this.selected_nodes={};this.connecting_node=this.node_capturing_input=this.node_over=this.node_dragged=null;this.highquality_render=!0;this.editor_alpha=1;this.pause_rendering=!1;this.dirty_bgcanvas=this.dirty_canvas=this.render_shadows=!0;this.dirty_area=null;this.render_only_selected=!0;this.live_mode=!1;this.allow_dragnodes=this.allow_dragcanvas=this.show_info=!0;this.node_in_panel=
null;this.last_mouse=[0,0];this.last_mouseclick=0;this.title_text_font="bold 14px Arial";this.inner_text_font="normal 12px Arial";this.render_connections_shadows=!1;this.render_connection_arrows=this.render_curved_connections=this.render_connections_border=!0;this.connections_width=4;if(this.onClear)this.onClear()};LGraphCanvas.prototype.setGraph=function(a){this.graph!=a&&(this.clear(),!a&&this.graph?this.graph.detachCanvas(this):(a.attachCanvas(this),this.setDirty(!0,!0)))};
LGraphCanvas.prototype.setCanvas=function(a){var b=this;"string"==typeof a&&(a=document.getElementById(a));if(null==a)throw"Error creating LiteGraph canvas: Canvas not found";if(a!=this.canvas){this.canvas=a;this.canvas.className+=" lgraphcanvas";this.canvas.data=this;this.bgcanvas=null;this.bgcanvas||(this.bgcanvas=document.createElement("canvas"),this.bgcanvas.width=this.canvas.width,this.bgcanvas.height=this.canvas.height);if(null==this.canvas.getContext)throw"This browser doesnt support Canvas";
this.ctx=this.canvas.getContext("2d");this.bgctx=this.bgcanvas.getContext("2d");this._mousemove_callback=this.processMouseMove.bind(this);this._mouseup_callback=this.processMouseUp.bind(this);this.canvas.addEventListener("mousedown",this.processMouseDown.bind(this));this.canvas.addEventListener("mousemove",this._mousemove_callback);this.canvas.addEventListener("contextmenu",function(a){a.preventDefault();return!1});this.canvas.addEventListener("mousewheel",this.processMouseWheel.bind(this),!1);this.canvas.addEventListener("DOMMouseScroll",
this.processMouseWheel.bind(this),!1);this.canvas.addEventListener("touchstart",this.touchHandler,!0);this.canvas.addEventListener("touchmove",this.touchHandler,!0);this.canvas.addEventListener("touchend",this.touchHandler,!0);this.canvas.addEventListener("touchcancel",this.touchHandler,!0);this.canvas.addEventListener("keydown",function(a){b.processKeyDown(a)});this.canvas.addEventListener("keyup",function(a){b.processKeyUp(a)})}};
this.ctx=this.canvas.getContext("2d");this.bgctx=this.bgcanvas.getContext("2d");this._mousemove_callback=this.processMouseMove.bind(this);this._mouseup_callback=this.processMouseUp.bind(this);this.canvas.addEventListener("mousedown",this.processMouseDown.bind(this),!0);this.canvas.addEventListener("mousemove",this._mousemove_callback);this.canvas.addEventListener("contextmenu",function(a){a.preventDefault();return!1});this.canvas.addEventListener("mousewheel",this.processMouseWheel.bind(this),!1);
this.canvas.addEventListener("DOMMouseScroll",this.processMouseWheel.bind(this),!1);this.canvas.addEventListener("touchstart",this.touchHandler,!0);this.canvas.addEventListener("touchmove",this.touchHandler,!0);this.canvas.addEventListener("touchend",this.touchHandler,!0);this.canvas.addEventListener("touchcancel",this.touchHandler,!0);this.canvas.addEventListener("keydown",function(a){b.processKeyDown(a)});this.canvas.addEventListener("keyup",function(a){b.processKeyUp(a)})}};
LGraphCanvas.prototype.setDirty=function(a,b){a&&(this.dirty_canvas=!0);b&&(this.dirty_bgcanvas=!0)};LGraphCanvas.prototype.getCanvasWindow=function(){var a=this.canvas.ownerDocument;return a.defaultView||a.parentWindow};LGraphCanvas.prototype.startRendering=function(){function a(){this.pause_rendering||this.draw();var b=this.getCanvasWindow();this.is_rendering&&b.requestAnimationFrame(a.bind(this))}this.is_rendering||(this.is_rendering=!0,a.call(this))};
LGraphCanvas.prototype.stopRendering=function(){this.is_rendering=!1};
LGraphCanvas.prototype.processMouseDown=function(a){if(this.graph){this.adjustMouseEvent(a);var b=this.getCanvasWindow();this.canvas.removeEventListener("mousemove",this._mousemove_callback);b.document.addEventListener("mousemove",this._mousemove_callback);b.document.addEventListener("mouseup",this._mouseup_callback);var c=this.graph.getNodeOnPos(a.canvasX,a.canvasY,this.visible_nodes);if(1==a.which){if(!a.shiftKey){var d=[],e;for(e in this.selected_nodes)this.selected_nodes[e]!=c&&d.push(this.selected_nodes[e]);
LGraphCanvas.prototype.processMouseDown=function(a){if(this.graph){this.adjustMouseEvent(a);var b=this.getCanvasWindow();this.canvas.removeEventListener("mousemove",this._mousemove_callback);b.document.addEventListener("mousemove",this._mousemove_callback,!0);b.document.addEventListener("mouseup",this._mouseup_callback,!0);var c=this.graph.getNodeOnPos(a.canvasX,a.canvasY,this.visible_nodes);if(1==a.which){if(!a.shiftKey){var d=[],e;for(e in this.selected_nodes)this.selected_nodes[e]!=c&&d.push(this.selected_nodes[e]);
for(e in d)this.processNodeDeselected(d[e])}d=!1;if(c){this.live_mode||c.flags.pinned||this.bringToFront(c);var f=!1;if(!this.connecting_node&&!c.flags.collapsed&&!this.live_mode){if(c.outputs){e=0;for(var g=c.outputs.length;e<g;++e){var h=c.outputs[e],l=c.getConnectionPos(!1,e);if(isInsideRectangle(a.canvasX,a.canvasY,l[0]-10,l[1]-5,20,10)){this.connecting_node=c;this.connecting_output=h;this.connecting_pos=c.getConnectionPos(!1,e);this.connecting_slot=e;f=!0;break}}}if(c.inputs)for(e=0,g=c.inputs.length;e<
g;++e)h=c.inputs[e],l=c.getConnectionPos(!0,e),isInsideRectangle(a.canvasX,a.canvasY,l[0]-10,l[1]-5,20,10)&&h.link&&(c.disconnectInput(e),f=this.dirty_bgcanvas=!0);!f&&isInsideRectangle(a.canvasX,a.canvasY,c.pos[0]+c.size[0]-5,c.pos[1]+c.size[1]-5,5,5)&&(this.resizing_node=c,this.canvas.style.cursor="se-resize",f=!0)}if(!f){e=!1;if(300>LiteGraph.getTime()-this.last_mouseclick&&this.selected_nodes[c.id]){if(c.onDblClick)c.onDblClick(a);this.processNodeDblClicked(c);e=!0}c.onMouseDown&&c.onMouseDown(a)?
e=!0:this.live_mode&&(e=d=!0);e||(this.allow_dragnodes&&(this.node_dragged=c),this.selected_nodes[c.id]||this.processNodeSelected(c,a));this.dirty_canvas=!0}}else d=!0;d&&this.allow_dragcanvas&&(this.dragging_canvas=!0)}else 2!=a.which&&3==a.which&&this.processContextualMenu(c,a);this.last_mouse[0]=a.localX;this.last_mouse[1]=a.localY;this.last_mouseclick=LiteGraph.getTime();this.canvas_mouse=[a.canvasX,a.canvasY];this.graph.change();(!b.document.activeElement||"input"!=b.document.activeElement.nodeName.toLowerCase()&&
@@ -105,8 +105,8 @@ c[1]),a.stroke()};LGraphCanvas.prototype.computeConnectionPoint=function(a,b,c){
LGraphCanvas.prototype.resize=function(a,b){if(!a&&!b){var c=this.canvas.parentNode;a=c.offsetWidth;b=c.offsetHeight}if(this.canvas.width!=a||this.canvas.height!=b)this.canvas.width=a,this.canvas.height=b,this.bgcanvas.width=this.canvas.width,this.bgcanvas.height=this.canvas.height,this.setDirty(!0,!0)};
LGraphCanvas.prototype.switchLiveMode=function(a){if(a){var b=this,c=this.live_mode?1.1:0.9;this.live_mode&&(this.live_mode=!1,this.editor_alpha=0.1);var d=setInterval(function(){b.editor_alpha*=c;b.dirty_canvas=!0;b.dirty_bgcanvas=!0;1>c&&0.01>b.editor_alpha&&(clearInterval(d),1>c&&(b.live_mode=!0));1<c&&0.99<b.editor_alpha&&(clearInterval(d),b.editor_alpha=1)},1)}else this.live_mode=!this.live_mode,this.dirty_bgcanvas=this.dirty_canvas=!0};LGraphCanvas.prototype.onNodeSelectionChange=function(a){};
LGraphCanvas.prototype.touchHandler=function(a){var b=a.changedTouches[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var d=this.getCanvasWindow(),e=d.document.createEvent("MouseEvent");e.initMouseEvent(c,!0,!0,d,1,b.screenX,b.screenY,b.clientX,b.clientY,!1,!1,!1,!1,0,null);b.target.dispatchEvent(e);a.preventDefault()};
LGraphCanvas.onMenuAdd=function(a,b,c,d,e){function f(a,b){var c=LiteGraph.createNode(a.value);c&&(c.pos=d.convertEventToCanvas(e),d.graph.add(c))}var g=d.getCanvasWindow();a=LiteGraph.getNodeTypesCategories();var h={},l;for(l in a)a[l]&&(h[l]={value:a[l],content:a[l],is_menu:!0});var k=LiteGraph.createContextualMenu(h,{event:b,callback:function(a,b){var c=LiteGraph.getNodeTypesInCategory(a.value),d=[],e;for(e in c)d.push({content:c[e].title,value:c[e].type});LiteGraph.createContextualMenu(d,{event:b,
callback:f,from:k},g);return!1},from:c},g);return!1};LGraphCanvas.onMenuCollapseAll=function(){};LGraphCanvas.onMenuNodeEdit=function(){};LGraphCanvas.onMenuNodeInputs=function(a,b,c){function d(b){a&&a.addInput(b.value[0],b.value[1],b.value[2])}if(a){var e=a.optional_inputs;a.onGetInputs&&(e=a.onGetInputs());if(e){var f=[],g;for(g in e){var h=e[g],l=h[0];h[2]&&h[2].label&&(l=h[2].label);f.push({content:l,value:h})}LiteGraph.createContextualMenu(f,{event:b,callback:d,from:c})}return!1}};
LGraphCanvas.onMenuAdd=function(a,b,c,d,e){function f(a,b){var c=LiteGraph.createNode(a.value);c&&(c.pos=d.convertEventToCanvas(e),d.graph.add(c))}var g=d.getCanvasWindow();a=LiteGraph.getNodeTypesCategories();var h={},l;for(l in a)a[l]&&(h[l]={value:a[l],content:a[l],is_menu:!0});var n=LiteGraph.createContextualMenu(h,{event:b,callback:function(a,b){var c=LiteGraph.getNodeTypesInCategory(a.value),d=[],e;for(e in c)d.push({content:c[e].title,value:c[e].type});LiteGraph.createContextualMenu(d,{event:b,
callback:f,from:n},g);return!1},from:c},g);return!1};LGraphCanvas.onMenuCollapseAll=function(){};LGraphCanvas.onMenuNodeEdit=function(){};LGraphCanvas.onMenuNodeInputs=function(a,b,c){function d(b){a&&a.addInput(b.value[0],b.value[1],b.value[2])}if(a){var e=a.optional_inputs;a.onGetInputs&&(e=a.onGetInputs());if(e){var f=[],g;for(g in e){var h=e[g],l=h[0];h[2]&&h[2].label&&(l=h[2].label);f.push({content:l,value:h})}LiteGraph.createContextualMenu(f,{event:b,callback:d,from:c})}return!1}};
LGraphCanvas.onMenuNodeOutputs=function(a,b,c){function d(f){if(a){var e=f.value[1];if(!e||e.constructor!==Object&&e.constructor!==Array)a.addOutput(f.value[0],f.value[1]);else{f=[];for(var g in e)f.push({content:g,value:e[g]});LiteGraph.createContextualMenu(f,{event:b,callback:d,from:c});return!1}}}if(a){var e=a.optional_outputs;a.onGetOutputs&&(e=a.onGetOutputs());if(e){var f=[],g;for(g in e)-1==a.findOutputSlot(e[g][0])&&f.push({content:e[g][0],value:e[g]});f.length&&LiteGraph.createContextualMenu(f,
{event:b,callback:d,from:c})}return!1}};LGraphCanvas.onMenuNodeCollapse=function(a){a.flags.collapsed=!a.flags.collapsed;a.setDirtyCanvas(!0,!0)};LGraphCanvas.onMenuNodePin=function(a){a.pin()};
LGraphCanvas.onMenuNodeColors=function(a,b,c){var d=[],e;for(e in LGraphCanvas.node_colors){var f=LGraphCanvas.node_colors[e];d.push({value:e,content:"<span style='display: block; color:"+f.color+"; background-color:"+f.bgcolor+"'>"+e+"</span>"})}LiteGraph.createContextualMenu(d,{event:b,callback:function(b){a&&(b=LGraphCanvas.node_colors[b.value])&&(a.color=b.color,a.bgcolor=b.bgcolor,a.setDirtyCanvas(!0))},from:c});return!1};
@@ -147,20 +147,21 @@ function(a,b){this.properties[a]=b;this.str="number"==typeof b?b.toFixed(3):b;re
this.properties.bgcolorBottom))};e.prototype.onDrawForeground=function(a){null==this.lineargradient&&this.createGradient(a);this.lineargradient&&(a.lineWidth=1,a.strokeStyle=this.properties.borderColor,a.fillStyle=this.lineargradient,this.properties.shadowSize?(a.shadowColor="#000",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=this.properties.shadowSize):a.shadowColor="transparent",a.roundRect(0,0,this.size[0]-1,this.size[1]-1,this.properties.shadowSize),a.fill(),a.shadowColor="transparent",a.stroke())};
e.prototype.onWidget=function(a,b){"update"==b.name&&(this.lineargradient=null,this.setDirtyCanvas(!0))};LiteGraph.registerNodeType("widget/panel",e)})();
(function(){function a(){this.addOutput("value","number");this.properties={min:0,max:1};this.size=[60,20]}function b(){this.addInput("in","number");this.addOutput("out","number");this.size=[60,20];this.properties={min:0,max:1}}function c(){this.addInput("in","number");this.addOutput("out","number");this.size=[60,20]}function d(){this.addInput("in","number");this.addOutput("out","number");this.size=[60,20]}function e(){this.addInput("in","number");this.addOutput("out","number");this.size=[60,20]}function f(){this.addInput("in",
"number",{label:""});this.addOutput("out","number",{label:""});this.size=[60,20];this.properties={factor:1}}function g(){this.addInput("A","number");this.addInput("B","number");this.addOutput("A+B","number");this.size=[80,20];this.properties={A:1,B:1}}function h(){this.addInputs("A","number");this.addInputs("B","number");this.addOutputs("A==B","number");this.addOutputs("A!=B","number");this.properties={A:0,B:0}}function l(){this.addInput("v","number");this.addOutput("sin","number");this.properties=
{amplitude:1};this.bgImageUrl="nodes/imgs/icon-sin.png"}a.title="Rand";a.desc="Random number";a.prototype.onExecute=function(){var a=this.properties.min,b=this.properties.max;this._last_v=Math.random()*(b-a)+a;this.setOutputData(0,this._last_v)};a.prototype.onDrawBackground=function(a){this.outputs[0].label=this._last_v?this._last_v.toFixed(3):"?"};LiteGraph.registerNodeType("math/rand",a);b.title="Clamp";b.desc="Clamp number between min and max";b.prototype.onExecute=function(){var a=this.getInputData(0);
null!=a&&(a=Math.max(this.properties.min,a),a=Math.min(this.properties.max,a),this.setOutputData(0,a))};LiteGraph.registerNodeType("math/clamp",b);c.title="Abs";c.desc="Absolute";c.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,Math.abs(a))};LiteGraph.registerNodeType("math/abs",c);d.title="Floor";d.desc="Floor number to remove fractional part";d.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a|1)};LiteGraph.registerNodeType("math/floor",
d);e.title="Frac";e.desc="Returns fractional part";e.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a%1)};LiteGraph.registerNodeType("math/frac",e);f.title="Scale";f.desc="v * factor";f.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a*this.properties.factor)};LiteGraph.registerNodeType("math/scale",f);g.title="Operation";g.desc="Easy math operators";g.prototype.setValue=function(a){"string"==typeof a&&(a=parseFloat(a));
this.properties.value=a;this.setDirtyCanvas(!0)};g.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;for(var c=0,d=this.outputs.length;c<d;++c){var e=this.outputs[c];if(e.links&&e.links.length){var f=0;switch(e.name){case "A+B":f=a+b;break;case "A-B":f=a-b;break;case "A*B":f=a*b;break;case "A/B":f=a/b}this.setOutputData(c,f)}}};g.prototype.onGetOutputs=function(){return[["A-B",
"number"],["A*B","number"],["A/B","number"]]};LiteGraph.registerNodeType("math/operation",g);h.title="Compare";h.desc="compares between two values";h.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;for(var c=0,d=this.outputs.length;c<d;++c){var e=this.outputs[c];if(e.links&&e.links.length){switch(e.name){case "A==B":value=a==b;break;case "A!=B":value=a!=b;break;case "A>B":value=
a>b;break;case "A<B":value=a<b;break;case "A<=B":value=a<=b;break;case "A>=B":value=a>=b}this.setOutputData(c,value)}}};h.prototype.onGetOutputs=function(){return[["A==B","number"],["A!=B","number"],["A>B","number"],["A<B","number"],["A>=B","number"],["A<=B","number"]]};LiteGraph.registerNodeType("math/compare",h);l.title="Trigonometry";l.desc="Sin Cos Tan";l.prototype.onExecute=function(){for(var a=this.getInputData(0),b=this.properties.amplitude,c=0,d=this.outputs.length;c<d;++c){switch(this.outputs[c].name){case "sin":value=
Math.sin(a);break;case "cos":value=Math.cos(a);break;case "tan":value=Math.tan(a);break;case "asin":value=Math.asin(a);break;case "acos":value=Math.acos(a);break;case "atan":value=Math.atan(a)}this.setOutputData(c,b*value)}};l.prototype.onGetOutputs=function(){return[["sin","number"],["cos","number"],["tan","number"],["asin","number"],["acos","number"],["atan","number"]]};LiteGraph.registerNodeType("math/trigonometry",l);if(window.math){var k=function(){this.addInputs("x","number");this.addInputs("y",
"number");this.addOutputs("","number");this.properties={x:1,y:1,formula:"x+y"}};k.title="Formula";k.desc="Compute safe formula";k.prototype.onExecute=function(){var a=this.getInputData(0),b=this.getInputData(1);null!=a?this.properties.x=a:a=this.properties.x;null!=b?this.properties.y=b:b=this.properties.y;a=math.eval(this.properties.formula,{x:a,y:b,T:this.graph.globaltime});this.setOutputData(0,a)};k.prototype.onDrawBackground=function(){this.outputs[0].label=this.properties.formula};k.prototype.onGetOutputs=
function(){return[["A-B","number"],["A*B","number"],["A/B","number"]]};LiteGraph.registerNodeType("math/formula",k)}window.glMatrix&&(k=function(){this.addInput("vec3","vec3");this.addOutput("x","number");this.addOutput("y","number");this.addOutput("z","number")},k.title="Vec3->XYZ",k.desc="vector 3 to components",k.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&(this.setOutputData(0,a[0]),this.setOutputData(1,a[1]),this.setOutputData(2,a[2]))},LiteGraph.registerNodeType("math3d/vec3-to-xyz",
k),k=function(){this.addInputs([["x","number"],["y","number"],["z","number"]]);this.addOutput("vec3","vec3")},k.title="XYZ->Vec3",k.desc="components to vector3",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=0);var b=this.getInputData(1);null==b&&(b=0);var c=this.getInputData(2);null==c&&(c=0);this.setOutputData(0,vec3.fromValues(a,b,c))},LiteGraph.registerNodeType("math3d/xyz-to-vec3",k),k=function(){this.addInputs([["degrees","number"],["axis","vec3"]]);this.addOutput("quat",
"quat");this.properties={angle:90,axis:vec3.fromValues(0,1,0)}},k.title="Rotation",k.desc="quaternion rotation",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=this.properties.angle);var b=this.getInputData(1);null==b&&(b=this.properties.axis);a=quat.setAxisAngle(quat.create(),b,0.0174532925*a);this.setOutputData(0,a)},LiteGraph.registerNodeType("math3d/rotation",k),k=function(){this.addInputs([["vec3","vec3"],["quat","quat"]]);this.addOutput("result","vec3");this.properties=
{vec:[0,0,1]}},k.title="Rot. Vec3",k.desc="rotate a point",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=this.properties.vec);var b=this.getInputData(1);null==b?this.setOutputData(a):this.setOutputData(0,vec3.transformQuat(vec3.create(),a,b))},LiteGraph.registerNodeType("math3d/rotate_vec3",k),k=function(){this.addInputs([["A","quat"],["B","quat"]]);this.addOutput("A*B","quat")},k.title="Mult. Quat",k.desc="rotate quaternion",k.prototype.onExecute=function(){var a=this.getInputData(0);
if(null!=a){var b=this.getInputData(1);null!=b&&(a=quat.multiply(quat.create(),a,b),this.setOutputData(0,a))}},LiteGraph.registerNodeType("math3d/mult-quat",k))})();
"number",{label:""});this.addOutput("out","number",{label:""});this.size=[60,20];this.properties={factor:1}}function g(){this.addInput("A","number");this.addInput("B","number");this.addOutput("A+B","number");this.properties={A:1,B:1}}function h(){this.addInputs("A","number");this.addInputs("B","number");this.addOutputs("A==B","number");this.addOutputs("A!=B","number");this.properties={A:0,B:0}}function l(){this.addInput("inc","number");this.addOutput("total","number");this.properties={increment:0,
value:0}}function n(){this.addInput("v","number");this.addOutput("sin","number");this.properties={amplitude:1,offset:0};this.bgImageUrl="nodes/imgs/icon-sin.png"}a.title="Rand";a.desc="Random number";a.prototype.onExecute=function(){var a=this.properties.min,b=this.properties.max;this._last_v=Math.random()*(b-a)+a;this.setOutputData(0,this._last_v)};a.prototype.onDrawBackground=function(a){this.outputs[0].label=this._last_v?this._last_v.toFixed(3):"?"};LiteGraph.registerNodeType("math/rand",a);b.title=
"Clamp";b.desc="Clamp number between min and max";b.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&(a=Math.max(this.properties.min,a),a=Math.min(this.properties.max,a),this.setOutputData(0,a))};LiteGraph.registerNodeType("math/clamp",b);c.title="Abs";c.desc="Absolute";c.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,Math.abs(a))};LiteGraph.registerNodeType("math/abs",c);d.title="Floor";d.desc="Floor number to remove fractional part";d.prototype.onExecute=
function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a|1)};LiteGraph.registerNodeType("math/floor",d);e.title="Frac";e.desc="Returns fractional part";e.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a%1)};LiteGraph.registerNodeType("math/frac",e);f.title="Scale";f.desc="v * factor";f.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&this.setOutputData(0,a*this.properties.factor)};LiteGraph.registerNodeType("math/scale",f);g.title=
"Operation";g.desc="Easy math operators";g.prototype.setValue=function(a){"string"==typeof a&&(a=parseFloat(a));this.properties.value=a;this.setDirtyCanvas(!0)};g.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;for(var c=0,d=this.outputs.length;c<d;++c){var e=this.outputs[c];if(e.links&&e.links.length){var f=0;switch(e.name){case "A+B":f=a+b;break;case "A-B":f=a-b;break;
case "A*B":f=a*b;break;case "A/B":f=a/b}this.setOutputData(c,f)}}};g.prototype.onGetOutputs=function(){return[["A-B","number"],["A*B","number"],["A/B","number"]]};LiteGraph.registerNodeType("math/operation",g);h.title="Compare";h.desc="compares between two values";h.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;for(var c=0,d=this.outputs.length;c<d;++c){var e=this.outputs[c];
if(e.links&&e.links.length){switch(e.name){case "A==B":value=a==b;break;case "A!=B":value=a!=b;break;case "A>B":value=a>b;break;case "A<B":value=a<b;break;case "A<=B":value=a<=b;break;case "A>=B":value=a>=b}this.setOutputData(c,value)}}};h.prototype.onGetOutputs=function(){return[["A==B","number"],["A!=B","number"],["A>B","number"],["A<B","number"],["A>=B","number"],["A<=B","number"]]};LiteGraph.registerNodeType("math/compare",h);l.title="Accumulate";l.desc="Increments a value every time";l.prototype.onExecute=
function(){var a=this.getInputData(0);this.properties.value=null!==a?this.properties.value+a:this.properties.value+this.properties.increment;this.setOutputData(0,this.properties.value)};LiteGraph.registerNodeType("math/accumulate",l);n.title="Trigonometry";n.desc="Sin Cos Tan";n.prototype.onExecute=function(){var a=this.getInputData(0),b=this.properties.amplitude,c=this.findInputSlot("amplitude");-1!=c&&(b=this.getInputData(c));var d=this.properties.offset,c=this.findInputSlot("offset");-1!=c&&(d=
this.getInputData(c));for(var c=0,e=this.outputs.length;c<e;++c){switch(this.outputs[c].name){case "sin":value=Math.sin(a);break;case "cos":value=Math.cos(a);break;case "tan":value=Math.tan(a);break;case "asin":value=Math.asin(a);break;case "acos":value=Math.acos(a);break;case "atan":value=Math.atan(a)}this.setOutputData(c,b*value+d)}};n.prototype.onGetInputs=function(){return[["v","number"],["amplitude","number"],["offset","number"]]};n.prototype.onGetOutputs=function(){return[["sin","number"],["cos",
"number"],["tan","number"],["asin","number"],["acos","number"],["atan","number"]]};LiteGraph.registerNodeType("math/trigonometry",n);if(window.math){var k=function(){this.addInputs("x","number");this.addInputs("y","number");this.addOutputs("","number");this.properties={x:1,y:1,formula:"x+y"}};k.title="Formula";k.desc="Compute safe formula";k.prototype.onExecute=function(){var a=this.getInputData(0),b=this.getInputData(1);null!=a?this.properties.x=a:a=this.properties.x;null!=b?this.properties.y=b:
b=this.properties.y;a=math.eval(this.properties.formula,{x:a,y:b,T:this.graph.globaltime});this.setOutputData(0,a)};k.prototype.onDrawBackground=function(){this.outputs[0].label=this.properties.formula};k.prototype.onGetOutputs=function(){return[["A-B","number"],["A*B","number"],["A/B","number"]]};LiteGraph.registerNodeType("math/formula",k)}window.glMatrix&&(k=function(){this.addInput("vec3","vec3");this.addOutput("x","number");this.addOutput("y","number");this.addOutput("z","number")},k.title="Vec3->XYZ",
k.desc="vector 3 to components",k.prototype.onExecute=function(){var a=this.getInputData(0);null!=a&&(this.setOutputData(0,a[0]),this.setOutputData(1,a[1]),this.setOutputData(2,a[2]))},LiteGraph.registerNodeType("math3d/vec3-to-xyz",k),k=function(){this.addInputs([["x","number"],["y","number"],["z","number"]]);this.addOutput("vec3","vec3");this.properties={x:0,y:0,z:0}},k.title="XYZ->Vec3",k.desc="components to vector3",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=this.properties.x);
var b=this.getInputData(1);null==b&&(b=this.properties.y);var c=this.getInputData(2);null==c&&(c=this.properties.z);this.setOutputData(0,vec3.fromValues(a,b,c))},LiteGraph.registerNodeType("math3d/xyz-to-vec3",k),k=function(){this.addInputs([["degrees","number"],["axis","vec3"]]);this.addOutput("quat","quat");this.properties={angle:90,axis:vec3.fromValues(0,1,0)}},k.title="Rotation",k.desc="quaternion rotation",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=this.properties.angle);
var b=this.getInputData(1);null==b&&(b=this.properties.axis);a=quat.setAxisAngle(quat.create(),b,0.0174532925*a);this.setOutputData(0,a)},LiteGraph.registerNodeType("math3d/rotation",k),k=function(){this.addInputs([["vec3","vec3"],["quat","quat"]]);this.addOutput("result","vec3");this.properties={vec:[0,0,1]}},k.title="Rot. Vec3",k.desc="rotate a point",k.prototype.onExecute=function(){var a=this.getInputData(0);null==a&&(a=this.properties.vec);var b=this.getInputData(1);null==b?this.setOutputData(a):
this.setOutputData(0,vec3.transformQuat(vec3.create(),a,b))},LiteGraph.registerNodeType("math3d/rotate_vec3",k),k=function(){this.addInputs([["A","quat"],["B","quat"]]);this.addOutput("A*B","quat")},k.title="Mult. Quat",k.desc="rotate quaternion",k.prototype.onExecute=function(){var a=this.getInputData(0);if(null!=a){var b=this.getInputData(1);null!=b&&(a=quat.multiply(quat.create(),a,b),this.setOutputData(0,a))}},LiteGraph.registerNodeType("math3d/mult-quat",k))})();
(function(){function a(){this.addInput("f","number");this.addOutput("Color","color");this.properties={colorA:"#444444",colorB:"#44AAFF",colorC:"#44FFAA",colorD:"#FFFFFF"}}function b(){this.addInput("","image");this.size=[200,200]}function c(){this.addInputs([["img1","image"],["img2","image"],["fade","number"]]);this.addInput("","image");this.properties={fade:0.5,width:512,height:512}}function d(){this.inputs=[];this.addOutput("frame","image");this.properties={url:""}}function e(){this.addInput("",
"image");this.addOutputs("","image");this.properties={width:256,height:256,x:0,y:0,scale:1};this.size=[50,20]}function f(){this.addInput("t","number");this.addOutputs([["frame","image"],["t","number"],["d","number"]]);this.properties={url:""}}function g(){this.addOutput("Webcam","image");this.properties={}}a.title="Palette";a.desc="Generates a color";a.prototype.onExecute=function(){var a=[];null!=this.properties.colorA&&a.push(hex2num(this.properties.colorA));null!=this.properties.colorB&&a.push(hex2num(this.properties.colorB));
null!=this.properties.colorC&&a.push(hex2num(this.properties.colorC));null!=this.properties.colorD&&a.push(hex2num(this.properties.colorD));var b=this.getInputData(0);null==b&&(b=0.5);1<b?b=1:0>b&&(b=0);if(0!=a.length){var c=[0,0,0];if(0==b)c=a[0];else if(1==b)c=a[a.length-1];else{var d=(a.length-1)*b,b=a[Math.floor(d)],a=a[Math.floor(d)+1],d=d-Math.floor(d);c[0]=b[0]*(1-d)+a[0]*d;c[1]=b[1]*(1-d)+a[1]*d;c[2]=b[2]*(1-d)+a[2]*d}for(var e in c)c[e]/=255;this.boxcolor=colorToString(c);this.setOutputData(0,

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l299"><code>..&#x2F;src&#x2F;litegraph.js:299</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l227"><code>..&#x2F;src&#x2F;litegraph.js:227</code></a>
</div>
@@ -147,7 +147,7 @@
<a href="../files/.._src_litegraph.js.html#l299"><code>..&#x2F;src&#x2F;litegraph.js:299</code></a>
<a href="../files/.._src_litegraph.js.html#l227"><code>..&#x2F;src&#x2F;litegraph.js:227</code></a>
</p>
@@ -405,7 +405,7 @@
<a href="../files/.._src_litegraph.js.html#l645"><code>..&#x2F;src&#x2F;litegraph.js:645</code></a>
<a href="../files/.._src_litegraph.js.html#l582"><code>..&#x2F;src&#x2F;litegraph.js:582</code></a>
</p>
@@ -494,7 +494,7 @@
<a href="../files/.._src_litegraph.js.html#l361"><code>..&#x2F;src&#x2F;litegraph.js:361</code></a>
<a href="../files/.._src_litegraph.js.html#l296"><code>..&#x2F;src&#x2F;litegraph.js:296</code></a>
</p>
@@ -572,7 +572,7 @@
<a href="../files/.._src_litegraph.js.html#l317"><code>..&#x2F;src&#x2F;litegraph.js:317</code></a>
<a href="../files/.._src_litegraph.js.html#l251"><code>..&#x2F;src&#x2F;litegraph.js:251</code></a>
</p>
@@ -637,7 +637,7 @@
<a href="../files/.._src_litegraph.js.html#l920"><code>..&#x2F;src&#x2F;litegraph.js:920</code></a>
<a href="../files/.._src_litegraph.js.html#l922"><code>..&#x2F;src&#x2F;litegraph.js:922</code></a>
</p>
@@ -726,7 +726,7 @@
<a href="../files/.._src_litegraph.js.html#l380"><code>..&#x2F;src&#x2F;litegraph.js:380</code></a>
<a href="../files/.._src_litegraph.js.html#l315"><code>..&#x2F;src&#x2F;litegraph.js:315</code></a>
</p>
@@ -818,7 +818,7 @@
<a href="../files/.._src_litegraph.js.html#l780"><code>..&#x2F;src&#x2F;litegraph.js:780</code></a>
<a href="../files/.._src_litegraph.js.html#l726"><code>..&#x2F;src&#x2F;litegraph.js:726</code></a>
</p>
@@ -925,7 +925,7 @@
<a href="../files/.._src_litegraph.js.html#l764"><code>..&#x2F;src&#x2F;litegraph.js:764</code></a>
<a href="../files/.._src_litegraph.js.html#l710"><code>..&#x2F;src&#x2F;litegraph.js:710</code></a>
</p>
@@ -1022,7 +1022,7 @@
<a href="../files/.._src_litegraph.js.html#l605"><code>..&#x2F;src&#x2F;litegraph.js:605</code></a>
<a href="../files/.._src_litegraph.js.html#l542"><code>..&#x2F;src&#x2F;litegraph.js:542</code></a>
</p>
@@ -1096,7 +1096,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l594"><code>..&#x2F;src&#x2F;litegraph.js:594</code></a>
<a href="../files/.._src_litegraph.js.html#l531"><code>..&#x2F;src&#x2F;litegraph.js:531</code></a>
</p>
@@ -1175,7 +1175,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l751"><code>..&#x2F;src&#x2F;litegraph.js:751</code></a>
<a href="../files/.._src_litegraph.js.html#l697"><code>..&#x2F;src&#x2F;litegraph.js:697</code></a>
</p>
@@ -1279,7 +1279,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l796"><code>..&#x2F;src&#x2F;litegraph.js:796</code></a>
<a href="../files/.._src_litegraph.js.html#l742"><code>..&#x2F;src&#x2F;litegraph.js:742</code></a>
</p>
@@ -1408,7 +1408,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l583"><code>..&#x2F;src&#x2F;litegraph.js:583</code></a>
<a href="../files/.._src_litegraph.js.html#l520"><code>..&#x2F;src&#x2F;litegraph.js:520</code></a>
</p>
@@ -1477,7 +1477,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l869"><code>..&#x2F;src&#x2F;litegraph.js:869</code></a>
<a href="../files/.._src_litegraph.js.html#l856"><code>..&#x2F;src&#x2F;litegraph.js:856</code></a>
</p>
@@ -1542,7 +1542,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l690"><code>..&#x2F;src&#x2F;litegraph.js:690</code></a>
<a href="../files/.._src_litegraph.js.html#l631"><code>..&#x2F;src&#x2F;litegraph.js:631</code></a>
</p>
@@ -1631,7 +1631,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l443"><code>..&#x2F;src&#x2F;litegraph.js:443</code></a>
<a href="../files/.._src_litegraph.js.html#l378"><code>..&#x2F;src&#x2F;litegraph.js:378</code></a>
</p>
@@ -1726,7 +1726,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l617"><code>..&#x2F;src&#x2F;litegraph.js:617</code></a>
<a href="../files/.._src_litegraph.js.html#l554"><code>..&#x2F;src&#x2F;litegraph.js:554</code></a>
</p>
@@ -1825,7 +1825,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l893"><code>..&#x2F;src&#x2F;litegraph.js:893</code></a>
<a href="../files/.._src_litegraph.js.html#l889"><code>..&#x2F;src&#x2F;litegraph.js:889</code></a>
</p>
@@ -1910,7 +1910,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l817"><code>..&#x2F;src&#x2F;litegraph.js:817</code></a>
<a href="../files/.._src_litegraph.js.html#l804"><code>..&#x2F;src&#x2F;litegraph.js:804</code></a>
</p>
@@ -2020,7 +2020,7 @@ can be easily accesed from the outside of the graph</p>
<a href="../files/.._src_litegraph.js.html#l832"><code>..&#x2F;src&#x2F;litegraph.js:832</code></a>
<a href="../files/.._src_litegraph.js.html#l819"><code>..&#x2F;src&#x2F;litegraph.js:819</code></a>
</p>
@@ -2123,7 +2123,7 @@ can be easily accesed from the outside of the graph</p>
<a href="../files/.._src_litegraph.js.html#l394"><code>..&#x2F;src&#x2F;litegraph.js:394</code></a>
<a href="../files/.._src_litegraph.js.html#l329"><code>..&#x2F;src&#x2F;litegraph.js:329</code></a>
</p>
@@ -2202,7 +2202,7 @@ can be easily accesed from the outside of the graph</p>
<a href="../files/.._src_litegraph.js.html#l421"><code>..&#x2F;src&#x2F;litegraph.js:421</code></a>
<a href="../files/.._src_litegraph.js.html#l356"><code>..&#x2F;src&#x2F;litegraph.js:356</code></a>
</p>
@@ -2257,7 +2257,7 @@ can be easily accesed from the outside of the graph</p>
<a href="../files/.._src_litegraph.js.html#l487"><code>..&#x2F;src&#x2F;litegraph.js:487</code></a>
<a href="../files/.._src_litegraph.js.html#l422"><code>..&#x2F;src&#x2F;litegraph.js:422</code></a>
</p>

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l1794"><code>..&#x2F;src&#x2F;litegraph.js:1794</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l2116"><code>..&#x2F;src&#x2F;litegraph.js:2116</code></a>
</div>
@@ -108,7 +108,7 @@
<div class="box intro">
<p>The Global Scope. It contains all the registered node classes.</p>
<p>marks as dirty the canvas, this way it will be rendered again</p>
</div>
@@ -163,7 +163,7 @@
<a href="../files/.._src_litegraph.js.html#l1794"><code>..&#x2F;src&#x2F;litegraph.js:1794</code></a>
<a href="../files/.._src_litegraph.js.html#l2116"><code>..&#x2F;src&#x2F;litegraph.js:2116</code></a>
</p>
@@ -192,7 +192,7 @@
<div class="param-description">
<p>the canvas where you want to render (it accepts a selector in string format)</p>
<p>the canvas where you want to render (it accepts a selector in string format or the canvas itself)</p>
</div>
@@ -208,7 +208,8 @@
<div class="param-description">
<p>[optional]</p>
</div>
@@ -231,6 +232,8 @@
<li class="api-class-tab index"><a href="#index">Index</a></li>
<li class="api-class-tab methods"><a href="#methods">Methods</a></li>
@@ -241,6 +244,56 @@
<h2 class="off-left">Item Index</h2>
<div class="index-section methods">
<h3>Methods</h3>
<ul class="index-list methods">
<li class="index-item method">
<a href="#method_clear">clear</a>
</li>
<li class="index-item method">
<a href="#method_getCanvasWindow">getCanvasWindow</a>
</li>
<li class="index-item method">
<a href="#method_setCanvas">setCanvas</a>
</li>
<li class="index-item method">
<a href="#method_setGraph">setGraph</a>
</li>
<li class="index-item method">
<a href="#method_startRendering">startRendering</a>
</li>
<li class="index-item method">
<a href="#method_stopRendering">stopRendering</a>
</li>
</ul>
</div>
@@ -250,6 +303,428 @@
</div>
<div id="methods" class="api-class-tabpanel">
<h2 class="off-left">Methods</h2>
<div id="method_clear" class="method item">
<h3 class="name"><code>clear</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1912"><code>..&#x2F;src&#x2F;litegraph.js:1912</code></a>
</p>
</div>
<div class="description">
<p>clears all the data inside</p>
</div>
</div>
<div id="method_getCanvasWindow" class="method item">
<h3 class="name"><code>getCanvasWindow</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Window</span>
</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l2132"><code>..&#x2F;src&#x2F;litegraph.js:2132</code></a>
</p>
</div>
<div class="description">
<p>Used to attach the canvas in a popup</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Window</span>:
<p>returns the window where the canvas is attached (the DOM root node)</p>
</div>
</div>
</div>
<div id="method_setCanvas" class="method item">
<h3 class="name"><code>setCanvas</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>assigns</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1994"><code>..&#x2F;src&#x2F;litegraph.js:1994</code></a>
</p>
</div>
<div class="description">
<p>assigns a canvas</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">assigns</code>
<span class="type">Canvas</span>
<div class="param-description">
<p>a canvas</p>
</div>
</li>
</ul>
</div>
</div>
<div id="method_setGraph" class="method item">
<h3 class="name"><code>setGraph</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>assigns</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1966"><code>..&#x2F;src&#x2F;litegraph.js:1966</code></a>
</p>
</div>
<div class="description">
<p>assigns a graph, you can reasign graphs to the same canvas</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">assigns</code>
<span class="type"><a href="../classes/LGraph.html" class="crosslink">LGraph</a></span>
<div class="param-description">
<p>a graph</p>
</div>
</li>
</ul>
</div>
</div>
<div id="method_startRendering" class="method item">
<h3 class="name"><code>startRendering</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l2144"><code>..&#x2F;src&#x2F;litegraph.js:2144</code></a>
</p>
</div>
<div class="description">
<p>starts rendering the content of the canvas when needed</p>
</div>
</div>
<div id="method_stopRendering" class="method item">
<h3 class="name"><code>stopRendering</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l2175"><code>..&#x2F;src&#x2F;litegraph.js:2175</code></a>
</p>
</div>
<div class="description">
<p>stops rendering the content of the canvas (to save resources)</p>
</div>
</div>
</div>

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l997"><code>..&#x2F;src&#x2F;litegraph.js:997</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l1000"><code>..&#x2F;src&#x2F;litegraph.js:1000</code></a>
</div>
@@ -148,6 +148,13 @@
</li>
<li class="index-item method">
<a href="#method_addInputs">addInputs</a>
</li>
<li class="index-item method">
@@ -155,6 +162,13 @@
</li>
<li class="index-item method">
<a href="#method_addOutputs">addOutputs</a>
</li>
<li class="index-item method">
@@ -197,6 +211,20 @@
</li>
<li class="index-item method">
<a href="#method_findInputSlot">findInputSlot</a>
</li>
<li class="index-item method">
<a href="#method_findOutputSlot">findOutputSlot</a>
</li>
<li class="index-item method">
@@ -239,6 +267,13 @@
</li>
<li class="index-item method">
<a href="#method_getTitle">getTitle</a>
</li>
<li class="index-item method">
@@ -380,7 +415,7 @@
<a href="../files/.._src_litegraph.js.html#l1320"><code>..&#x2F;src&#x2F;litegraph.js:1320</code></a>
<a href="../files/.._src_litegraph.js.html#l1385"><code>..&#x2F;src&#x2F;litegraph.js:1385</code></a>
</p>
@@ -528,7 +563,7 @@
<a href="../files/.._src_litegraph.js.html#l1289"><code>..&#x2F;src&#x2F;litegraph.js:1289</code></a>
<a href="../files/.._src_litegraph.js.html#l1331"><code>..&#x2F;src&#x2F;litegraph.js:1331</code></a>
</p>
@@ -603,6 +638,95 @@
</div>
<div id="method_addInputs" class="method item">
<h3 class="name"><code>addInputs</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>array</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1350"><code>..&#x2F;src&#x2F;litegraph.js:1350</code></a>
</p>
</div>
<div class="description">
<p>add several new input slots in this node</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">array</code>
<span class="type">Array</span>
<div class="param-description">
<p>of triplets like [[name,type,extra_info],[...]]</p>
</div>
</li>
</ul>
</div>
</div>
@@ -660,7 +784,7 @@
<a href="../files/.._src_litegraph.js.html#l1258"><code>..&#x2F;src&#x2F;litegraph.js:1258</code></a>
<a href="../files/.._src_litegraph.js.html#l1277"><code>..&#x2F;src&#x2F;litegraph.js:1277</code></a>
</p>
@@ -735,6 +859,95 @@
</div>
<div id="method_addOutputs" class="method item">
<h3 class="name"><code>addOutputs</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>array</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1296"><code>..&#x2F;src&#x2F;litegraph.js:1296</code></a>
</p>
</div>
<div class="description">
<p>add a new output slot to use in this node</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">array</code>
<span class="type">Array</span>
<div class="param-description">
<p>of triplets like [[name,type,extra_info],[...]]</p>
</div>
</li>
</ul>
</div>
</div>
@@ -770,7 +983,7 @@
<a href="../files/.._src_litegraph.js.html#l1756"><code>..&#x2F;src&#x2F;litegraph.js:1756</code></a>
<a href="../files/.._src_litegraph.js.html#l1842"><code>..&#x2F;src&#x2F;litegraph.js:1842</code></a>
</p>
@@ -839,7 +1052,7 @@
<a href="../files/.._src_litegraph.js.html#l1333"><code>..&#x2F;src&#x2F;litegraph.js:1333</code></a>
<a href="../files/.._src_litegraph.js.html#l1398"><code>..&#x2F;src&#x2F;litegraph.js:1398</code></a>
</p>
@@ -931,7 +1144,7 @@
<a href="../files/.._src_litegraph.js.html#l1026"><code>..&#x2F;src&#x2F;litegraph.js:1026</code></a>
<a href="../files/.._src_litegraph.js.html#l1029"><code>..&#x2F;src&#x2F;litegraph.js:1029</code></a>
</p>
@@ -942,7 +1155,7 @@
</div>
<div class="description">
<p>configure a node from an object</p>
<p>configure a node from an object containing the serialized info</p>
</div>
@@ -1012,7 +1225,7 @@
<a href="../files/.._src_litegraph.js.html#l1401"><code>..&#x2F;src&#x2F;litegraph.js:1401</code></a>
<a href="../files/.._src_litegraph.js.html#l1478"><code>..&#x2F;src&#x2F;litegraph.js:1478</code></a>
</p>
@@ -1151,7 +1364,7 @@
<a href="../files/.._src_litegraph.js.html#l1545"><code>..&#x2F;src&#x2F;litegraph.js:1545</code></a>
<a href="../files/.._src_litegraph.js.html#l1628"><code>..&#x2F;src&#x2F;litegraph.js:1628</code></a>
</p>
@@ -1264,7 +1477,7 @@
<a href="../files/.._src_litegraph.js.html#l1482"><code>..&#x2F;src&#x2F;litegraph.js:1482</code></a>
<a href="../files/.._src_litegraph.js.html#l1561"><code>..&#x2F;src&#x2F;litegraph.js:1561</code></a>
</p>
@@ -1338,6 +1551,220 @@
</div>
<div id="method_findInputSlot" class="method item">
<h3 class="name"><code>findInputSlot</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>name</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">Number</span>
</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1448"><code>..&#x2F;src&#x2F;litegraph.js:1448</code></a>
</p>
</div>
<div class="description">
<p>returns the input slot with a given name (used for dynamic slots), -1 if not found</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">name</code>
<span class="type">String</span>
<div class="param-description">
<p>the name of the slot</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Number</span>:
<p>the slot (-1 if not found)</p>
</div>
</div>
</div>
<div id="method_findOutputSlot" class="method item">
<h3 class="name"><code>findOutputSlot</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>name</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">Number</span>
</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1463"><code>..&#x2F;src&#x2F;litegraph.js:1463</code></a>
</p>
</div>
<div class="description">
<p>returns the output slot with a given name (used for dynamic slots), -1 if not found</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">name</code>
<span class="type">String</span>
<div class="param-description">
<p>the name of the slot</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Number</span>:
<p>the slot (-1 if not found)</p>
</div>
</div>
</div>
@@ -1377,7 +1804,7 @@
<a href="../files/.._src_litegraph.js.html#l1351"><code>..&#x2F;src&#x2F;litegraph.js:1351</code></a>
<a href="../files/.._src_litegraph.js.html#l1416"><code>..&#x2F;src&#x2F;litegraph.js:1416</code></a>
</p>
@@ -1466,7 +1893,7 @@
<a href="../files/.._src_litegraph.js.html#l1599"><code>..&#x2F;src&#x2F;litegraph.js:1599</code></a>
<a href="../files/.._src_litegraph.js.html#l1685"><code>..&#x2F;src&#x2F;litegraph.js:1685</code></a>
</p>
@@ -1589,7 +2016,7 @@
<a href="../files/.._src_litegraph.js.html#l1161"><code>..&#x2F;src&#x2F;litegraph.js:1161</code></a>
<a href="../files/.._src_litegraph.js.html#l1180"><code>..&#x2F;src&#x2F;litegraph.js:1180</code></a>
</p>
@@ -1695,7 +2122,7 @@
<a href="../files/.._src_litegraph.js.html#l1187"><code>..&#x2F;src&#x2F;litegraph.js:1187</code></a>
<a href="../files/.._src_litegraph.js.html#l1206"><code>..&#x2F;src&#x2F;litegraph.js:1206</code></a>
</p>
@@ -1799,7 +2226,7 @@
<a href="../files/.._src_litegraph.js.html#l1202"><code>..&#x2F;src&#x2F;litegraph.js:1202</code></a>
<a href="../files/.._src_litegraph.js.html#l1221"><code>..&#x2F;src&#x2F;litegraph.js:1221</code></a>
</p>
@@ -1903,7 +2330,7 @@
<a href="../files/.._src_litegraph.js.html#l1229"><code>..&#x2F;src&#x2F;litegraph.js:1229</code></a>
<a href="../files/.._src_litegraph.js.html#l1248"><code>..&#x2F;src&#x2F;litegraph.js:1248</code></a>
</p>
@@ -1958,6 +2385,61 @@
</div>
<div id="method_getTitle" class="method item">
<h3 class="name"><code>getTitle</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>
Defined in
<a href="../files/.._src_litegraph.js.html#l1148"><code>..&#x2F;src&#x2F;litegraph.js:1148</code></a>
</p>
</div>
<div class="description">
<p>get the title string</p>
</div>
</div>
@@ -2007,7 +2489,7 @@
<a href="../files/.._src_litegraph.js.html#l1175"><code>..&#x2F;src&#x2F;litegraph.js:1175</code></a>
<a href="../files/.._src_litegraph.js.html#l1194"><code>..&#x2F;src&#x2F;litegraph.js:1194</code></a>
</p>
@@ -2111,7 +2593,7 @@
<a href="../files/.._src_litegraph.js.html#l1217"><code>..&#x2F;src&#x2F;litegraph.js:1217</code></a>
<a href="../files/.._src_litegraph.js.html#l1236"><code>..&#x2F;src&#x2F;litegraph.js:1236</code></a>
</p>
@@ -2221,7 +2703,7 @@
<a href="../files/.._src_litegraph.js.html#l1361"><code>..&#x2F;src&#x2F;litegraph.js:1361</code></a>
<a href="../files/.._src_litegraph.js.html#l1426"><code>..&#x2F;src&#x2F;litegraph.js:1426</code></a>
</p>
@@ -2326,7 +2808,7 @@
<a href="../files/.._src_litegraph.js.html#l1769"><code>..&#x2F;src&#x2F;litegraph.js:1769</code></a>
<a href="../files/.._src_litegraph.js.html#l1855"><code>..&#x2F;src&#x2F;litegraph.js:1855</code></a>
</p>
@@ -2391,7 +2873,7 @@
<a href="../files/.._src_litegraph.js.html#l1308"><code>..&#x2F;src&#x2F;litegraph.js:1308</code></a>
<a href="../files/.._src_litegraph.js.html#l1373"><code>..&#x2F;src&#x2F;litegraph.js:1373</code></a>
</p>
@@ -2479,7 +2961,7 @@
<a href="../files/.._src_litegraph.js.html#l1277"><code>..&#x2F;src&#x2F;litegraph.js:1277</code></a>
<a href="../files/.._src_litegraph.js.html#l1319"><code>..&#x2F;src&#x2F;litegraph.js:1319</code></a>
</p>
@@ -2557,7 +3039,7 @@
<a href="../files/.._src_litegraph.js.html#l1073"><code>..&#x2F;src&#x2F;litegraph.js:1073</code></a>
<a href="../files/.._src_litegraph.js.html#l1075"><code>..&#x2F;src&#x2F;litegraph.js:1075</code></a>
</p>
@@ -2628,7 +3110,7 @@
<a href="../files/.._src_litegraph.js.html#l1145"><code>..&#x2F;src&#x2F;litegraph.js:1145</code></a>
<a href="../files/.._src_litegraph.js.html#l1161"><code>..&#x2F;src&#x2F;litegraph.js:1161</code></a>
</p>
@@ -2721,7 +3203,7 @@
<a href="../files/.._src_litegraph.js.html#l1132"><code>..&#x2F;src&#x2F;litegraph.js:1132</code></a>
<a href="../files/.._src_litegraph.js.html#l1136"><code>..&#x2F;src&#x2F;litegraph.js:1136</code></a>
</p>

View File

@@ -298,7 +298,7 @@
<a href="../files/.._src_litegraph.js.html#l67"><code>..&#x2F;src&#x2F;litegraph.js:67</code></a>
<a href="../files/.._src_litegraph.js.html#l65"><code>..&#x2F;src&#x2F;litegraph.js:65</code></a>
</p>
@@ -423,7 +423,7 @@
<a href="../files/.._src_litegraph.js.html#l143"><code>..&#x2F;src&#x2F;litegraph.js:143</code></a>
<a href="../files/.._src_litegraph.js.html#l105"><code>..&#x2F;src&#x2F;litegraph.js:105</code></a>
</p>
@@ -530,7 +530,7 @@
<a href="../files/.._src_litegraph.js.html#l156"><code>..&#x2F;src&#x2F;litegraph.js:156</code></a>
<a href="../files/.._src_litegraph.js.html#l118"><code>..&#x2F;src&#x2F;litegraph.js:118</code></a>
</p>
@@ -627,7 +627,7 @@
<a href="../files/.._src_litegraph.js.html#l178"><code>..&#x2F;src&#x2F;litegraph.js:178</code></a>
<a href="../files/.._src_litegraph.js.html#l140"><code>..&#x2F;src&#x2F;litegraph.js:140</code></a>
</p>
@@ -712,7 +712,7 @@
<a href="../files/.._src_litegraph.js.html#l33"><code>..&#x2F;src&#x2F;litegraph.js:33</code></a>
<a href="../files/.._src_litegraph.js.html#l34"><code>..&#x2F;src&#x2F;litegraph.js:34</code></a>
</p>

View File

@@ -38,7 +38,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 299,
"line": 227,
"description": "LGraph is the class that contain a full graph. We instantiate one and add nodes to it, and then we can run the execution loop.",
"is_constructor": 1
},
@@ -51,7 +51,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 997,
"line": 1000,
"description": "Base Class for all the node type classes",
"params": [
{
@@ -70,27 +70,28 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 1794,
"description": "The Global Scope. It contains all the registered node classes.",
"line": 2116,
"description": "marks as dirty the canvas, this way it will be rendered again",
"is_constructor": 1,
"params": [
{
"name": "canvas",
"description": "the canvas where you want to render (it accepts a selector in string format)",
"description": "the canvas where you want to render (it accepts a selector in string format or the canvas itself)",
"type": "HTMLCanvas"
},
{
"name": "graph",
"description": "",
"description": "[optional]",
"type": "LGraph"
}
]
],
"itemtype": "method"
}
},
"classitems": [
{
"file": "../src/litegraph.js",
"line": 33,
"line": 34,
"description": "Register a node class so it can be listed when the user wants to create a new one",
"itemtype": "method",
"name": "registerNodeType",
@@ -110,7 +111,7 @@
},
{
"file": "../src/litegraph.js",
"line": 67,
"line": 65,
"description": "Create a node of a given type with a name. The node is not attached to any graph yet.",
"itemtype": "method",
"name": "createNode",
@@ -135,7 +136,7 @@
},
{
"file": "../src/litegraph.js",
"line": 143,
"line": 105,
"description": "Returns a registered node type with a given name",
"itemtype": "method",
"name": "getNodeType",
@@ -154,7 +155,7 @@
},
{
"file": "../src/litegraph.js",
"line": 156,
"line": 118,
"description": "Returns a list of node types matching one category",
"itemtype": "method",
"name": "getNodeType",
@@ -173,7 +174,7 @@
},
{
"file": "../src/litegraph.js",
"line": 178,
"line": 140,
"description": "Returns a list with all the node type categories",
"itemtype": "method",
"name": "getNodeTypesCategories",
@@ -185,7 +186,7 @@
},
{
"file": "../src/litegraph.js",
"line": 317,
"line": 251,
"description": "Removes all nodes from this graph",
"itemtype": "method",
"name": "clear",
@@ -193,7 +194,7 @@
},
{
"file": "../src/litegraph.js",
"line": 361,
"line": 296,
"description": "Attach Canvas to this graph",
"itemtype": "method",
"name": "attachCanvas",
@@ -208,7 +209,7 @@
},
{
"file": "../src/litegraph.js",
"line": 380,
"line": 315,
"description": "Detach Canvas from this graph",
"itemtype": "method",
"name": "detachCanvas",
@@ -223,7 +224,7 @@
},
{
"file": "../src/litegraph.js",
"line": 394,
"line": 329,
"description": "Starts running this graph every interval milliseconds.",
"itemtype": "method",
"name": "start",
@@ -238,7 +239,7 @@
},
{
"file": "../src/litegraph.js",
"line": 421,
"line": 356,
"description": "Stops the execution loop of the graph",
"itemtype": "method",
"name": "stop execution",
@@ -246,7 +247,7 @@
},
{
"file": "../src/litegraph.js",
"line": 443,
"line": 378,
"description": "Run N steps (cycles) of the graph",
"itemtype": "method",
"name": "runStep",
@@ -261,7 +262,7 @@
},
{
"file": "../src/litegraph.js",
"line": 487,
"line": 422,
"description": "Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than\nnodes with only inputs.",
"itemtype": "method",
"name": "updateExecutionOrder",
@@ -269,7 +270,7 @@
},
{
"file": "../src/litegraph.js",
"line": 583,
"line": 520,
"description": "Returns the amount of time the graph has been running in milliseconds",
"itemtype": "method",
"name": "getTime",
@@ -281,7 +282,7 @@
},
{
"file": "../src/litegraph.js",
"line": 594,
"line": 531,
"description": "Returns the amount of time accumulated using the fixedtime_lapse var. This is used in context where the time increments should be constant",
"itemtype": "method",
"name": "getFixedTime",
@@ -293,7 +294,7 @@
},
{
"file": "../src/litegraph.js",
"line": 605,
"line": 542,
"description": "Returns the amount of time it took to compute the latest iteration. Take into account that this number could be not correct\nif the nodes are using graphical actions",
"itemtype": "method",
"name": "getElapsedTime",
@@ -305,7 +306,7 @@
},
{
"file": "../src/litegraph.js",
"line": 617,
"line": 554,
"description": "Sends an event to all the nodes, useful to trigger stuff",
"itemtype": "method",
"name": "sendEventToAllNodes",
@@ -325,7 +326,7 @@
},
{
"file": "../src/litegraph.js",
"line": 645,
"line": 582,
"description": "Adds a new node instasnce to this graph",
"itemtype": "method",
"name": "add",
@@ -340,7 +341,7 @@
},
{
"file": "../src/litegraph.js",
"line": 690,
"line": 631,
"description": "Removes a node from the graph",
"itemtype": "method",
"name": "remove",
@@ -355,7 +356,7 @@
},
{
"file": "../src/litegraph.js",
"line": 751,
"line": 697,
"description": "Returns a node by its id.",
"itemtype": "method",
"name": "getNodeById",
@@ -370,7 +371,7 @@
},
{
"file": "../src/litegraph.js",
"line": 764,
"line": 710,
"description": "Returns a list of nodes that matches a type",
"itemtype": "method",
"name": "findNodesByType",
@@ -389,7 +390,7 @@
},
{
"file": "../src/litegraph.js",
"line": 780,
"line": 726,
"description": "Returns a list of nodes that matches a name",
"itemtype": "method",
"name": "findNodesByName",
@@ -408,7 +409,7 @@
},
{
"file": "../src/litegraph.js",
"line": 796,
"line": 742,
"description": "Returns the top-most node in this position of the canvas",
"itemtype": "method",
"name": "getNodeOnPos",
@@ -437,7 +438,7 @@
},
{
"file": "../src/litegraph.js",
"line": 817,
"line": 804,
"description": "Assigns a value to all the nodes that matches this name. This is used to create global variables of the node that\ncan be easily accesed from the outside of the graph",
"itemtype": "method",
"name": "setInputData",
@@ -457,7 +458,7 @@
},
{
"file": "../src/litegraph.js",
"line": 832,
"line": 819,
"description": "Returns the value of the first node with this name. This is used to access global variables of the graph from the outside",
"itemtype": "method",
"name": "setInputData",
@@ -476,7 +477,7 @@
},
{
"file": "../src/litegraph.js",
"line": 869,
"line": 856,
"description": "returns if the graph is in live mode",
"itemtype": "method",
"name": "isLive",
@@ -484,7 +485,7 @@
},
{
"file": "../src/litegraph.js",
"line": 893,
"line": 889,
"description": "Creates a Object containing all the info about this graph, it can be serialized",
"itemtype": "method",
"name": "serialize",
@@ -496,7 +497,7 @@
},
{
"file": "../src/litegraph.js",
"line": 920,
"line": 922,
"description": "Configure a graph from a JSON string",
"itemtype": "method",
"name": "configure",
@@ -511,15 +512,15 @@
},
{
"file": "../src/litegraph.js",
"line": 1026,
"description": "configure a node from an object",
"line": 1029,
"description": "configure a node from an object containing the serialized info",
"itemtype": "method",
"name": "configure",
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1073,
"line": 1075,
"description": "serialize the content",
"itemtype": "method",
"name": "serialize",
@@ -527,7 +528,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1132,
"line": 1136,
"description": "serialize and stringify",
"itemtype": "method",
"name": "toString",
@@ -535,7 +536,15 @@
},
{
"file": "../src/litegraph.js",
"line": 1145,
"line": 1148,
"description": "get the title string",
"itemtype": "method",
"name": "getTitle",
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1161,
"description": "sets the output data",
"itemtype": "method",
"name": "setOutputData",
@@ -555,7 +564,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1161,
"line": 1180,
"description": "retrieves the input data from one slot",
"itemtype": "method",
"name": "getInputData",
@@ -574,7 +583,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1175,
"line": 1194,
"description": "tells you if there is a connection in one input slot",
"itemtype": "method",
"name": "isInputConnected",
@@ -593,7 +602,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1187,
"line": 1206,
"description": "tells you info about an input connection (which node, type, etc)",
"itemtype": "method",
"name": "getInputInfo",
@@ -612,7 +621,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1202,
"line": 1221,
"description": "tells you info about an output connection (which node, type, etc)",
"itemtype": "method",
"name": "getOutputInfo",
@@ -631,7 +640,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1217,
"line": 1236,
"description": "tells you if there is a connection in one output slot",
"itemtype": "method",
"name": "isOutputConnected",
@@ -650,7 +659,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1229,
"line": 1248,
"description": "retrieves all the nodes connected to this output slot",
"itemtype": "method",
"name": "getOutputNodes",
@@ -669,7 +678,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1258,
"line": 1277,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutput",
@@ -694,7 +703,22 @@
},
{
"file": "../src/litegraph.js",
"line": 1277,
"line": 1296,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutputs",
"params": [
{
"name": "array",
"description": "of triplets like [[name,type,extra_info],[...]]",
"type": "Array"
}
],
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1319,
"description": "remove an existing output slot",
"itemtype": "method",
"name": "removeOutput",
@@ -709,7 +733,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1289,
"line": 1331,
"description": "add a new input slot to use in this node",
"itemtype": "method",
"name": "addInput",
@@ -734,7 +758,22 @@
},
{
"file": "../src/litegraph.js",
"line": 1308,
"line": 1350,
"description": "add several new input slots in this node",
"itemtype": "method",
"name": "addInputs",
"params": [
{
"name": "array",
"description": "of triplets like [[name,type,extra_info],[...]]",
"type": "Array"
}
],
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1373,
"description": "remove an existing input slot",
"itemtype": "method",
"name": "removeInput",
@@ -749,7 +788,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1320,
"line": 1385,
"description": "add an special connection to this node (used for special kinds of graphs)",
"itemtype": "method",
"name": "addConnection",
@@ -779,7 +818,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1333,
"line": 1398,
"description": "computes the size of a node according to its inputs and output slots",
"itemtype": "method",
"name": "computeSize",
@@ -798,7 +837,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1351,
"line": 1416,
"description": "returns the bounding of the object, used for rendering purposes",
"itemtype": "method",
"name": "getBounding",
@@ -810,7 +849,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1361,
"line": 1426,
"description": "checks if a point is inside the shape of a node",
"itemtype": "method",
"name": "isPointInsideNode",
@@ -834,7 +873,45 @@
},
{
"file": "../src/litegraph.js",
"line": 1401,
"line": 1448,
"description": "returns the input slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findInputSlot",
"params": [
{
"name": "name",
"description": "the name of the slot",
"type": "String"
}
],
"return": {
"description": "the slot (-1 if not found)",
"type": "Number"
},
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1463,
"description": "returns the output slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findOutputSlot",
"params": [
{
"name": "name",
"description": "the name of the slot",
"type": "String"
}
],
"return": {
"description": "the slot (-1 if not found)",
"type": "Number"
},
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1478,
"description": "connect this node output to the input of another node",
"itemtype": "method",
"name": "connect",
@@ -863,7 +940,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1482,
"line": 1561,
"description": "disconnect one output to an specific node",
"itemtype": "method",
"name": "disconnectOutput",
@@ -887,7 +964,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1545,
"line": 1628,
"description": "disconnect one input",
"itemtype": "method",
"name": "disconnectInput",
@@ -906,7 +983,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1599,
"line": 1685,
"description": "returns the center of a connection point in canvas coords",
"itemtype": "method",
"name": "getConnectionPos",
@@ -930,7 +1007,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1756,
"line": 1842,
"description": "Collapse the node to make it smaller on the canvas",
"itemtype": "method",
"name": "collapse",
@@ -938,11 +1015,77 @@
},
{
"file": "../src/litegraph.js",
"line": 1769,
"line": 1855,
"description": "Forces the node to do not move or realign on Z",
"itemtype": "method",
"name": "pin",
"class": "LGraphNode"
},
{
"file": "../src/litegraph.js",
"line": 1912,
"description": "clears all the data inside",
"itemtype": "method",
"name": "clear",
"class": "LGraphCanvas"
},
{
"file": "../src/litegraph.js",
"line": 1966,
"description": "assigns a graph, you can reasign graphs to the same canvas",
"itemtype": "method",
"name": "setGraph",
"params": [
{
"name": "assigns",
"description": "a graph",
"type": "LGraph"
}
],
"class": "LGraphCanvas"
},
{
"file": "../src/litegraph.js",
"line": 1994,
"description": "assigns a canvas",
"itemtype": "method",
"name": "setCanvas",
"params": [
{
"name": "assigns",
"description": "a canvas",
"type": "Canvas"
}
],
"class": "LGraphCanvas"
},
{
"file": "../src/litegraph.js",
"line": 2132,
"description": "Used to attach the canvas in a popup",
"itemtype": "method",
"name": "getCanvasWindow",
"return": {
"description": "returns the window where the canvas is attached (the DOM root node)",
"type": "Window"
},
"class": "LGraphCanvas"
},
{
"file": "../src/litegraph.js",
"line": 2144,
"description": "starts rendering the content of the canvas when needed",
"itemtype": "method",
"name": "startRendering",
"class": "LGraphCanvas"
},
{
"file": "../src/litegraph.js",
"line": 2175,
"description": "stops rendering the content of the canvas (to save resources)",
"itemtype": "method",
"name": "stopRendering",
"class": "LGraphCanvas"
}
],
"warnings": []

File diff suppressed because it is too large Load Diff

View File

@@ -44,6 +44,7 @@
</ul>
<h2>Documentation</h2>
<p>Here you can check <a href="doc">automatically generated documentation</a>.</p>
</div>
</div>

View File

@@ -1445,6 +1445,12 @@ LGraphNode.prototype.isPointInsideNode = function(x,y)
return false;
}
/**
* returns the input slot with a given name (used for dynamic slots), -1 if not found
* @method findInputSlot
* @param {string} name the name of the slot
* @return {number} the slot (-1 if not found)
*/
LGraphNode.prototype.findInputSlot = function(name)
{
if(!this.inputs) return -1;
@@ -1454,6 +1460,12 @@ LGraphNode.prototype.findInputSlot = function(name)
return -1;
}
/**
* returns the output slot with a given name (used for dynamic slots), -1 if not found
* @method findOutputSlot
* @param {string} name the name of the slot
* @return {number} the slot (-1 if not found)
*/
LGraphNode.prototype.findOutputSlot = function(name)
{
if(!this.outputs) return -1;
@@ -1870,8 +1882,8 @@ LGraphNode.prototype.localToScreen = function(x,y, graphcanvas)
*
* @class LGraphCanvas
* @constructor
* @param {HTMLCanvas} canvas the canvas where you want to render (it accepts a selector in string format)
* @param {LGraph} graph
* @param {HTMLCanvas} canvas the canvas where you want to render (it accepts a selector in string format or the canvas itself)
* @param {LGraph} graph [optional]
*/
function LGraphCanvas(canvas, graph)
{
@@ -1896,6 +1908,12 @@ function LGraphCanvas(canvas, graph)
LGraphCanvas.link_type_colors = {'number':"#AAC",'node':"#DCA"};
/**
* clears all the data inside
*
* @method clear
*/
LGraphCanvas.prototype.clear = function()
{
this.frame = 0;
@@ -1945,6 +1963,12 @@ LGraphCanvas.prototype.clear = function()
//this.UIinit();
}
/**
* assigns a graph, you can reasign graphs to the same canvas
*
* @method setGraph
* @param {LGraph} assigns a graph
*/
LGraphCanvas.prototype.setGraph = function(graph)
{
if(this.graph == graph) return;
@@ -1967,6 +1991,12 @@ LGraphCanvas.prototype.setGraph = function(graph)
this.setDirty(true,true);
}
/**
* assigns a canvas
*
* @method setCanvas
* @param {Canvas} assigns a canvas
*/
LGraphCanvas.prototype.setCanvas = function(canvas)
{
var that = this;
@@ -2005,7 +2035,7 @@ LGraphCanvas.prototype.setCanvas = function(canvas)
this._mousemove_callback = this.processMouseMove.bind(this);
this._mouseup_callback = this.processMouseUp.bind(this);
this.canvas.addEventListener("mousedown", this.processMouseDown.bind(this) ); //down do not need to store the binded
this.canvas.addEventListener("mousedown", this.processMouseDown.bind(this), true ); //down do not need to store the binded
this.canvas.addEventListener("mousemove", this._mousemove_callback);
this.canvas.addEventListener("contextmenu", function(e) { e.preventDefault(); return false; });
@@ -2083,6 +2113,14 @@ LGraphCanvas.prototype.UIinit = function()
}
*/
/**
* marks as dirty the canvas, this way it will be rendered again
*
* @class LGraphCanvas
* @method setDirty
* @param {bool} fgcanvas if the foreground canvas is dirty (the one containing the nodes)
* @param {bool} bgcanvas if the background canvas is dirty (the one containing the wires)
*/
LGraphCanvas.prototype.setDirty = function(fgcanvas,bgcanvas)
{
if(fgcanvas)
@@ -2091,13 +2129,23 @@ LGraphCanvas.prototype.setDirty = function(fgcanvas,bgcanvas)
this.dirty_bgcanvas = true;
}
//Used to attach the canvas in a popup
/**
* Used to attach the canvas in a popup
*
* @method getCanvasWindow
* @return {window} returns the window where the canvas is attached (the DOM root node)
*/
LGraphCanvas.prototype.getCanvasWindow = function()
{
var doc = this.canvas.ownerDocument;
return doc.defaultView || doc.parentWindow;
}
/**
* starts rendering the content of the canvas when needed
*
* @method startRendering
*/
LGraphCanvas.prototype.startRendering = function()
{
if(this.is_rendering) return; //already rendering
@@ -2124,6 +2172,11 @@ LGraphCanvas.prototype.startRendering = function()
*/
}
/**
* stops rendering the content of the canvas (to save resources)
*
* @method stopRendering
*/
LGraphCanvas.prototype.stopRendering = function()
{
this.is_rendering = false;
@@ -2148,8 +2201,8 @@ LGraphCanvas.prototype.processMouseDown = function(e)
var document = ref_window.document;
this.canvas.removeEventListener("mousemove", this._mousemove_callback );
ref_window.document.addEventListener("mousemove", this._mousemove_callback ); //catch for the entire window
ref_window.document.addEventListener("mouseup", this._mouseup_callback );
ref_window.document.addEventListener("mousemove", this._mousemove_callback, true ); //catch for the entire window
ref_window.document.addEventListener("mouseup", this._mouseup_callback, true );
var n = this.graph.getNodeOnPos(e.canvasX, e.canvasY, this.visible_nodes);
var skip_dragging = false;

View File

@@ -146,7 +146,6 @@ function MathOperation()
this.addInput("A","number");
this.addInput("B","number");
this.addOutput("A+B","number");
this.size = [80,20];
this.properties = {A:1.0, B:1.0};
}
@@ -252,12 +251,34 @@ MathCompare.prototype.onGetOutputs = function()
LiteGraph.registerNodeType("math/compare",MathCompare);
function MathAccumulate()
{
this.addInput("inc","number");
this.addOutput("total","number");
this.properties = { increment: 0, value: 0 };
}
MathAccumulate.title = "Accumulate";
MathAccumulate.desc = "Increments a value every time";
MathAccumulate.prototype.onExecute = function()
{
var inc = this.getInputData(0);
if(inc !== null)
this.properties.value += inc;
else
this.properties.value += this.properties.increment;
this.setOutputData(0, this.properties.value );
}
LiteGraph.registerNodeType("math/accumulate", MathAccumulate);
//Math Trigonometry
function MathTrigonometry()
{
this.addInput("v","number");
this.addOutput("sin","number");
this.properties = {amplitude:1.0};
this.properties = {amplitude:1.0, offset: 0};
this.bgImageUrl = "nodes/imgs/icon-sin.png";
}
@@ -267,7 +288,15 @@ MathTrigonometry.desc = "Sin Cos Tan";
MathTrigonometry.prototype.onExecute = function()
{
var v = this.getInputData(0);
var amp = this.properties["amplitude"];
var amplitude = this.properties["amplitude"];
var slot = this.findInputSlot("amplitude");
if(slot != -1)
amplitude = this.getInputData(slot);
var offset = this.properties["offset"];
slot = this.findInputSlot("offset");
if(slot != -1)
offset = this.getInputData(slot);
for(var i = 0, l = this.outputs.length; i < l; ++i)
{
var output = this.outputs[i];
@@ -280,10 +309,16 @@ MathTrigonometry.prototype.onExecute = function()
case "acos": value = Math.acos(v); break;
case "atan": value = Math.atan(v); break;
}
this.setOutputData(i, amp * value );
this.setOutputData(i, amplitude * value + offset);
}
}
MathTrigonometry.prototype.onGetInputs = function()
{
return [["v","number"],["amplitude","number"],["offset","number"]];
}
MathTrigonometry.prototype.onGetOutputs = function()
{
return [["sin","number"],["cos","number"],["tan","number"],["asin","number"],["acos","number"],["atan","number"]];
@@ -373,6 +408,7 @@ if(window.glMatrix)
{
this.addInputs([["x","number"],["y","number"],["z","number"]]);
this.addOutput("vec3","vec3");
this.properties = {x:0, y:0, z:0};
}
Math3DXYZToVec3.title = "XYZ->Vec3";
@@ -381,11 +417,11 @@ if(window.glMatrix)
Math3DXYZToVec3.prototype.onExecute = function()
{
var x = this.getInputData(0);
if(x == null) x = 0;
if(x == null) x = this.properties.x;
var y = this.getInputData(1);
if(y == null) y = 0;
if(y == null) y = this.properties.y;
var z = this.getInputData(2);
if(z == null) z = 0;
if(z == null) z = this.properties.z;
this.setOutputData( 0, vec3.fromValues(x,y,z) );
}