WebGL support

Subgraph support
FX nodes moved from gltexture to glfx
Improves in gltexture
This commit is contained in:
tamat
2014-10-02 15:38:19 +02:00
parent 2e9b4a3f77
commit 6248dd4e0f
17 changed files with 5784 additions and 836 deletions

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l227"><code>..&#x2F;src&#x2F;litegraph.js:227</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l231"><code>..&#x2F;src&#x2F;litegraph.js:231</code></a>
</div>
@@ -147,7 +147,7 @@
<a href="../files/.._src_litegraph.js.html#l227"><code>..&#x2F;src&#x2F;litegraph.js:227</code></a>
<a href="../files/.._src_litegraph.js.html#l231"><code>..&#x2F;src&#x2F;litegraph.js:231</code></a>
</p>
@@ -405,7 +405,7 @@
<a href="../files/.._src_litegraph.js.html#l582"><code>..&#x2F;src&#x2F;litegraph.js:582</code></a>
<a href="../files/.._src_litegraph.js.html#l586"><code>..&#x2F;src&#x2F;litegraph.js:586</code></a>
</p>
@@ -494,7 +494,7 @@
<a href="../files/.._src_litegraph.js.html#l296"><code>..&#x2F;src&#x2F;litegraph.js:296</code></a>
<a href="../files/.._src_litegraph.js.html#l300"><code>..&#x2F;src&#x2F;litegraph.js:300</code></a>
</p>
@@ -572,7 +572,7 @@
<a href="../files/.._src_litegraph.js.html#l251"><code>..&#x2F;src&#x2F;litegraph.js:251</code></a>
<a href="../files/.._src_litegraph.js.html#l255"><code>..&#x2F;src&#x2F;litegraph.js:255</code></a>
</p>
@@ -637,7 +637,7 @@
<a href="../files/.._src_litegraph.js.html#l1018"><code>..&#x2F;src&#x2F;litegraph.js:1018</code></a>
<a href="../files/.._src_litegraph.js.html#l1051"><code>..&#x2F;src&#x2F;litegraph.js:1051</code></a>
</p>
@@ -726,7 +726,7 @@
<a href="../files/.._src_litegraph.js.html#l315"><code>..&#x2F;src&#x2F;litegraph.js:315</code></a>
<a href="../files/.._src_litegraph.js.html#l319"><code>..&#x2F;src&#x2F;litegraph.js:319</code></a>
</p>
@@ -818,7 +818,7 @@
<a href="../files/.._src_litegraph.js.html#l726"><code>..&#x2F;src&#x2F;litegraph.js:726</code></a>
<a href="../files/.._src_litegraph.js.html#l730"><code>..&#x2F;src&#x2F;litegraph.js:730</code></a>
</p>
@@ -925,7 +925,7 @@
<a href="../files/.._src_litegraph.js.html#l710"><code>..&#x2F;src&#x2F;litegraph.js:710</code></a>
<a href="../files/.._src_litegraph.js.html#l714"><code>..&#x2F;src&#x2F;litegraph.js:714</code></a>
</p>
@@ -1022,7 +1022,7 @@
<a href="../files/.._src_litegraph.js.html#l542"><code>..&#x2F;src&#x2F;litegraph.js:542</code></a>
<a href="../files/.._src_litegraph.js.html#l546"><code>..&#x2F;src&#x2F;litegraph.js:546</code></a>
</p>
@@ -1096,7 +1096,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l531"><code>..&#x2F;src&#x2F;litegraph.js:531</code></a>
<a href="../files/.._src_litegraph.js.html#l535"><code>..&#x2F;src&#x2F;litegraph.js:535</code></a>
</p>
@@ -1175,7 +1175,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l697"><code>..&#x2F;src&#x2F;litegraph.js:697</code></a>
<a href="../files/.._src_litegraph.js.html#l701"><code>..&#x2F;src&#x2F;litegraph.js:701</code></a>
</p>
@@ -1279,7 +1279,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l742"><code>..&#x2F;src&#x2F;litegraph.js:742</code></a>
<a href="../files/.._src_litegraph.js.html#l746"><code>..&#x2F;src&#x2F;litegraph.js:746</code></a>
</p>
@@ -1408,7 +1408,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l520"><code>..&#x2F;src&#x2F;litegraph.js:520</code></a>
<a href="../files/.._src_litegraph.js.html#l524"><code>..&#x2F;src&#x2F;litegraph.js:524</code></a>
</p>
@@ -1477,7 +1477,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l952"><code>..&#x2F;src&#x2F;litegraph.js:952</code></a>
<a href="../files/.._src_litegraph.js.html#l985"><code>..&#x2F;src&#x2F;litegraph.js:985</code></a>
</p>
@@ -1542,7 +1542,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l631"><code>..&#x2F;src&#x2F;litegraph.js:631</code></a>
<a href="../files/.._src_litegraph.js.html#l635"><code>..&#x2F;src&#x2F;litegraph.js:635</code></a>
</p>
@@ -1631,7 +1631,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l378"><code>..&#x2F;src&#x2F;litegraph.js:378</code></a>
<a href="../files/.._src_litegraph.js.html#l382"><code>..&#x2F;src&#x2F;litegraph.js:382</code></a>
</p>
@@ -1726,7 +1726,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l554"><code>..&#x2F;src&#x2F;litegraph.js:554</code></a>
<a href="../files/.._src_litegraph.js.html#l558"><code>..&#x2F;src&#x2F;litegraph.js:558</code></a>
</p>
@@ -1825,7 +1825,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l985"><code>..&#x2F;src&#x2F;litegraph.js:985</code></a>
<a href="../files/.._src_litegraph.js.html#l1018"><code>..&#x2F;src&#x2F;litegraph.js:1018</code></a>
</p>
@@ -1910,7 +1910,7 @@ if the nodes are using graphical actions</p>
<a href="../files/.._src_litegraph.js.html#l900"><code>..&#x2F;src&#x2F;litegraph.js:900</code></a>
<a href="../files/.._src_litegraph.js.html#l933"><code>..&#x2F;src&#x2F;litegraph.js:933</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#l915"><code>..&#x2F;src&#x2F;litegraph.js:915</code></a>
<a href="../files/.._src_litegraph.js.html#l948"><code>..&#x2F;src&#x2F;litegraph.js:948</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#l329"><code>..&#x2F;src&#x2F;litegraph.js:329</code></a>
<a href="../files/.._src_litegraph.js.html#l333"><code>..&#x2F;src&#x2F;litegraph.js:333</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#l356"><code>..&#x2F;src&#x2F;litegraph.js:356</code></a>
<a href="../files/.._src_litegraph.js.html#l360"><code>..&#x2F;src&#x2F;litegraph.js:360</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#l422"><code>..&#x2F;src&#x2F;litegraph.js:422</code></a>
<a href="../files/.._src_litegraph.js.html#l426"><code>..&#x2F;src&#x2F;litegraph.js:426</code></a>
</p>

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l2278"><code>..&#x2F;src&#x2F;litegraph.js:2278</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l2369"><code>..&#x2F;src&#x2F;litegraph.js:2369</code></a>
</div>
@@ -163,7 +163,7 @@
<a href="../files/.._src_litegraph.js.html#l2278"><code>..&#x2F;src&#x2F;litegraph.js:2278</code></a>
<a href="../files/.._src_litegraph.js.html#l2369"><code>..&#x2F;src&#x2F;litegraph.js:2369</code></a>
</p>
@@ -353,7 +353,7 @@
<a href="../files/.._src_litegraph.js.html#l2032"><code>..&#x2F;src&#x2F;litegraph.js:2032</code></a>
<a href="../files/.._src_litegraph.js.html#l2047"><code>..&#x2F;src&#x2F;litegraph.js:2047</code></a>
</p>
@@ -418,7 +418,7 @@
<a href="../files/.._src_litegraph.js.html#l2141"><code>..&#x2F;src&#x2F;litegraph.js:2141</code></a>
<a href="../files/.._src_litegraph.js.html#l2156"><code>..&#x2F;src&#x2F;litegraph.js:2156</code></a>
</p>
@@ -501,7 +501,7 @@
<a href="../files/.._src_litegraph.js.html#l2294"><code>..&#x2F;src&#x2F;litegraph.js:2294</code></a>
<a href="../files/.._src_litegraph.js.html#l2385"><code>..&#x2F;src&#x2F;litegraph.js:2385</code></a>
</p>
@@ -580,7 +580,7 @@
<a href="../files/.._src_litegraph.js.html#l2114"><code>..&#x2F;src&#x2F;litegraph.js:2114</code></a>
<a href="../files/.._src_litegraph.js.html#l2129"><code>..&#x2F;src&#x2F;litegraph.js:2129</code></a>
</p>
@@ -668,7 +668,7 @@
<a href="../files/.._src_litegraph.js.html#l2156"><code>..&#x2F;src&#x2F;litegraph.js:2156</code></a>
<a href="../files/.._src_litegraph.js.html#l2171"><code>..&#x2F;src&#x2F;litegraph.js:2171</code></a>
</p>
@@ -757,7 +757,7 @@
<a href="../files/.._src_litegraph.js.html#l2086"><code>..&#x2F;src&#x2F;litegraph.js:2086</code></a>
<a href="../files/.._src_litegraph.js.html#l2101"><code>..&#x2F;src&#x2F;litegraph.js:2101</code></a>
</p>
@@ -835,7 +835,7 @@
<a href="../files/.._src_litegraph.js.html#l2306"><code>..&#x2F;src&#x2F;litegraph.js:2306</code></a>
<a href="../files/.._src_litegraph.js.html#l2397"><code>..&#x2F;src&#x2F;litegraph.js:2397</code></a>
</p>
@@ -890,7 +890,7 @@
<a href="../files/.._src_litegraph.js.html#l2337"><code>..&#x2F;src&#x2F;litegraph.js:2337</code></a>
<a href="../files/.._src_litegraph.js.html#l2420"><code>..&#x2F;src&#x2F;litegraph.js:2420</code></a>
</p>

