ngraph.three
Advanced tools
Comparing version 0.0.2 to 0.0.3
20
index.js
@@ -8,2 +8,4 @@ module.exports = function (graph, settings) { | ||
var beforeFrameRender; | ||
var isStable = false; | ||
var disposed = false; | ||
var layout = createLayout(settings); | ||
@@ -56,3 +58,2 @@ var renderer = createRenderer(settings); | ||
createNodeUI : function (createNodeUICallback) { | ||
nodeUI = {}; | ||
nodeUIBuilder = createNodeUICallback; | ||
@@ -101,3 +102,2 @@ rebuildUI(); | ||
createLinkUI : function (createLinkUICallback) { | ||
linkUI = {}; | ||
linkUIBuilder = createLinkUICallback; | ||
@@ -164,4 +164,8 @@ rebuildUI(); | ||
function run() { | ||
if (disposed) return; | ||
requestAnimationFrame(run); | ||
layout.step(); | ||
if (!isStable) { | ||
isStable = layout.step(); | ||
} | ||
controls.update(1); | ||
@@ -173,2 +177,3 @@ renderOneFrame(); | ||
// let clients selectively choose what to dispose | ||
disposed = true; | ||
options = merge(options, { | ||
@@ -181,4 +186,2 @@ layout: true, | ||
beforeFrameRender = null; | ||
run = function noop() {}; // next RAF will go here | ||
renderOneFrame = function () { throw new Error('ngraph.three is disposed.'); }; | ||
@@ -256,2 +259,3 @@ graph.off('changed', onGraphChanged); | ||
function onGraphChanged(changes) { | ||
resetStable(); | ||
for (var i = 0; i < changes.length; ++i) { | ||
@@ -281,2 +285,6 @@ var change = changes[i]; | ||
function resetStable() { | ||
isStable = false; | ||
} | ||
function createLayout(settings) { | ||
@@ -335,2 +343,3 @@ if (settings.layout) { | ||
}); | ||
nodeUI = {}; | ||
@@ -340,2 +349,3 @@ Object.keys(linkUI).forEach(function (linkId) { | ||
}); | ||
linkUI = {}; | ||
@@ -342,0 +352,0 @@ graph.forEachLink(initLink); |
{ | ||
"name": "ngraph.three", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "3D graph rendered powered by three.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1255888
24555