build
0
doc/api.js
Executable file → Normal file
0
doc/assets/css/external-small.png
Executable file → Normal file
|
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 491 B |
0
doc/assets/css/logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
0
doc/assets/css/main.css
Executable file → Normal file
0
doc/assets/favicon.png
Executable file → Normal file
|
Before Width: | Height: | Size: 740 B After Width: | Height: | Size: 740 B |
0
doc/assets/img/spinner.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
0
doc/assets/index.html
Executable file → Normal file
0
doc/assets/js/api-filter.js
Executable file → Normal file
0
doc/assets/js/api-list.js
Executable file → Normal file
0
doc/assets/js/api-search.js
Executable file → Normal file
0
doc/assets/js/apidocs.js
Executable file → Normal file
0
doc/assets/js/yui-prettify.js
vendored
Executable file → Normal file
0
doc/assets/vendor/prettify/CHANGES.html
vendored
Executable file → Normal file
0
doc/assets/vendor/prettify/COPYING
vendored
Executable file → Normal file
0
doc/assets/vendor/prettify/README.html
vendored
Executable file → Normal file
0
doc/assets/vendor/prettify/prettify-min.css
vendored
Executable file → Normal file
0
doc/assets/vendor/prettify/prettify-min.js
vendored
Executable file → Normal file
0
doc/classes/LGraph.html
Executable file → Normal file
20
doc/classes/LGraphCanvas.html
Executable file → Normal file
@@ -96,7 +96,7 @@
|
||||
|
||||
|
||||
<div class="foundat">
|
||||
Defined in: <a href="../files/.._src_litegraph.js.html#l2429"><code>../src/litegraph.js:2429</code></a>
|
||||
Defined in: <a href="../files/.._src_litegraph.js.html#l2551"><code>../src/litegraph.js:2551</code></a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2429"><code>../src/litegraph.js:2429</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2551"><code>../src/litegraph.js:2551</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2073"><code>../src/litegraph.js:2073</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2192"><code>../src/litegraph.js:2192</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -418,7 +418,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2187"><code>../src/litegraph.js:2187</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2306"><code>../src/litegraph.js:2306</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2445"><code>../src/litegraph.js:2445</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2567"><code>../src/litegraph.js:2567</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -580,7 +580,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2160"><code>../src/litegraph.js:2160</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2279"><code>../src/litegraph.js:2279</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -668,7 +668,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2202"><code>../src/litegraph.js:2202</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2321"><code>../src/litegraph.js:2321</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -757,7 +757,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2129"><code>../src/litegraph.js:2129</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2248"><code>../src/litegraph.js:2248</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -835,7 +835,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2457"><code>../src/litegraph.js:2457</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2579"><code>../src/litegraph.js:2579</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -890,7 +890,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2480"><code>../src/litegraph.js:2480</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2602"><code>../src/litegraph.js:2602</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
200
doc/classes/LGraphNode.html
Executable file → Normal file
@@ -96,7 +96,7 @@
|
||||
|
||||
|
||||
<div class="foundat">
|
||||
Defined in: <a href="../files/.._src_litegraph.js.html#l1156"><code>../src/litegraph.js:1156</code></a>
|
||||
Defined in: <a href="../files/.._src_litegraph.js.html#l1166"><code>../src/litegraph.js:1166</code></a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -267,6 +267,13 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="index-item method">
|
||||
<a href="#method_getSlotInPosition">getSlotInPosition</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="index-item method">
|
||||
@@ -415,7 +422,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1570"><code>../src/litegraph.js:1570</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1600"><code>../src/litegraph.js:1600</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -563,7 +570,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1509"><code>../src/litegraph.js:1509</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1538"><code>../src/litegraph.js:1538</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -683,7 +690,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1531"><code>../src/litegraph.js:1531</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1561"><code>../src/litegraph.js:1561</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -784,7 +791,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1449"><code>../src/litegraph.js:1449</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1478"><code>../src/litegraph.js:1478</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -904,7 +911,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1470"><code>../src/litegraph.js:1470</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1499"><code>../src/litegraph.js:1499</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -983,7 +990,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2002"><code>../src/litegraph.js:2002</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2121"><code>../src/litegraph.js:2121</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1052,7 +1059,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1583"><code>../src/litegraph.js:1583</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1613"><code>../src/litegraph.js:1613</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1144,7 +1151,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1191"><code>../src/litegraph.js:1191</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1217"><code>../src/litegraph.js:1217</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1225,7 +1232,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1663"><code>../src/litegraph.js:1663</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1759"><code>../src/litegraph.js:1759</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1364,7 +1371,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1813"><code>../src/litegraph.js:1813</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1927"><code>../src/litegraph.js:1927</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1477,7 +1484,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1746"><code>../src/litegraph.js:1746</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1855"><code>../src/litegraph.js:1855</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1600,7 +1607,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1633"><code>../src/litegraph.js:1633</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1729"><code>../src/litegraph.js:1729</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1707,7 +1714,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1648"><code>../src/litegraph.js:1648</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1744"><code>../src/litegraph.js:1744</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1804,7 +1811,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1601"><code>../src/litegraph.js:1601</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1664"><code>../src/litegraph.js:1664</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -1893,7 +1900,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1870"><code>../src/litegraph.js:1870</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1989"><code>../src/litegraph.js:1989</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2016,7 +2023,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1350"><code>../src/litegraph.js:1350</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1376"><code>../src/litegraph.js:1376</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2065,7 +2072,7 @@
|
||||
|
||||
<span class="type"></span>:
|
||||
|
||||
<p>data</p>
|
||||
<p>data or if it is not connected returns undefined</p>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -2122,7 +2129,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1378"><code>../src/litegraph.js:1378</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1404"><code>../src/litegraph.js:1404</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2171,6 +2178,8 @@
|
||||
|
||||
<span class="type">Object</span>:
|
||||
|
||||
<p>object or null</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2226,7 +2235,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1393"><code>../src/litegraph.js:1393</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1420"><code>../src/litegraph.js:1420</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2275,6 +2284,8 @@
|
||||
|
||||
<span class="type">Object</span>:
|
||||
|
||||
<p>object or null</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2330,7 +2341,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1420"><code>../src/litegraph.js:1420</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1449"><code>../src/litegraph.js:1449</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2385,6 +2396,133 @@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="method_getSlotInPosition" class="method item">
|
||||
<h3 class="name"><code>getSlotInPosition</code></h3>
|
||||
|
||||
|
||||
<div class="args">
|
||||
<span class="paren">(</span><ul class="args-list inline commas">
|
||||
|
||||
<li class="arg">
|
||||
|
||||
<code>x</code>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="arg">
|
||||
|
||||
<code>y</code>
|
||||
|
||||
</li>
|
||||
|
||||
</ul><span class="paren">)</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<span class="returns-inline">
|
||||
<span class="type">Object</span>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="meta">
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
Defined in
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1698"><code>../src/litegraph.js:1698</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description">
|
||||
<p>checks if a point is inside a node slot, and returns info about which slot</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="params">
|
||||
<h4>Parameters:</h4>
|
||||
|
||||
<ul class="params-list">
|
||||
|
||||
<li class="param">
|
||||
|
||||
<code class="param-name">x</code>
|
||||
<span class="type">Number</span>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="param-description">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="param">
|
||||
|
||||
<code class="param-name">y</code>
|
||||
<span class="type">Number</span>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="param-description">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="returns">
|
||||
<h4>Returns:</h4>
|
||||
|
||||
<div class="returns-description">
|
||||
|
||||
|
||||
<span class="type">Object</span>:
|
||||
|
||||
<p>if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] }</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2420,7 +2558,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1316"><code>../src/litegraph.js:1316</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1342"><code>../src/litegraph.js:1342</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2489,7 +2627,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1365"><code>../src/litegraph.js:1365</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1391"><code>../src/litegraph.js:1391</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2593,7 +2731,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1408"><code>../src/litegraph.js:1408</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1436"><code>../src/litegraph.js:1436</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2703,7 +2841,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1611"><code>../src/litegraph.js:1611</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1674"><code>../src/litegraph.js:1674</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2808,7 +2946,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l2015"><code>../src/litegraph.js:2015</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l2134"><code>../src/litegraph.js:2134</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2873,7 +3011,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1556"><code>../src/litegraph.js:1556</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1586"><code>../src/litegraph.js:1586</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -2961,7 +3099,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1495"><code>../src/litegraph.js:1495</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1524"><code>../src/litegraph.js:1524</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -3039,7 +3177,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1250"><code>../src/litegraph.js:1250</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1276"><code>../src/litegraph.js:1276</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -3110,7 +3248,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1329"><code>../src/litegraph.js:1329</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1355"><code>../src/litegraph.js:1355</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -3203,7 +3341,7 @@
|
||||
|
||||
|
||||
|
||||
<a href="../files/.._src_litegraph.js.html#l1304"><code>../src/litegraph.js:1304</code></a>
|
||||
<a href="../files/.._src_litegraph.js.html#l1330"><code>../src/litegraph.js:1330</code></a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
0
doc/classes/LiteGraph.html
Executable file → Normal file
0
doc/classes/index.html
Executable file → Normal file
108
doc/data.json
Executable file → Normal file
@@ -51,7 +51,7 @@
|
||||
"plugin_for": [],
|
||||
"extension_for": [],
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1156,
|
||||
"line": 1166,
|
||||
"description": "Base Class for all the node type classes",
|
||||
"params": [
|
||||
{
|
||||
@@ -70,7 +70,7 @@
|
||||
"plugin_for": [],
|
||||
"extension_for": [],
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2429,
|
||||
"line": 2551,
|
||||
"description": "marks as dirty the canvas, this way it will be rendered again",
|
||||
"is_constructor": 1,
|
||||
"params": [
|
||||
@@ -531,7 +531,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1191,
|
||||
"line": 1217,
|
||||
"description": "configure a node from an object containing the serialized info",
|
||||
"itemtype": "method",
|
||||
"name": "configure",
|
||||
@@ -539,7 +539,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1250,
|
||||
"line": 1276,
|
||||
"description": "serialize the content",
|
||||
"itemtype": "method",
|
||||
"name": "serialize",
|
||||
@@ -547,7 +547,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1304,
|
||||
"line": 1330,
|
||||
"description": "serialize and stringify",
|
||||
"itemtype": "method",
|
||||
"name": "toString",
|
||||
@@ -555,7 +555,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1316,
|
||||
"line": 1342,
|
||||
"description": "get the title string",
|
||||
"itemtype": "method",
|
||||
"name": "getTitle",
|
||||
@@ -563,7 +563,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1329,
|
||||
"line": 1355,
|
||||
"description": "sets the output data",
|
||||
"itemtype": "method",
|
||||
"name": "setOutputData",
|
||||
@@ -583,7 +583,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1350,
|
||||
"line": 1376,
|
||||
"description": "retrieves the input data (data traveling through the connection) from one slot",
|
||||
"itemtype": "method",
|
||||
"name": "getInputData",
|
||||
@@ -595,14 +595,14 @@
|
||||
}
|
||||
],
|
||||
"return": {
|
||||
"description": "data",
|
||||
"description": "data or if it is not connected returns undefined",
|
||||
"type": "*"
|
||||
},
|
||||
"class": "LGraphNode"
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1365,
|
||||
"line": 1391,
|
||||
"description": "tells you if there is a connection in one input slot",
|
||||
"itemtype": "method",
|
||||
"name": "isInputConnected",
|
||||
@@ -621,7 +621,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1378,
|
||||
"line": 1404,
|
||||
"description": "tells you info about an input connection (which node, type, etc)",
|
||||
"itemtype": "method",
|
||||
"name": "getInputInfo",
|
||||
@@ -633,14 +633,14 @@
|
||||
}
|
||||
],
|
||||
"return": {
|
||||
"description": "",
|
||||
"description": "object or null",
|
||||
"type": "Object"
|
||||
},
|
||||
"class": "LGraphNode"
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1393,
|
||||
"line": 1420,
|
||||
"description": "tells you info about an output connection (which node, type, etc)",
|
||||
"itemtype": "method",
|
||||
"name": "getOutputInfo",
|
||||
@@ -652,14 +652,14 @@
|
||||
}
|
||||
],
|
||||
"return": {
|
||||
"description": "",
|
||||
"description": "object or null",
|
||||
"type": "Object"
|
||||
},
|
||||
"class": "LGraphNode"
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1408,
|
||||
"line": 1436,
|
||||
"description": "tells you if there is a connection in one output slot",
|
||||
"itemtype": "method",
|
||||
"name": "isOutputConnected",
|
||||
@@ -678,7 +678,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1420,
|
||||
"line": 1449,
|
||||
"description": "retrieves all the nodes connected to this output slot",
|
||||
"itemtype": "method",
|
||||
"name": "getOutputNodes",
|
||||
@@ -697,7 +697,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1449,
|
||||
"line": 1478,
|
||||
"description": "add a new output slot to use in this node",
|
||||
"itemtype": "method",
|
||||
"name": "addOutput",
|
||||
@@ -722,7 +722,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1470,
|
||||
"line": 1499,
|
||||
"description": "add a new output slot to use in this node",
|
||||
"itemtype": "method",
|
||||
"name": "addOutputs",
|
||||
@@ -737,7 +737,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1495,
|
||||
"line": 1524,
|
||||
"description": "remove an existing output slot",
|
||||
"itemtype": "method",
|
||||
"name": "removeOutput",
|
||||
@@ -752,7 +752,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1509,
|
||||
"line": 1538,
|
||||
"description": "add a new input slot to use in this node",
|
||||
"itemtype": "method",
|
||||
"name": "addInput",
|
||||
@@ -777,7 +777,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1531,
|
||||
"line": 1561,
|
||||
"description": "add several new input slots in this node",
|
||||
"itemtype": "method",
|
||||
"name": "addInputs",
|
||||
@@ -792,7 +792,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1556,
|
||||
"line": 1586,
|
||||
"description": "remove an existing input slot",
|
||||
"itemtype": "method",
|
||||
"name": "removeInput",
|
||||
@@ -807,7 +807,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1570,
|
||||
"line": 1600,
|
||||
"description": "add an special connection to this node (used for special kinds of graphs)",
|
||||
"itemtype": "method",
|
||||
"name": "addConnection",
|
||||
@@ -837,7 +837,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1583,
|
||||
"line": 1613,
|
||||
"description": "computes the size of a node according to its inputs and output slots",
|
||||
"itemtype": "method",
|
||||
"name": "computeSize",
|
||||
@@ -856,7 +856,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1601,
|
||||
"line": 1664,
|
||||
"description": "returns the bounding of the object, used for rendering purposes",
|
||||
"itemtype": "method",
|
||||
"name": "getBounding",
|
||||
@@ -868,7 +868,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1611,
|
||||
"line": 1674,
|
||||
"description": "checks if a point is inside the shape of a node",
|
||||
"itemtype": "method",
|
||||
"name": "isPointInsideNode",
|
||||
@@ -892,7 +892,31 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1633,
|
||||
"line": 1698,
|
||||
"description": "checks if a point is inside a node slot, and returns info about which slot",
|
||||
"itemtype": "method",
|
||||
"name": "getSlotInPosition",
|
||||
"params": [
|
||||
{
|
||||
"name": "x",
|
||||
"description": "",
|
||||
"type": "Number"
|
||||
},
|
||||
{
|
||||
"name": "y",
|
||||
"description": "",
|
||||
"type": "Number"
|
||||
}
|
||||
],
|
||||
"return": {
|
||||
"description": "if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] }",
|
||||
"type": "Object"
|
||||
},
|
||||
"class": "LGraphNode"
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1729,
|
||||
"description": "returns the input slot with a given name (used for dynamic slots), -1 if not found",
|
||||
"itemtype": "method",
|
||||
"name": "findInputSlot",
|
||||
@@ -911,7 +935,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1648,
|
||||
"line": 1744,
|
||||
"description": "returns the output slot with a given name (used for dynamic slots), -1 if not found",
|
||||
"itemtype": "method",
|
||||
"name": "findOutputSlot",
|
||||
@@ -930,7 +954,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1663,
|
||||
"line": 1759,
|
||||
"description": "connect this node output to the input of another node",
|
||||
"itemtype": "method",
|
||||
"name": "connect",
|
||||
@@ -959,7 +983,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1746,
|
||||
"line": 1855,
|
||||
"description": "disconnect one output to an specific node",
|
||||
"itemtype": "method",
|
||||
"name": "disconnectOutput",
|
||||
@@ -983,7 +1007,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1813,
|
||||
"line": 1927,
|
||||
"description": "disconnect one input",
|
||||
"itemtype": "method",
|
||||
"name": "disconnectInput",
|
||||
@@ -1002,7 +1026,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 1870,
|
||||
"line": 1989,
|
||||
"description": "returns the center of a connection point in canvas coords",
|
||||
"itemtype": "method",
|
||||
"name": "getConnectionPos",
|
||||
@@ -1026,7 +1050,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2002,
|
||||
"line": 2121,
|
||||
"description": "Collapse the node to make it smaller on the canvas",
|
||||
"itemtype": "method",
|
||||
"name": "collapse",
|
||||
@@ -1034,7 +1058,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2015,
|
||||
"line": 2134,
|
||||
"description": "Forces the node to do not move or realign on Z",
|
||||
"itemtype": "method",
|
||||
"name": "pin",
|
||||
@@ -1042,7 +1066,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2073,
|
||||
"line": 2192,
|
||||
"description": "clears all the data inside",
|
||||
"itemtype": "method",
|
||||
"name": "clear",
|
||||
@@ -1050,7 +1074,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2129,
|
||||
"line": 2248,
|
||||
"description": "assigns a graph, you can reasign graphs to the same canvas",
|
||||
"itemtype": "method",
|
||||
"name": "setGraph",
|
||||
@@ -1065,7 +1089,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2160,
|
||||
"line": 2279,
|
||||
"description": "opens a graph contained inside a node in the current graph",
|
||||
"itemtype": "method",
|
||||
"name": "openSubgraph",
|
||||
@@ -1080,7 +1104,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2187,
|
||||
"line": 2306,
|
||||
"description": "closes a subgraph contained inside a node",
|
||||
"itemtype": "method",
|
||||
"name": "closeSubgraph",
|
||||
@@ -1095,7 +1119,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2202,
|
||||
"line": 2321,
|
||||
"description": "assigns a canvas",
|
||||
"itemtype": "method",
|
||||
"name": "setCanvas",
|
||||
@@ -1110,7 +1134,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2445,
|
||||
"line": 2567,
|
||||
"description": "Used to attach the canvas in a popup",
|
||||
"itemtype": "method",
|
||||
"name": "getCanvasWindow",
|
||||
@@ -1122,7 +1146,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2457,
|
||||
"line": 2579,
|
||||
"description": "starts rendering the content of the canvas when needed",
|
||||
"itemtype": "method",
|
||||
"name": "startRendering",
|
||||
@@ -1130,7 +1154,7 @@
|
||||
},
|
||||
{
|
||||
"file": "../src/litegraph.js",
|
||||
"line": 2480,
|
||||
"line": 2602,
|
||||
"description": "stops rendering the content of the canvas (to save resources)",
|
||||
"itemtype": "method",
|
||||
"name": "stopRendering",
|
||||
|
||||
312
doc/files/.._src_litegraph.js.html
Executable file → Normal file
@@ -878,7 +878,7 @@ LGraph.prototype.getNodeOnPos = function(x,y, nodes_list)
|
||||
for (var i = nodes_list.length - 1; i >= 0; i--)
|
||||
{
|
||||
var n = nodes_list[i];
|
||||
if(n.isPointInsideNode(x,y))
|
||||
if(n.isPointInsideNode( x, y, 2 ))
|
||||
return n;
|
||||
}
|
||||
return null;
|
||||
@@ -1219,7 +1219,15 @@ LGraph.prototype.onNodeTrace = function(node, msg, color)
|
||||
// Node CLASS *******
|
||||
// *************************************************************
|
||||
|
||||
/* flags:
|
||||
/*
|
||||
title: string
|
||||
pos: [x,y]
|
||||
size: [x,y]
|
||||
|
||||
input|output: every connection
|
||||
+ { name:string, type:string, pos: [x,y]=Optional, direction: "input"|"output", links: Array });
|
||||
|
||||
flags:
|
||||
+ skip_title_render
|
||||
+ clip_area
|
||||
+ unsafe_execution: not allowed for safe execution
|
||||
@@ -1244,7 +1252,9 @@ LGraph.prototype.onNodeTrace = function(node, msg, color)
|
||||
+ onSerialize
|
||||
+ onSelected
|
||||
+ onDeselected
|
||||
+ onDropFile
|
||||
+ onDropItem : DOM item dropped over the node
|
||||
+ onDropFile : file dropped over the node
|
||||
+ onConnectInput : if returns false the incoming connection will be canceled
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -1264,7 +1274,23 @@ LGraphNode.prototype._ctor = function( title )
|
||||
this.size = [LiteGraph.NODE_WIDTH,60];
|
||||
this.graph = null;
|
||||
|
||||
this.pos = [10,10];
|
||||
this._pos = new Float32Array(10,10);
|
||||
|
||||
Object.defineProperty( this, "pos", {
|
||||
set: function(v)
|
||||
{
|
||||
if(!v || !v.length < 2)
|
||||
return;
|
||||
this._pos[0] = v[0];
|
||||
this._pos[1] = v[1];
|
||||
},
|
||||
get: function()
|
||||
{
|
||||
return this._pos;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
this.id = -1; //not know till not added
|
||||
this.type = null;
|
||||
|
||||
@@ -1445,7 +1471,7 @@ LGraphNode.prototype.setOutputData = function(slot,data)
|
||||
* retrieves the input data (data traveling through the connection) from one slot
|
||||
* @method getInputData
|
||||
* @param {number} slot
|
||||
* @return {*} data
|
||||
* @return {*} data or if it is not connected returns undefined
|
||||
*/
|
||||
LGraphNode.prototype.getInputData = function(slot)
|
||||
{
|
||||
@@ -1473,11 +1499,12 @@ LGraphNode.prototype.isInputConnected = function(slot)
|
||||
* tells you info about an input connection (which node, type, etc)
|
||||
* @method getInputInfo
|
||||
* @param {number} slot
|
||||
* @return {Object}
|
||||
* @return {Object} object or null
|
||||
*/
|
||||
LGraphNode.prototype.getInputInfo = function(slot)
|
||||
{
|
||||
if(!this.inputs) return null;
|
||||
if(!this.inputs)
|
||||
return null;
|
||||
if(slot < this.inputs.length)
|
||||
return this.inputs[slot];
|
||||
return null;
|
||||
@@ -1488,11 +1515,12 @@ LGraphNode.prototype.getInputInfo = function(slot)
|
||||
* tells you info about an output connection (which node, type, etc)
|
||||
* @method getOutputInfo
|
||||
* @param {number} slot
|
||||
* @return {Object}
|
||||
* @return {Object} object or null
|
||||
*/
|
||||
LGraphNode.prototype.getOutputInfo = function(slot)
|
||||
{
|
||||
if(!this.outputs) return null;
|
||||
if(!this.outputs)
|
||||
return null;
|
||||
if(slot < this.outputs.length)
|
||||
return this.outputs[slot];
|
||||
return null;
|
||||
@@ -1507,7 +1535,8 @@ LGraphNode.prototype.getOutputInfo = function(slot)
|
||||
*/
|
||||
LGraphNode.prototype.isOutputConnected = function(slot)
|
||||
{
|
||||
if(!this.outputs) return null;
|
||||
if(!this.outputs)
|
||||
return null;
|
||||
return (slot < this.outputs.length && this.outputs[slot].links && this.outputs[slot].links.length);
|
||||
}
|
||||
|
||||
@@ -1615,7 +1644,8 @@ LGraphNode.prototype.addInput = function(name,type,extra_info)
|
||||
for(var i in extra_info)
|
||||
o[i] = extra_info[i];
|
||||
|
||||
if(!this.inputs) this.inputs = [];
|
||||
if(!this.inputs)
|
||||
this.inputs = [];
|
||||
this.inputs.push(o);
|
||||
this.size = this.computeSize();
|
||||
if(this.onInputAdded)
|
||||
@@ -1684,11 +1714,44 @@ LGraphNode.prototype.computeSize = function(minHeight)
|
||||
{
|
||||
var rows = Math.max( this.inputs ? this.inputs.length : 1, this.outputs ? this.outputs.length : 1);
|
||||
var size = new Float32Array([0,0]);
|
||||
rows = Math.max(rows, 1);
|
||||
size[1] = rows * 14 + 6;
|
||||
if(!this.inputs || this.inputs.length == 0 || !this.outputs || this.outputs.length == 0)
|
||||
size[0] = LiteGraph.NODE_WIDTH * 0.5;
|
||||
else
|
||||
size[0] = LiteGraph.NODE_WIDTH;
|
||||
|
||||
var font_size = 14;
|
||||
var title_width = compute_text_size( this.title );
|
||||
var input_width = 0;
|
||||
var output_width = 0;
|
||||
|
||||
if(this.inputs)
|
||||
for(var i = 0, l = this.inputs.length; i < l; ++i)
|
||||
{
|
||||
var input = this.inputs[i];
|
||||
var text = input.label || input.name || "";
|
||||
var text_width = compute_text_size( text );
|
||||
if(input_width < text_width)
|
||||
input_width = text_width;
|
||||
}
|
||||
|
||||
if(this.outputs)
|
||||
for(var i = 0, l = this.outputs.length; i < l; ++i)
|
||||
{
|
||||
var output = this.outputs[i];
|
||||
var text = output.label || output.name || "";
|
||||
var text_width = compute_text_size( text );
|
||||
if(output_width < text_width)
|
||||
output_width = text_width;
|
||||
}
|
||||
|
||||
size[0] = Math.max( input_width + output_width + 10, title_width );
|
||||
size[0] = Math.max( size[0], LiteGraph.NODE_WIDTH );
|
||||
|
||||
function compute_text_size( text )
|
||||
{
|
||||
if(!text)
|
||||
return 0;
|
||||
return font_size * text.length * 0.6;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -1709,21 +1772,54 @@ LGraphNode.prototype.getBounding = function()
|
||||
* @param {number} y
|
||||
* @return {boolean}
|
||||
*/
|
||||
LGraphNode.prototype.isPointInsideNode = function(x,y)
|
||||
LGraphNode.prototype.isPointInsideNode = function(x,y, margin)
|
||||
{
|
||||
margin = margin || 0;
|
||||
|
||||
var margin_top = this.graph && this.graph.isLive() ? 0 : 20;
|
||||
if(this.flags.collapsed)
|
||||
{
|
||||
//if ( distance([x,y], [this.pos[0] + this.size[0]*0.5, this.pos[1] + this.size[1]*0.5]) < LiteGraph.NODE_COLLAPSED_RADIUS)
|
||||
if( isInsideRectangle(x,y, this.pos[0], this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT, LiteGraph.NODE_COLLAPSED_WIDTH, LiteGraph.NODE_TITLE_HEIGHT) )
|
||||
if( isInsideRectangle( x, y, this.pos[0] - margin, this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT - margin, LiteGraph.NODE_COLLAPSED_WIDTH + 2 * margin, LiteGraph.NODE_TITLE_HEIGHT + 2 * margin ) )
|
||||
return true;
|
||||
}
|
||||
else if (this.pos[0] - 4 < x && (this.pos[0] + this.size[0] + 4) > x
|
||||
&& (this.pos[1] - margin_top) < y && (this.pos[1] + this.size[1]) > y)
|
||||
else if ( (this.pos[0] - 4 - margin) < x && (this.pos[0] + this.size[0] + 4 + margin) > x
|
||||
&& (this.pos[1] - margin_top - margin) < y && (this.pos[1] + this.size[1] + margin) > y)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if a point is inside a node slot, and returns info about which slot
|
||||
* @method getSlotInPosition
|
||||
* @param {number} x
|
||||
* @param {number} y
|
||||
* @return {Object} if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] }
|
||||
*/
|
||||
LGraphNode.prototype.getSlotInPosition = function( x, y )
|
||||
{
|
||||
//search for inputs
|
||||
if(this.inputs)
|
||||
for(var i = 0, l = this.inputs.length; i < l; ++i)
|
||||
{
|
||||
var input = this.inputs[i];
|
||||
var link_pos = this.getConnectionPos( true,i );
|
||||
if( isInsideRectangle(x, y, link_pos[0] - 10, link_pos[1] - 5, 20,10) )
|
||||
return { input: input, slot: i, link_pos: link_pos, locked: input.locked };
|
||||
}
|
||||
|
||||
if(this.outputs)
|
||||
for(var i = 0, l = this.outputs.length; i < l; ++i)
|
||||
{
|
||||
var output = this.outputs[i];
|
||||
var link_pos = this.getConnectionPos(false,i);
|
||||
if( isInsideRectangle(x, y, link_pos[0] - 10, link_pos[1] - 5, 20,10) )
|
||||
return { output: output, slot: i, link_pos: link_pos, locked: output.locked };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the input slot with a given name (used for dynamic slots), -1 if not found
|
||||
* @method findInputSlot
|
||||
@@ -1784,8 +1880,14 @@ LGraphNode.prototype.connect = function(slot, node, target_slot)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(node && node.constructor === Number)
|
||||
node = this.graph.getNodeById( node );
|
||||
if(!node)
|
||||
throw("Node not found");
|
||||
|
||||
//avoid loopback
|
||||
if(node == this) return false;
|
||||
if(node == this)
|
||||
return false;
|
||||
//if( node.constructor != LGraphNode ) throw ("LGraphNode.connect: node is not of type LGraphNode");
|
||||
|
||||
if(target_slot.constructor === String)
|
||||
@@ -1808,9 +1910,18 @@ LGraphNode.prototype.connect = function(slot, node, target_slot)
|
||||
//if there is something already plugged there, disconnect
|
||||
if(target_slot != -1 && node.inputs[target_slot].link != null)
|
||||
node.disconnectInput(target_slot);
|
||||
|
||||
this.setDirtyCanvas(false,true);
|
||||
this.graph.onConnectionChange();
|
||||
|
||||
//special case: -1 means node-connection, used for triggers
|
||||
var output = this.outputs[slot];
|
||||
|
||||
//allows nodes to block connection even if all test passes
|
||||
if(node.onConnectInput)
|
||||
if( node.onConnectInput( target_slot, output.type, output ) === false)
|
||||
return false;
|
||||
|
||||
if(target_slot == -1)
|
||||
{
|
||||
if( output.links == null )
|
||||
@@ -1831,8 +1942,6 @@ LGraphNode.prototype.connect = function(slot, node, target_slot)
|
||||
output.links.push( link.id );
|
||||
node.inputs[target_slot].link = link.id;
|
||||
|
||||
this.setDirtyCanvas(false,true);
|
||||
this.graph.onConnectionChange();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1870,6 +1979,11 @@ LGraphNode.prototype.disconnectOutput = function(slot, target_node)
|
||||
|
||||
if(target_node)
|
||||
{
|
||||
if(target_node.constructor === Number)
|
||||
target_node = this.graph.getNodeById( target_node );
|
||||
if(!target_node)
|
||||
throw("Target Node not found");
|
||||
|
||||
for(var i = 0, l = output.links.length; i < l; i++)
|
||||
{
|
||||
var link_id = output.links[i];
|
||||
@@ -1931,28 +2045,33 @@ LGraphNode.prototype.disconnectInput = function(slot)
|
||||
}
|
||||
|
||||
var input = this.inputs[slot];
|
||||
if(!input) return false;
|
||||
if(!input)
|
||||
return false;
|
||||
var link_id = this.inputs[slot].link;
|
||||
this.inputs[slot].link = null;
|
||||
|
||||
//remove other side
|
||||
var link_info = this.graph.links[ link_id ];
|
||||
var node = this.graph.getNodeById( link_info.origin_id );
|
||||
if(!node) return false;
|
||||
|
||||
var output = node.outputs[ link_info.origin_slot ];
|
||||
if(!output || !output.links || output.links.length == 0)
|
||||
return false;
|
||||
|
||||
//check outputs
|
||||
for(var i = 0, l = output.links.length; i < l; i++)
|
||||
if( link_info )
|
||||
{
|
||||
var link_id = output.links[i];
|
||||
var link_info = this.graph.links[ link_id ];
|
||||
if( link_info.target_id == this.id )
|
||||
var node = this.graph.getNodeById( link_info.origin_id );
|
||||
if(!node)
|
||||
return false;
|
||||
|
||||
var output = node.outputs[ link_info.origin_slot ];
|
||||
if(!output || !output.links || output.links.length == 0)
|
||||
return false;
|
||||
|
||||
//check outputs
|
||||
for(var i = 0, l = output.links.length; i < l; i++)
|
||||
{
|
||||
output.links.splice(i,1);
|
||||
break;
|
||||
var link_id = output.links[i];
|
||||
var link_info = this.graph.links[ link_id ];
|
||||
if( link_info.target_id == this.id )
|
||||
{
|
||||
output.links.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1968,7 +2087,7 @@ LGraphNode.prototype.disconnectInput = function(slot)
|
||||
* @param {number_or_string} slot (could be the number of the slot or the string with the name of the slot)
|
||||
* @return {[x,y]} the position
|
||||
**/
|
||||
LGraphNode.prototype.getConnectionPos = function(is_input,slot_number)
|
||||
LGraphNode.prototype.getConnectionPos = function(is_input, slot_number)
|
||||
{
|
||||
if(this.flags.collapsed)
|
||||
{
|
||||
@@ -2362,7 +2481,8 @@ LGraphCanvas.prototype.setCanvas = function( canvas, skip_events )
|
||||
}
|
||||
|
||||
//used in some events to capture them
|
||||
LGraphCanvas.prototype._doNothing = function doNothing() { return false; };
|
||||
LGraphCanvas.prototype._doNothing = function doNothing(e) { e.preventDefault(); return false; };
|
||||
LGraphCanvas.prototype._doReturnTrue = function doNothing(e) { e.preventDefault(); return true; };
|
||||
|
||||
LGraphCanvas.prototype.bindEvents = function()
|
||||
{
|
||||
@@ -2405,6 +2525,7 @@ LGraphCanvas.prototype.bindEvents = function()
|
||||
canvas.addEventListener("dragover", this._doNothing, false );
|
||||
canvas.addEventListener("dragend", this._doNothing, false );
|
||||
canvas.addEventListener("drop", this._ondrop_callback, false );
|
||||
canvas.addEventListener("dragenter", this._doReturnTrue, false );
|
||||
|
||||
this._events_binded = true;
|
||||
}
|
||||
@@ -2424,6 +2545,7 @@ LGraphCanvas.prototype.unbindEvents = function()
|
||||
this.canvas.removeEventListener( "keyup", this._key_callback );
|
||||
this.canvas.removeEventListener( "contextmenu", this._doNothing );
|
||||
this.canvas.removeEventListener( "drop", this._ondrop_callback );
|
||||
this.canvas.removeEventListener( "dragenter", this._doReturnTrue );
|
||||
|
||||
this.canvas.removeEventListener("touchstart", this.touchHandler );
|
||||
this.canvas.removeEventListener("touchmove", this.touchHandler );
|
||||
@@ -2605,7 +2727,7 @@ LGraphCanvas.prototype.processMouseDown = function(e)
|
||||
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 n = this.graph.getNodeOnPos( e.canvasX, e.canvasY, this.visible_nodes );
|
||||
var skip_dragging = false;
|
||||
|
||||
if(e.which == 1) //left button mouse
|
||||
@@ -3108,35 +3230,57 @@ LGraphCanvas.prototype.processDrop = function(e)
|
||||
e.preventDefault();
|
||||
this.adjustMouseEvent(e);
|
||||
|
||||
|
||||
var pos = [e.canvasX,e.canvasY];
|
||||
var node = this.graph.getNodeOnPos(pos[0],pos[1]);
|
||||
|
||||
if(!node)
|
||||
{
|
||||
if(this.onDropItem)
|
||||
this.onDropItem( event );
|
||||
return;
|
||||
}
|
||||
|
||||
if(!node.onDropFile)
|
||||
return;
|
||||
if(node.onDropFile)
|
||||
{
|
||||
var files = e.dataTransfer.files;
|
||||
if(files && files.length)
|
||||
{
|
||||
for(var i=0; i < files.length; i++)
|
||||
{
|
||||
var file = e.dataTransfer.files[0];
|
||||
var filename = file.name;
|
||||
var ext = LGraphCanvas.getFileExtension( filename );
|
||||
//console.log(file);
|
||||
|
||||
var file = e.dataTransfer.files[0];
|
||||
var filename = file.name;
|
||||
var ext = LGraphCanvas.getFileExtension( filename );
|
||||
//console.log(file);
|
||||
//prepare reader
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (event) {
|
||||
//console.log(event.target);
|
||||
var data = event.target.result;
|
||||
node.onDropFile( data, filename, file );
|
||||
};
|
||||
|
||||
//prepare reader
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (event) {
|
||||
//console.log(event.target);
|
||||
var data = event.target.result;
|
||||
node.onDropFile( data, filename, file );
|
||||
};
|
||||
//read data
|
||||
var type = file.type.split("/")[0];
|
||||
if(type == "text" || type == "")
|
||||
reader.readAsText(file);
|
||||
else if (type == "image")
|
||||
reader.readAsDataURL(file);
|
||||
else
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//read data
|
||||
var type = file.type.split("/")[0];
|
||||
if(type == "text" || type == "")
|
||||
reader.readAsText(file);
|
||||
else if (type == "image")
|
||||
reader.readAsDataURL(file);
|
||||
else
|
||||
reader.readAsArrayBuffer(file);
|
||||
if(node.onDropItem)
|
||||
{
|
||||
if( node.onDropItem( event ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
if(this.onDropItem)
|
||||
return this.onDropItem( event );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -4480,16 +4624,47 @@ LGraphCanvas.prototype.getNodeMenuOptions = function(node)
|
||||
return options;
|
||||
}
|
||||
|
||||
LGraphCanvas.prototype.processContextualMenu = function(node,event)
|
||||
LGraphCanvas.prototype.processContextualMenu = function(node, event)
|
||||
{
|
||||
var that = this;
|
||||
var win = this.getCanvasWindow();
|
||||
|
||||
var menu = LiteGraph.createContextualMenu(node ? this.getNodeMenuOptions(node) : this.getCanvasMenuOptions(), {event: event, callback: inner_option_clicked}, win);
|
||||
var menu_info = null;
|
||||
var options = {event: event, callback: inner_option_clicked};
|
||||
|
||||
//check if mouse is in input
|
||||
var slot = null;
|
||||
if(node)
|
||||
slot = node.getSlotInPosition( event.canvasX, event.canvasY );
|
||||
|
||||
if(slot)
|
||||
{
|
||||
menu_info = slot.locked ? [ "Cannot remove" ] : { "Remove Slot": slot };
|
||||
options.title = slot.input ? slot.input.type : slot.output.type;
|
||||
}
|
||||
else
|
||||
menu_info = node ? this.getNodeMenuOptions(node) : this.getCanvasMenuOptions();
|
||||
|
||||
|
||||
//show menu
|
||||
if(!menu_info)
|
||||
return;
|
||||
|
||||
var menu = LiteGraph.createContextualMenu( menu_info, options, win);
|
||||
|
||||
function inner_option_clicked(v,e)
|
||||
{
|
||||
if(!v) return;
|
||||
if(!v)
|
||||
return;
|
||||
|
||||
if(v == slot)
|
||||
{
|
||||
if(v.input)
|
||||
node.removeInput( slot.slot );
|
||||
else if(v.output)
|
||||
node.removeOutput( slot.slot );
|
||||
return;
|
||||
}
|
||||
|
||||
if(v.callback)
|
||||
return v.callback(node, e, menu, that, event );
|
||||
@@ -4648,6 +4823,15 @@ LiteGraph.createContextualMenu = function(values,options, ref_window)
|
||||
style.borderBottom = "2px solid #AAF";
|
||||
style.backgroundColor = "#444";
|
||||
|
||||
//title
|
||||
if(options.title)
|
||||
{
|
||||
var element = document.createElement("div");
|
||||
element.className = "graphcontextualmenu-title";
|
||||
element.innerHTML = options.title;
|
||||
root.appendChild(element);
|
||||
}
|
||||
|
||||
//avoid a context menu in a context menu
|
||||
root.addEventListener("contextmenu", function(e) { e.preventDefault(); return false; });
|
||||
|
||||
|
||||