View File

@@ -96,7 +96,7 @@
<div class="foundat">
Defined in: <a href="../files/.._src_litegraph.js.html#l1096"><code>..&#x2F;src&#x2F;litegraph.js:1096</code></a>
Defined in: <a href="../files/.._src_litegraph.js.html#l1130"><code>..&#x2F;src&#x2F;litegraph.js:1130</code></a>
</div>
@@ -415,7 +415,7 @@
<a href="../files/.._src_litegraph.js.html#l1528"><code>..&#x2F;src&#x2F;litegraph.js:1528</code></a>
<a href="../files/.._src_litegraph.js.html#l1539"><code>..&#x2F;src&#x2F;litegraph.js:1539</code></a>
</p>
@@ -563,7 +563,7 @@
<a href="../files/.._src_litegraph.js.html#l1468"><code>..&#x2F;src&#x2F;litegraph.js:1468</code></a>
<a href="../files/.._src_litegraph.js.html#l1479"><code>..&#x2F;src&#x2F;litegraph.js:1479</code></a>
</p>
@@ -624,7 +624,7 @@
<div class="param-description">
<p>this can be used to have special properties of an input (special color, position, etc)</p>
<p>this can be used to have special properties of an input (label, color, position, etc)</p>
</div>
@@ -683,7 +683,7 @@
<a href="../files/.._src_litegraph.js.html#l1489"><code>..&#x2F;src&#x2F;litegraph.js:1489</code></a>
<a href="../files/.._src_litegraph.js.html#l1500"><code>..&#x2F;src&#x2F;litegraph.js:1500</code></a>
</p>
@@ -784,7 +784,7 @@
<a href="../files/.._src_litegraph.js.html#l1408"><code>..&#x2F;src&#x2F;litegraph.js:1408</code></a>
<a href="../files/.._src_litegraph.js.html#l1419"><code>..&#x2F;src&#x2F;litegraph.js:1419</code></a>
</p>
@@ -904,7 +904,7 @@
<a href="../files/.._src_litegraph.js.html#l1429"><code>..&#x2F;src&#x2F;litegraph.js:1429</code></a>
<a href="../files/.._src_litegraph.js.html#l1440"><code>..&#x2F;src&#x2F;litegraph.js:1440</code></a>
</p>
@@ -983,7 +983,7 @@
<a href="../files/.._src_litegraph.js.html#l1962"><code>..&#x2F;src&#x2F;litegraph.js:1962</code></a>
<a href="../files/.._src_litegraph.js.html#l1973"><code>..&#x2F;src&#x2F;litegraph.js:1973</code></a>
</p>
@@ -1052,7 +1052,7 @@
<a href="../files/.._src_litegraph.js.html#l1541"><code>..&#x2F;src&#x2F;litegraph.js:1541</code></a>
<a href="../files/.._src_litegraph.js.html#l1552"><code>..&#x2F;src&#x2F;litegraph.js:1552</code></a>
</p>
@@ -1144,7 +1144,7 @@
<a href="../files/.._src_litegraph.js.html#l1125"><code>..&#x2F;src&#x2F;litegraph.js:1125</code></a>
<a href="../files/.._src_litegraph.js.html#l1165"><code>..&#x2F;src&#x2F;litegraph.js:1165</code></a>
</p>
@@ -1225,7 +1225,7 @@
<a href="../files/.._src_litegraph.js.html#l1621"><code>..&#x2F;src&#x2F;litegraph.js:1621</code></a>
<a href="../files/.._src_litegraph.js.html#l1632"><code>..&#x2F;src&#x2F;litegraph.js:1632</code></a>
</p>
@@ -1364,7 +1364,7 @@
<a href="../files/.._src_litegraph.js.html#l1771"><code>..&#x2F;src&#x2F;litegraph.js:1771</code></a>
<a href="../files/.._src_litegraph.js.html#l1782"><code>..&#x2F;src&#x2F;litegraph.js:1782</code></a>
</p>
@@ -1477,7 +1477,7 @@
<a href="../files/.._src_litegraph.js.html#l1704"><code>..&#x2F;src&#x2F;litegraph.js:1704</code></a>
<a href="../files/.._src_litegraph.js.html#l1715"><code>..&#x2F;src&#x2F;litegraph.js:1715</code></a>
</p>
@@ -1600,7 +1600,7 @@
<a href="../files/.._src_litegraph.js.html#l1591"><code>..&#x2F;src&#x2F;litegraph.js:1591</code></a>
<a href="../files/.._src_litegraph.js.html#l1602"><code>..&#x2F;src&#x2F;litegraph.js:1602</code></a>
</p>
@@ -1707,7 +1707,7 @@
<a href="../files/.._src_litegraph.js.html#l1606"><code>..&#x2F;src&#x2F;litegraph.js:1606</code></a>
<a href="../files/.._src_litegraph.js.html#l1617"><code>..&#x2F;src&#x2F;litegraph.js:1617</code></a>
</p>
@@ -1804,7 +1804,7 @@
<a href="../files/.._src_litegraph.js.html#l1559"><code>..&#x2F;src&#x2F;litegraph.js:1559</code></a>
<a href="../files/.._src_litegraph.js.html#l1570"><code>..&#x2F;src&#x2F;litegraph.js:1570</code></a>
</p>
@@ -1893,7 +1893,7 @@
<a href="../files/.._src_litegraph.js.html#l1828"><code>..&#x2F;src&#x2F;litegraph.js:1828</code></a>
<a href="../files/.._src_litegraph.js.html#l1839"><code>..&#x2F;src&#x2F;litegraph.js:1839</code></a>
</p>
@@ -2016,7 +2016,7 @@
<a href="../files/.._src_litegraph.js.html#l1311"><code>..&#x2F;src&#x2F;litegraph.js:1311</code></a>
<a href="../files/.._src_litegraph.js.html#l1322"><code>..&#x2F;src&#x2F;litegraph.js:1322</code></a>
</p>
@@ -2122,7 +2122,7 @@
<a href="../files/.._src_litegraph.js.html#l1337"><code>..&#x2F;src&#x2F;litegraph.js:1337</code></a>
<a href="../files/.._src_litegraph.js.html#l1348"><code>..&#x2F;src&#x2F;litegraph.js:1348</code></a>
</p>
@@ -2226,7 +2226,7 @@
<a href="../files/.._src_litegraph.js.html#l1352"><code>..&#x2F;src&#x2F;litegraph.js:1352</code></a>
<a href="../files/.._src_litegraph.js.html#l1363"><code>..&#x2F;src&#x2F;litegraph.js:1363</code></a>
</p>
@@ -2330,7 +2330,7 @@
<a href="../files/.._src_litegraph.js.html#l1379"><code>..&#x2F;src&#x2F;litegraph.js:1379</code></a>
<a href="../files/.._src_litegraph.js.html#l1390"><code>..&#x2F;src&#x2F;litegraph.js:1390</code></a>
</p>
@@ -2420,7 +2420,7 @@
<a href="../files/.._src_litegraph.js.html#l1279"><code>..&#x2F;src&#x2F;litegraph.js:1279</code></a>
<a href="../files/.._src_litegraph.js.html#l1290"><code>..&#x2F;src&#x2F;litegraph.js:1290</code></a>
</p>
@@ -2489,7 +2489,7 @@
<a href="../files/.._src_litegraph.js.html#l1325"><code>..&#x2F;src&#x2F;litegraph.js:1325</code></a>
<a href="../files/.._src_litegraph.js.html#l1336"><code>..&#x2F;src&#x2F;litegraph.js:1336</code></a>
</p>
@@ -2593,7 +2593,7 @@
<a href="../files/.._src_litegraph.js.html#l1367"><code>..&#x2F;src&#x2F;litegraph.js:1367</code></a>
<a href="../files/.._src_litegraph.js.html#l1378"><code>..&#x2F;src&#x2F;litegraph.js:1378</code></a>
</p>
@@ -2703,7 +2703,7 @@
<a href="../files/.._src_litegraph.js.html#l1569"><code>..&#x2F;src&#x2F;litegraph.js:1569</code></a>
<a href="../files/.._src_litegraph.js.html#l1580"><code>..&#x2F;src&#x2F;litegraph.js:1580</code></a>
</p>
@@ -2808,7 +2808,7 @@
<a href="../files/.._src_litegraph.js.html#l1975"><code>..&#x2F;src&#x2F;litegraph.js:1975</code></a>
<a href="../files/.._src_litegraph.js.html#l1986"><code>..&#x2F;src&#x2F;litegraph.js:1986</code></a>
</p>
@@ -2873,7 +2873,7 @@
<a href="../files/.._src_litegraph.js.html#l1514"><code>..&#x2F;src&#x2F;litegraph.js:1514</code></a>
<a href="../files/.._src_litegraph.js.html#l1525"><code>..&#x2F;src&#x2F;litegraph.js:1525</code></a>
</p>
@@ -2961,7 +2961,7 @@
<a href="../files/.._src_litegraph.js.html#l1454"><code>..&#x2F;src&#x2F;litegraph.js:1454</code></a>
<a href="../files/.._src_litegraph.js.html#l1465"><code>..&#x2F;src&#x2F;litegraph.js:1465</code></a>
</p>
@@ -3039,7 +3039,7 @@
<a href="../files/.._src_litegraph.js.html#l1176"><code>..&#x2F;src&#x2F;litegraph.js:1176</code></a>
<a href="../files/.._src_litegraph.js.html#l1224"><code>..&#x2F;src&#x2F;litegraph.js:1224</code></a>
</p>
@@ -3110,7 +3110,7 @@
<a href="../files/.._src_litegraph.js.html#l1292"><code>..&#x2F;src&#x2F;litegraph.js:1292</code></a>
<a href="../files/.._src_litegraph.js.html#l1303"><code>..&#x2F;src&#x2F;litegraph.js:1303</code></a>
</p>
@@ -3203,7 +3203,7 @@
<a href="../files/.._src_litegraph.js.html#l1267"><code>..&#x2F;src&#x2F;litegraph.js:1267</code></a>
<a href="../files/.._src_litegraph.js.html#l1278"><code>..&#x2F;src&#x2F;litegraph.js:1278</code></a>
</p>

View File

@@ -298,7 +298,7 @@
<a href="../files/.._src_litegraph.js.html#l65"><code>..&#x2F;src&#x2F;litegraph.js:65</code></a>
<a href="../files/.._src_litegraph.js.html#l68"><code>..&#x2F;src&#x2F;litegraph.js:68</code></a>
</p>
@@ -423,7 +423,7 @@
<a href="../files/.._src_litegraph.js.html#l105"><code>..&#x2F;src&#x2F;litegraph.js:105</code></a>
<a href="../files/.._src_litegraph.js.html#l109"><code>..&#x2F;src&#x2F;litegraph.js:109</code></a>
</p>
@@ -530,7 +530,7 @@
<a href="../files/.._src_litegraph.js.html#l118"><code>..&#x2F;src&#x2F;litegraph.js:118</code></a>
<a href="../files/.._src_litegraph.js.html#l122"><code>..&#x2F;src&#x2F;litegraph.js:122</code></a>
</p>
@@ -627,7 +627,7 @@
<a href="../files/.._src_litegraph.js.html#l140"><code>..&#x2F;src&#x2F;litegraph.js:140</code></a>
<a href="../files/.._src_litegraph.js.html#l144"><code>..&#x2F;src&#x2F;litegraph.js:144</code></a>
</p>
@@ -712,7 +712,7 @@
<a href="../files/.._src_litegraph.js.html#l34"><code>..&#x2F;src&#x2F;litegraph.js:34</code></a>
<a href="../files/.._src_litegraph.js.html#l37"><code>..&#x2F;src&#x2F;litegraph.js:37</code></a>
</p>

View File

@@ -38,7 +38,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 227,
"line": 231,
"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": 1096,
"line": 1130,
"description": "Base Class for all the node type classes",
"params": [
{
@@ -70,7 +70,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 2278,
"line": 2369,
"description": "marks as dirty the canvas, this way it will be rendered again",
"is_constructor": 1,
"params": [
@@ -91,7 +91,7 @@
"classitems": [
{
"file": "../src/litegraph.js",
"line": 34,
"line": 37,
"description": "Register a node class so it can be listed when the user wants to create a new one",
"itemtype": "method",
"name": "registerNodeType",
@@ -111,7 +111,7 @@
},
{
"file": "../src/litegraph.js",
"line": 65,
"line": 68,
"description": "Create a node of a given type with a name. The node is not attached to any graph yet.",
"itemtype": "method",
"name": "createNode",
@@ -136,7 +136,7 @@
},
{
"file": "../src/litegraph.js",
"line": 105,
"line": 109,
"description": "Returns a registered node type with a given name",
"itemtype": "method",
"name": "getNodeType",
@@ -155,7 +155,7 @@
},
{
"file": "../src/litegraph.js",
"line": 118,
"line": 122,
"description": "Returns a list of node types matching one category",
"itemtype": "method",
"name": "getNodeType",
@@ -174,7 +174,7 @@
},
{
"file": "../src/litegraph.js",
"line": 140,
"line": 144,
"description": "Returns a list with all the node type categories",
"itemtype": "method",
"name": "getNodeTypesCategories",
@@ -186,7 +186,7 @@
},
{
"file": "../src/litegraph.js",
"line": 251,
"line": 255,
"description": "Removes all nodes from this graph",
"itemtype": "method",
"name": "clear",
@@ -194,7 +194,7 @@
},
{
"file": "../src/litegraph.js",
"line": 296,
"line": 300,
"description": "Attach Canvas to this graph",
"itemtype": "method",
"name": "attachCanvas",
@@ -209,7 +209,7 @@
},
{
"file": "../src/litegraph.js",
"line": 315,
"line": 319,
"description": "Detach Canvas from this graph",
"itemtype": "method",
"name": "detachCanvas",
@@ -224,7 +224,7 @@
},
{
"file": "../src/litegraph.js",
"line": 329,
"line": 333,
"description": "Starts running this graph every interval milliseconds.",
"itemtype": "method",
"name": "start",
@@ -239,7 +239,7 @@
},
{
"file": "../src/litegraph.js",
"line": 356,
"line": 360,
"description": "Stops the execution loop of the graph",
"itemtype": "method",
"name": "stop execution",
@@ -247,7 +247,7 @@
},
{
"file": "../src/litegraph.js",
"line": 378,
"line": 382,
"description": "Run N steps (cycles) of the graph",
"itemtype": "method",
"name": "runStep",
@@ -262,7 +262,7 @@
},
{
"file": "../src/litegraph.js",
"line": 422,
"line": 426,
"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",
@@ -270,7 +270,7 @@
},
{
"file": "../src/litegraph.js",
"line": 520,
"line": 524,
"description": "Returns the amount of time the graph has been running in milliseconds",
"itemtype": "method",
"name": "getTime",
@@ -282,7 +282,7 @@
},
{
"file": "../src/litegraph.js",
"line": 531,
"line": 535,
"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",
@@ -294,7 +294,7 @@
},
{
"file": "../src/litegraph.js",
"line": 542,
"line": 546,
"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",
@@ -306,7 +306,7 @@
},
{
"file": "../src/litegraph.js",
"line": 554,
"line": 558,
"description": "Sends an event to all the nodes, useful to trigger stuff",
"itemtype": "method",
"name": "sendEventToAllNodes",
@@ -326,7 +326,7 @@
},
{
"file": "../src/litegraph.js",
"line": 582,
"line": 586,
"description": "Adds a new node instasnce to this graph",
"itemtype": "method",
"name": "add",
@@ -341,7 +341,7 @@
},
{
"file": "../src/litegraph.js",
"line": 631,
"line": 635,
"description": "Removes a node from the graph",
"itemtype": "method",
"name": "remove",
@@ -356,7 +356,7 @@
},
{
"file": "../src/litegraph.js",
"line": 697,
"line": 701,
"description": "Returns a node by its id.",
"itemtype": "method",
"name": "getNodeById",
@@ -371,7 +371,7 @@
},
{
"file": "../src/litegraph.js",
"line": 710,
"line": 714,
"description": "Returns a list of nodes that matches a type",
"itemtype": "method",
"name": "findNodesByType",
@@ -390,7 +390,7 @@
},
{
"file": "../src/litegraph.js",
"line": 726,
"line": 730,
"description": "Returns a list of nodes that matches a name",
"itemtype": "method",
"name": "findNodesByName",
@@ -409,7 +409,7 @@
},
{
"file": "../src/litegraph.js",
"line": 742,
"line": 746,
"description": "Returns the top-most node in this position of the canvas",
"itemtype": "method",
"name": "getNodeOnPos",
@@ -438,7 +438,7 @@
},
{
"file": "../src/litegraph.js",
"line": 900,
"line": 933,
"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",
@@ -458,7 +458,7 @@
},
{
"file": "../src/litegraph.js",
"line": 915,
"line": 948,
"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",
@@ -477,7 +477,7 @@
},
{
"file": "../src/litegraph.js",
"line": 952,
"line": 985,
"description": "returns if the graph is in live mode",
"itemtype": "method",
"name": "isLive",
@@ -485,7 +485,7 @@
},
{
"file": "../src/litegraph.js",
"line": 985,
"line": 1018,
"description": "Creates a Object containing all the info about this graph, it can be serialized",
"itemtype": "method",
"name": "serialize",
@@ -497,7 +497,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1018,
"line": 1051,
"description": "Configure a graph from a JSON string",
"itemtype": "method",
"name": "configure",
@@ -512,7 +512,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1125,
"line": 1165,
"description": "configure a node from an object containing the serialized info",
"itemtype": "method",
"name": "configure",
@@ -520,7 +520,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1176,
"line": 1224,
"description": "serialize the content",
"itemtype": "method",
"name": "serialize",
@@ -528,7 +528,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1267,
"line": 1278,
"description": "serialize and stringify",
"itemtype": "method",
"name": "toString",
@@ -536,7 +536,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1279,
"line": 1290,
"description": "get the title string",
"itemtype": "method",
"name": "getTitle",
@@ -544,7 +544,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1292,
"line": 1303,
"description": "sets the output data",
"itemtype": "method",
"name": "setOutputData",
@@ -564,7 +564,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1311,
"line": 1322,
"description": "retrieves the input data from one slot",
"itemtype": "method",
"name": "getInputData",
@@ -583,7 +583,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1325,
"line": 1336,
"description": "tells you if there is a connection in one input slot",
"itemtype": "method",
"name": "isInputConnected",
@@ -602,7 +602,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1337,
"line": 1348,
"description": "tells you info about an input connection (which node, type, etc)",
"itemtype": "method",
"name": "getInputInfo",
@@ -621,7 +621,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1352,
"line": 1363,
"description": "tells you info about an output connection (which node, type, etc)",
"itemtype": "method",
"name": "getOutputInfo",
@@ -640,7 +640,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1367,
"line": 1378,
"description": "tells you if there is a connection in one output slot",
"itemtype": "method",
"name": "isOutputConnected",
@@ -659,7 +659,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1379,
"line": 1390,
"description": "retrieves all the nodes connected to this output slot",
"itemtype": "method",
"name": "getOutputNodes",
@@ -678,7 +678,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1408,
"line": 1419,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutput",
@@ -703,7 +703,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1429,
"line": 1440,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutputs",
@@ -718,7 +718,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1454,
"line": 1465,
"description": "remove an existing output slot",
"itemtype": "method",
"name": "removeOutput",
@@ -733,7 +733,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1468,
"line": 1479,
"description": "add a new input slot to use in this node",
"itemtype": "method",
"name": "addInput",
@@ -750,7 +750,7 @@
},
{
"name": "extra_info",
"description": "this can be used to have special properties of an input (special color, position, etc)",
"description": "this can be used to have special properties of an input (label, color, position, etc)",
"type": "Object"
}
],
@@ -758,7 +758,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1489,
"line": 1500,
"description": "add several new input slots in this node",
"itemtype": "method",
"name": "addInputs",
@@ -773,7 +773,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1514,
"line": 1525,
"description": "remove an existing input slot",
"itemtype": "method",
"name": "removeInput",
@@ -788,7 +788,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1528,
"line": 1539,
"description": "add an special connection to this node (used for special kinds of graphs)",
"itemtype": "method",
"name": "addConnection",
@@ -818,7 +818,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1541,
"line": 1552,
"description": "computes the size of a node according to its inputs and output slots",
"itemtype": "method",
"name": "computeSize",
@@ -837,7 +837,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1559,
"line": 1570,
"description": "returns the bounding of the object, used for rendering purposes",
"itemtype": "method",
"name": "getBounding",
@@ -849,7 +849,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1569,
"line": 1580,
"description": "checks if a point is inside the shape of a node",
"itemtype": "method",
"name": "isPointInsideNode",
@@ -873,7 +873,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1591,
"line": 1602,
"description": "returns the input slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findInputSlot",
@@ -892,7 +892,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1606,
"line": 1617,
"description": "returns the output slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findOutputSlot",
@@ -911,7 +911,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1621,
"line": 1632,
"description": "connect this node output to the input of another node",
"itemtype": "method",
"name": "connect",
@@ -940,7 +940,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1704,
"line": 1715,
"description": "disconnect one output to an specific node",
"itemtype": "method",
"name": "disconnectOutput",
@@ -964,7 +964,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1771,
"line": 1782,
"description": "disconnect one input",
"itemtype": "method",
"name": "disconnectInput",
@@ -983,7 +983,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1828,
"line": 1839,
"description": "returns the center of a connection point in canvas coords",
"itemtype": "method",
"name": "getConnectionPos",
@@ -1007,7 +1007,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1962,
"line": 1973,
"description": "Collapse the node to make it smaller on the canvas",
"itemtype": "method",
"name": "collapse",
@@ -1015,7 +1015,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1975,
"line": 1986,
"description": "Forces the node to do not move or realign on Z",
"itemtype": "method",
"name": "pin",
@@ -1023,7 +1023,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2032,
"line": 2047,
"description": "clears all the data inside",
"itemtype": "method",
"name": "clear",
@@ -1031,7 +1031,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2086,
"line": 2101,
"description": "assigns a graph, you can reasign graphs to the same canvas",
"itemtype": "method",
"name": "setGraph",
@@ -1046,7 +1046,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2114,
"line": 2129,
"description": "opens a graph contained inside a node in the current graph",
"itemtype": "method",
"name": "openSubgraph",
@@ -1061,7 +1061,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2141,
"line": 2156,
"description": "closes a subgraph contained inside a node",
"itemtype": "method",
"name": "closeSubgraph",
@@ -1076,7 +1076,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2156,
"line": 2171,
"description": "assigns a canvas",
"itemtype": "method",
"name": "setCanvas",
@@ -1091,7 +1091,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2294,
"line": 2385,
"description": "Used to attach the canvas in a popup",
"itemtype": "method",
"name": "getCanvasWindow",
@@ -1103,7 +1103,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2306,
"line": 2397,
"description": "starts rendering the content of the canvas when needed",
"itemtype": "method",
"name": "startRendering",
@@ -1111,7 +1111,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2337,
"line": 2420,
"description": "stops rendering the content of the canvas (to save resources)",
"itemtype": "method",
"name": "stopRendering",

View File

@@ -113,6 +113,7 @@ var LiteGraph = {
NODE_COLLAPSED_RADIUS: 10,
NODE_COLLAPSED_WIDTH: 80,
CANVAS_GRID_SIZE: 10,
NODE_TITLE_COLOR: &quot;#222&quot;,
NODE_DEFAULT_COLOR: &quot;#999&quot;,
NODE_DEFAULT_BGCOLOR: &quot;#444&quot;,
NODE_DEFAULT_BOXCOLOR: &quot;#AEF&quot;,
@@ -121,6 +122,8 @@ var LiteGraph = {
DEFAULT_POSITION: [100,100],//default node position
node_images_path: &quot;&quot;,
proxy: null, //used to redirect calls
debug: false,
throw_errors: true,
registered_node_types: {},
@@ -182,6 +185,7 @@ var LiteGraph = {
node.type = type;
if(!node.title) node.title = title;
if(!node.properties) node.properties = {};
if(!node.flags) node.flags = {};
if(!node.size) node.size = node.computeSize();
if(!node.pos) node.pos = LiteGraph.DEFAULT_POSITION.concat();
@@ -887,8 +891,11 @@ LGraph.prototype.getGlobalInputData = function(name)
}
//rename the global input
LGraph.prototype.renameGlobalInput = function(old_name, name, data)
LGraph.prototype.renameGlobalInput = function(old_name, name)
{
if(name == old_name)
return;
if(!this.global_inputs[old_name])
return false;
@@ -908,6 +915,19 @@ LGraph.prototype.renameGlobalInput = function(old_name, name, data)
this.onGlobalsChange();
}
LGraph.prototype.changeGlobalInputType = function(name, type)
{
if(!this.global_inputs[name])
return false;
if(this.global_inputs[name].type == type)
return;
this.global_inputs[name].type = type;
if(this.onGlobalInputTypeChanged)
this.onGlobalInputTypeChanged(name, type);
}
LGraph.prototype.removeGlobalInput = function(name)
{
if(!this.global_inputs[name])
@@ -955,7 +975,7 @@ LGraph.prototype.getGlobalOutputData = function(name)
//rename the global output
LGraph.prototype.renameGlobalOutput = function(old_name, name, data)
LGraph.prototype.renameGlobalOutput = function(old_name, name)
{
if(!this.global_outputs[old_name])
return false;
@@ -976,6 +996,19 @@ LGraph.prototype.renameGlobalOutput = function(old_name, name, data)
this.onGlobalsChange();
}
LGraph.prototype.changeGlobalOutputType = function(name, type)
{
if(!this.global_outputs[name])
return false;
if(this.global_outputs[name].type == type)
return;
this.global_outputs[name].type = type;
if(this.onGlobalOutputTypeChanged)
this.onGlobalOutputTypeChanged(name, type);
}
LGraph.prototype.removeGlobalOutput = function(name)
{
if(!this.global_outputs[name])
@@ -1185,6 +1218,7 @@ LGraph.prototype.onNodeTrace = function(node, msg, color)
+ onSerialize
+ onSelected
+ onDeselected
+ onDropFile
*/
/**
@@ -1194,6 +1228,11 @@ LGraph.prototype.onNodeTrace = function(node, msg, color)
*/
function LGraphNode(title)
{
this._ctor();
}
LGraphNode.prototype._ctor = function( title )
{
this.title = title || &quot;Unnamed&quot;;
this.size = [LiteGraph.NODE_WIDTH,60];
@@ -1209,6 +1248,7 @@ function LGraphNode(title)
this.connections = [];
//local data
this.properties = {};
this.data = null; //persistent local data
this.flags = {
//skip_title_render: true,
@@ -1226,6 +1266,14 @@ LGraphNode.prototype.configure = function(info)
{
if(j == &quot;console&quot;) continue;
if(j == &quot;properties&quot;)
{
//i dont want to clone properties, I want to reuse the old container
for(var k in info.properties)
this.properties[k] = info.properties[k];
continue;
}
if(info[j] == null)
continue;
else if (typeof(info[j]) == &#x27;object&#x27;) //object
@@ -1317,46 +1365,9 @@ LGraphNode.prototype.clone = function()
delete data[&quot;id&quot;];
node.configure(data);
/*
node.size = this.size.concat();
if(this.inputs)
for(var i = 0, l = this.inputs.length; i &lt; l; ++i)
{
if(node.findInputSlot( this.inputs[i].name ) == -1)
node.addInput( this.inputs[i].name, this.inputs[i].type );
}
if(this.outputs)
for(var i = 0, l = this.outputs.length; i &lt; l; ++i)
{
if(node.findOutputSlot( this.outputs[i].name ) == -1)
node.addOutput( this.outputs[i].name, this.outputs[i].type );
}
*/
return node;
}
//reduced version of objectivize: NOT FINISHED
/*
LGraphNode.prototype.reducedObjectivize = function()
{
var o = this.objectivize();
var type = LiteGraph.getNodeType(o.type);
if(type.title == o.title)
delete o[&quot;title&quot;];
if(type.size &amp;&amp; compareObjects(o.size,type.size))
delete o[&quot;size&quot;];
if(type.properties &amp;&amp; compareObjects(o.properties, type.properties))
delete o[&quot;properties&quot;];
return o;
}
*/
/**
* serialize and stringify
@@ -1564,7 +1575,7 @@ LGraphNode.prototype.removeOutput = function(slot)
* @method addInput
* @param {string} name
* @param {string} type string defining the input type (&quot;vec3&quot;,&quot;number&quot;,...)
* @param {Object} extra_info this can be used to have special properties of an input (special color, position, etc)
* @param {Object} extra_info this can be used to have special properties of an input (label, color, position, etc)
*/
LGraphNode.prototype.addInput = function(name,type,extra_info)
{
@@ -1590,7 +1601,7 @@ LGraphNode.prototype.addInputs = function(array)
for(var i in array)
{
var info = array[i];
var o = {name:info[0],type:info[1],link:null};
var o = {name:info[0], type:info[1], link:null};
if(array[2])
for(var j in info[2])
o[j] = info[2][j];
@@ -1641,7 +1652,7 @@ LGraphNode.prototype.addConnection = function(name,type,pos,direction)
LGraphNode.prototype.computeSize = function(minHeight)
{
var rows = Math.max( this.inputs ? this.inputs.length : 1, this.outputs ? this.outputs.length : 1);
var size = [0,0];
var size = new Float32Array([0,0]);
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;
@@ -1775,8 +1786,8 @@ LGraphNode.prototype.connect = function(slot, node, target_slot)
output.links = [];
output.links.push({id:node.id, slot: -1});
}
else if(output.type == 0 || //generic output
node.inputs[target_slot].type == 0 || //generic input
else if( !output.type || //generic output
!node.inputs[target_slot].type || //generic input
output.type == node.inputs[target_slot].type) //same type
{
//info: link structure =&gt; [ 0:link_id, 1:start_node_id, 2:start_slot, 3:end_node_id, 4:end_slot ]
@@ -2099,7 +2110,7 @@ LGraphNode.prototype.localToScreen = function(x,y, graphcanvas)
* @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)
function LGraphCanvas(canvas, graph, skip_render)
{
//if(graph === undefined)
// throw (&quot;No graph assigned&quot;);
@@ -2110,6 +2121,9 @@ function LGraphCanvas(canvas, graph)
if(!canvas)
throw(&quot;no canvas found&quot;);
this.max_zoom = 10;
this.min_zoom = 0.1;
//link canvas and graph
if(graph)
graph.attachCanvas(this);
@@ -2117,7 +2131,8 @@ function LGraphCanvas(canvas, graph)
this.setCanvas(canvas);
this.clear();
this.startRendering();
if(!skip_render)
this.startRendering();
}
LGraphCanvas.link_type_colors = {&#x27;number&#x27;:&quot;#AAC&quot;,&#x27;node&#x27;:&quot;#DCA&quot;};
@@ -2267,8 +2282,8 @@ LGraphCanvas.prototype.setCanvas = function(canvas)
this.canvas = canvas;
//this.canvas.tabindex = &quot;1000&quot;;
this.canvas.className += &quot; lgraphcanvas&quot;;
this.canvas.data = this;
canvas.className += &quot; lgraphcanvas&quot;;
canvas.data = this;
//bg canvas: used for non changing stuff
this.bgcanvas = null;
@@ -2279,47 +2294,123 @@ LGraphCanvas.prototype.setCanvas = function(canvas)
this.bgcanvas.height = this.canvas.height;
}
if(this.canvas.getContext == null)
if(canvas.getContext == null)
{
throw(&quot;This browser doesnt support Canvas&quot;);
}
this.ctx = this.canvas.getContext(&quot;2d&quot;);
this.bgctx = this.bgcanvas.getContext(&quot;2d&quot;);
var ctx = this.ctx = canvas.getContext(&quot;2d&quot;);
if(ctx == null)
{
console.warn(&quot;This canvas seems to be WebGL, enabling WebGL renderer&quot;);
this.enableWebGL();
}
//input: (move and up could be unbinded)
this._mousemove_callback = this.processMouseMove.bind(this);
this._mouseup_callback = this.processMouseUp.bind(this);
this.canvas.addEventListener(&quot;mousedown&quot;, this.processMouseDown.bind(this), true ); //down do not need to store the binded
this.canvas.addEventListener(&quot;mousemove&quot;, this._mousemove_callback);
canvas.addEventListener(&quot;mousedown&quot;, this.processMouseDown.bind(this), true ); //down do not need to store the binded
canvas.addEventListener(&quot;mousemove&quot;, this._mousemove_callback);
this.canvas.addEventListener(&quot;contextmenu&quot;, function(e) { e.preventDefault(); return false; });
canvas.addEventListener(&quot;contextmenu&quot;, function(e) { e.preventDefault(); return false; });
this.canvas.addEventListener(&quot;mousewheel&quot;, this.processMouseWheel.bind(this), false);
this.canvas.addEventListener(&quot;DOMMouseScroll&quot;, this.processMouseWheel.bind(this), false);
canvas.addEventListener(&quot;mousewheel&quot;, this.processMouseWheel.bind(this), false);
canvas.addEventListener(&quot;DOMMouseScroll&quot;, this.processMouseWheel.bind(this), false);
//touch events
//if( &#x27;touchstart&#x27; in document.documentElement )
{
//alert(&quot;doo&quot;);
this.canvas.addEventListener(&quot;touchstart&quot;, this.touchHandler, true);
this.canvas.addEventListener(&quot;touchmove&quot;, this.touchHandler, true);
this.canvas.addEventListener(&quot;touchend&quot;, this.touchHandler, true);
this.canvas.addEventListener(&quot;touchcancel&quot;, this.touchHandler, true);
canvas.addEventListener(&quot;touchstart&quot;, this.touchHandler, true);
canvas.addEventListener(&quot;touchmove&quot;, this.touchHandler, true);
canvas.addEventListener(&quot;touchend&quot;, this.touchHandler, true);
canvas.addEventListener(&quot;touchcancel&quot;, this.touchHandler, true);
}
//this.canvas.onselectstart = function () { return false; };
this.canvas.addEventListener(&quot;keydown&quot;, function(e) {
canvas.addEventListener(&quot;keydown&quot;, function(e) {
that.processKeyDown(e);
});
this.canvas.addEventListener(&quot;keyup&quot;, function(e) {
canvas.addEventListener(&quot;keyup&quot;, function(e) {
that.processKeyUp(e);
});
//droping files
canvas.ondragover = function () { console.log(&#x27;hover&#x27;); return false; };
canvas.ondragend = function () { console.log(&#x27;out&#x27;); return false; };
canvas.ondrop = function (e) {
e.preventDefault();
that.adjustMouseEvent(e);
var pos = [e.canvasX,e.canvasY];
var node = that.graph.getNodeOnPos(pos[0],pos[1]);
if(!node)
return;
if(!node.onDropFile)
return;
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 );
};
//read data
var type = file.type.split(&quot;/&quot;)[0];
if(type == &quot;text&quot;)
reader.readAsText(file);
else if (type == &quot;image&quot;)
reader.readAsDataURL(file);
else
reader.readAsArrayBuffer(file);
return false;
};
}
LGraphCanvas.getFileExtension = function (url)
{
var question = url.indexOf(&quot;?&quot;);
if(question != -1)
url = url.substr(0,question);
var point = url.lastIndexOf(&quot;.&quot;);
if(point == -1)
return &quot;&quot;;
return url.substr(point+1).toLowerCase();
}
//this file allows to render the canvas using WebGL instead of Canvas2D
//this is useful if you plant to render 3D objects inside your nodes
LGraphCanvas.prototype.enableWebGL = function()
{
if(typeof(GL) === undefined)
throw(&quot;litegl.js must be included to use a WebGL canvas&quot;);
if(typeof(enableWebGLCanvas) === undefined)
throw(&quot;webglCanvas.js must be included to use this feature&quot;);
this.gl = this.ctx = enableWebGLCanvas(this.canvas);
this.ctx.webgl = true;
this.bgcanvas = this.canvas;
this.bgctx = this.gl;
/*
GL.create({ canvas: this.bgcanvas });
this.bgctx = enableWebGLCanvas( this.bgcanvas );
window.gl = this.gl;
*/
}
/*
LGraphCanvas.prototype.UIinit = function()
{
@@ -2418,14 +2509,6 @@ LGraphCanvas.prototype.startRendering = function()
if(this.is_rendering)
window.requestAnimationFrame( renderFrame.bind(this) );
}
/*
this.rendering_timer_id = setInterval( function() {
//trace(&quot;Frame: &quot; + new Date().getTime() );
that.draw();
}, 1000/50);
*/
}
/**
@@ -2533,6 +2616,13 @@ LGraphCanvas.prototype.processMouseDown = function(e)
}
}
//Search for corner
if( !skip_action &amp;&amp; isInsideRectangle(e.canvasX, e.canvasY, n.pos[0], n.pos[1] - LiteGraph.NODE_TITLE_HEIGHT ,LiteGraph.NODE_TITLE_HEIGHT, LiteGraph.NODE_TITLE_HEIGHT ))
{
n.collapse();
skip_action = true;
}
//it wasnt clicked on the links boxes
if(!skip_action)
{
@@ -2674,7 +2764,7 @@ LGraphCanvas.prototype.processMouseMove = function(e)
if(slot != -1 &amp;&amp; n.inputs[slot])
{
var slot_type = n.inputs[slot].type;
if(slot_type == this.connecting_output.type || slot_type == &quot;*&quot; || this.connecting_output.type == &quot;*&quot;)
if(slot_type == this.connecting_output.type || !slot_type || !this.connecting_output.type )
this._highlight_input = pos;
}
else
@@ -2786,6 +2876,13 @@ LGraphCanvas.prototype.processMouseUp = function(e)
{
this.connecting_node.connect(this.connecting_slot, node, slot);
}
else
{ //not on top of an input
var input = node.getInputInfo(0);
//simple connect
if(input &amp;&amp; !input.link &amp;&amp; input.type == this.connecting_output.type)
this.connecting_node.connect(this.connecting_slot, node, 0);
}
}
}
@@ -3068,10 +3165,10 @@ LGraphCanvas.prototype.setZoom = function(value, zooming_center)
this.scale = value;
if(this.scale &gt; 4)
this.scale = 4;
else if(this.scale &lt; 0.1)
this.scale = 0.1;
if(this.scale &gt; this.max_zoom)
this.scale = this.max_zoom;
else if(this.scale &lt; this.min_zoom)
this.scale = this.min_zoom;
var new_center = this.convertOffsetToCanvas( zooming_center );
var delta_offset = [new_center[0] - center[0], new_center[1] - center[1]];
@@ -3158,7 +3255,7 @@ LGraphCanvas.prototype.draw = function(force_canvas, force_bgcanvas)
}
if(this.dirty_bgcanvas || force_bgcanvas)
this.drawBgcanvas();
this.drawBackCanvas();
if(this.dirty_canvas || force_canvas)
this.drawFrontCanvas();
@@ -3169,7 +3266,15 @@ LGraphCanvas.prototype.draw = function(force_canvas, force_bgcanvas)
LGraphCanvas.prototype.drawFrontCanvas = function()
{
if(!this.ctx)
this.ctx = this.bgcanvas.getContext(&quot;2d&quot;);
var ctx = this.ctx;
if(!ctx) //maybe is using webgl...
return;
if(ctx.start)
ctx.start();
var canvas = this.canvas;
//reset in case of error
@@ -3190,7 +3295,14 @@ LGraphCanvas.prototype.drawFrontCanvas = function()
ctx.clearRect(0,0,canvas.width, canvas.height);
//draw bg canvas
ctx.drawImage(this.bgcanvas,0,0);
if(this.bgcanvas == this.canvas)
this.drawBackCanvas();
else
ctx.drawImage(this.bgcanvas,0,0);
//rendering
if(this.onRender)
this.onRender(canvas, ctx);
//info widget
if(this.show_info)
@@ -3275,17 +3387,23 @@ LGraphCanvas.prototype.drawFrontCanvas = function()
//this.dirty_area = null;
}
if(ctx.finish) //this is a function I use in webgl renderer
ctx.finish();
this.dirty_canvas = false;
}
LGraphCanvas.prototype.drawBgcanvas = function()
LGraphCanvas.prototype.drawBackCanvas = function()
{
var canvas = this.bgcanvas;
if(!this.bgctx)
this.bgctx = this.bgcanvas.getContext(&quot;2d&quot;);
var ctx = this.bgctx;
if(ctx.start)
ctx.start();
//clear
canvas.width = canvas.width;
ctx.clearRect(0,0,canvas.width, canvas.height);
//reset in case of error
ctx.restore();
@@ -3302,7 +3420,7 @@ LGraphCanvas.prototype.drawBgcanvas = function()
if(this.background_image &amp;&amp; this.scale &gt; 0.5)
{
ctx.globalAlpha = (1.0 - 0.5 / this.scale) * this.editor_alpha;
ctx.webkitImageSmoothingEnabled = ctx.mozImageSmoothingEnabled = ctx.imageSmoothingEnabled = false
ctx.webkitImageSmoothingEnabled = ctx.mozImageSmoothingEnabled = ctx.imageSmoothingEnabled = false;
if(!this._bg_img || this._bg_img.name != this.background_image)
{
this._bg_img = new Image();
@@ -3331,8 +3449,12 @@ LGraphCanvas.prototype.drawBgcanvas = function()
}
ctx.globalAlpha = 1.0;
ctx.webkitImageSmoothingEnabled = ctx.mozImageSmoothingEnabled = ctx.imageSmoothingEnabled = true;
}
if(this.onBackgroundRender)
this.onBackgroundRender(canvas, ctx);
//DEBUG: show clipping area
//ctx.fillStyle = &quot;red&quot;;
//ctx.fillRect( this.visible_area[0] + 10, this.visible_area[1] + 10, this.visible_area[2] - this.visible_area[0] - 20, this.visible_area[3] - this.visible_area[1] - 20);
@@ -3361,6 +3483,9 @@ LGraphCanvas.prototype.drawBgcanvas = function()
ctx.restore();
}
if(ctx.finish)
ctx.finish();
this.dirty_bgcanvas = false;
this.dirty_canvas = true; //to force to repaint the front canvas with the bgcanvas
}
@@ -3433,7 +3558,10 @@ LGraphCanvas.prototype.drawNode = function(node, ctx )
var shape = node.shape || &quot;box&quot;;
var size = new Float32Array(node.size);
if(node.flags.collapsed)
size.set([LiteGraph.NODE_COLLAPSED_WIDTH, 0]);
{
size[0] = LiteGraph.NODE_COLLAPSED_WIDTH;
size[1] = 0;
}
//Start clipping
if(node.flags.clip_area)
@@ -3586,27 +3714,30 @@ LGraphCanvas.prototype.drawNodeShape = function(node, ctx, size, fgcolor, bgcolo
var shape = node.shape || &quot;box&quot;;
if(shape == &quot;box&quot;)
{
ctx.beginPath();
ctx.rect(0,no_title ? 0 : -title_height, size[0]+1, no_title ? size[1] : size[1] + title_height);
ctx.fill();
ctx.shadowColor = &quot;transparent&quot;;
if(selected)
{
ctx.strokeStyle = &quot;#CCC&quot;;
ctx.strokeRect(-0.5,no_title ? -0.5 : -title_height + -0.5, size[0]+2, no_title ? (size[1]+2) : (size[1] + title_height+2) );
ctx.strokeRect(-0.5,no_title ? -0.5 : -title_height + -0.5, size[0]+2, no_title ? (size[1]+2) : (size[1] + title_height+2) - 1);
ctx.strokeStyle = fgcolor;
}
ctx.beginPath();
ctx.rect(0,no_title ? 0.5 : -title_height + 0.5,size[0]+1, no_title ? size[1] : size[1] + title_height);
}
else if (node.shape == &quot;round&quot;)
{
ctx.roundRect(0,no_title ? 0 : -title_height,size[0], no_title ? size[1] : size[1] + title_height, 10);
ctx.fill();
}
else if (node.shape == &quot;circle&quot;)
{
ctx.beginPath();
ctx.arc(size[0] * 0.5, size[1] * 0.5, size[0] * 0.5, 0, Math.PI*2);
ctx.fill();
}
ctx.fill();
ctx.shadowColor = &quot;transparent&quot;;
//ctx.stroke();
@@ -3630,15 +3761,16 @@ LGraphCanvas.prototype.drawNodeShape = function(node, ctx, size, fgcolor, bgcolo
if(shape == &quot;box&quot;)
{
ctx.beginPath();
ctx.fillRect(0,-title_height,size[0]+1,title_height);
ctx.stroke();
ctx.rect(0, -title_height, size[0]+1, title_height);
ctx.fill()
//ctx.stroke();
}
else if (shape == &quot;round&quot;)
{
ctx.roundRect(0,-title_height,size[0], title_height,10,0);
//ctx.fillRect(0,8,size[0],NODE_TITLE_HEIGHT - 12);
ctx.fill();
ctx.stroke();
//ctx.stroke();
}
//box
@@ -3654,9 +3786,9 @@ LGraphCanvas.prototype.drawNodeShape = function(node, ctx, size, fgcolor, bgcolo
//title text
ctx.font = this.title_text_font;
var title = node.getTitle();
if(title &amp;&amp; this.scale &gt; 0.8)
if(title &amp;&amp; this.scale &gt; 0.5)
{
ctx.fillStyle = &quot;#222&quot;;
ctx.fillStyle = LiteGraph.NODE_TITLE_COLOR;
ctx.fillText( title, 16, 13 - title_height );
}
}
@@ -4160,15 +4292,18 @@ LGraphCanvas.prototype.getCanvasMenuOptions = function()
//{content:&quot;Collapse All&quot;, callback: LGraphCanvas.onMenuCollapseAll }
];
if(this._graph_stack)
if(this._graph_stack &amp;&amp; this._graph_stack.length &gt; 0)
options = [{content:&quot;Close subgraph&quot;, callback: this.closeSubgraph.bind(this) },null].concat(options);
}
if(this.getExtraMenuOptions)
{
var extra = this.getExtraMenuOptions(this);
extra.push(null);
options = extra.concat( options );
if(extra)
{
extra.push(null);
options = extra.concat( options );
}
}
return options;
@@ -4195,8 +4330,11 @@ LGraphCanvas.prototype.getNodeMenuOptions = function(node)
if(node.getExtraMenuOptions)
{
var extra = node.getExtraMenuOptions(this);
extra.push(null);
options = extra.concat( options );
if(extra)
{
extra.push(null);
options = extra.concat( options );
}
}
if( node.clonable !== false )
@@ -4520,14 +4658,35 @@ LiteGraph.closeAllContextualMenus = function()
result[i].parentNode.removeChild( result[i] );
}
LiteGraph.extendClass = function(origin, target)
LiteGraph.extendClass = function ( target, origin )
{
for(var i in origin) //copy class properties
{
if(target.hasOwnProperty(i))
continue;
target[i] = origin[i];
}
if(origin.prototype) //copy prototype properties
for(var i in origin.prototype)
target.prototype[i] = origin.prototype[i];
}
for(var i in origin.prototype) //only enumerables
{
if(!origin.prototype.hasOwnProperty(i))
continue;
if(target.prototype.hasOwnProperty(i)) //avoid overwritting existing ones
continue;
//copy getters
if(origin.prototype.__lookupGetter__(i))
target.prototype.__defineGetter__(i, origin.prototype.__lookupGetter__(i));
else
target.prototype[i] = origin.prototype[i];
//and setters
if(origin.prototype.__lookupSetter__(i))
target.prototype.__defineSetter__(i, origin.prototype.__lookupSetter__(i));
}
}
/*
LiteGraph.createNodetypeWrapper = function( class_object )