Commit 5e770fd1 authored by James Laver's avatar James Laver

Use dysfun's fork of sigma, which has been defanged somewhat

parent 96d1d57c
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
"prop-types": "15.6.2", "prop-types": "15.6.2",
"react": "^16.8.6", "react": "^16.8.6",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-sigma": "git://github.com/np/react-sigma.git#shouldComponentUpdate", "sigma": "git://github.com/jjl/sigma.js#garg"
"sigma": "^1.2.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.1.5", "@babel/cli": "^7.1.5",
......
'use strict'; 'use strict';
const sigma = require('sigma').sigma; const sigma = require('sigma/src/garg.js').sigma;
const react_sigma = require('react-sigma');
const FL = require('react-sigma/lib/ForceLink');
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.sigma = sigma; window.sigma = sigma;
} }
require('sigma/plugins/garg.js').init(sigma, window);
function _sigma(left, right, opts) { function _sigma(left, right, opts) {
try { try {
return right(new sigma(opts)); return right(new sigma(opts));
...@@ -23,6 +23,7 @@ function graphRead(left, right, sigma, data) { ...@@ -23,6 +23,7 @@ function graphRead(left, right, sigma, data) {
return left(e); return left(e);
} }
} }
function refresh(sigma) { sigma.refresh(); }
function addRenderer(left, right, sigma, renderer) { function addRenderer(left, right, sigma, renderer) {
try { try {
return right(sigma.addRenderer(renderer)); return right(sigma.addRenderer(renderer));
...@@ -46,18 +47,22 @@ function killSigma(left, right, sigma) { ...@@ -46,18 +47,22 @@ function killSigma(left, right, sigma) {
return left(e); return left(e);
} }
} }
function clear(sigma) { sigma.graph.clear(); }
function bind(sigma, event, handler) { sigma.bind(event, handler); }
function startForceAtlas2(sigma, settings) { sigma.startForceAtlas2(settings); }
function stopForceAtlas2(sigma) { sigma.stopForceAtlas2(); }
function killForceAtlas2(sigma) { sigma.killForceAtlas2(); }
function isForceAtlas2Running(sigma) { return sigma.isForceAtlas2Running(); }
exports._sigma = _sigma; exports._sigma = _sigma;
exports._graphRead = graphRead; exports._graphRead = graphRead;
exports._refresh = function refresh(sigma) { sigma.refresh(); }; exports._refresh = refresh;
exports._addRenderer = addRenderer; exports._addRenderer = addRenderer;
exports._killRenderer = killRenderer; exports._killRenderer = killRenderer;
exports._killSigma = killSigma exports._killSigma = killSigma
exports._clear = function clear(sigma) { sigma.graph.clear(); }; exports._clear = clear;
exports._bind = function bind(sigma, event, handler) { sigma.bind(event, handler); }; exports._bind = bind;
exports._startForceAtlas2 = function startForceAtlas2(sigma, settings) { exports._startForceAtlas2 = startForceAtlas2;
sigma.startForceAtlas2(settings); exports._stopForceAtlas2 = stopForceAtlas2;
}; exports._killForceAtlas2 = killForceAtlas2;
exports._stopForceAtlas2 = function stopForceAtlas2(sigma) { sigma.stopForceAtlas2(); }; exports._isForceAtlas2Running = isForceAtlas2Running;
exports._killForceAtlas2 = function killForceAtlas2(sigma) { sigma.killForceAtlas2(); };
...@@ -104,9 +104,13 @@ stopForceAtlas2 = runEffectFn1 _stopForceAtlas2 ...@@ -104,9 +104,13 @@ stopForceAtlas2 = runEffectFn1 _stopForceAtlas2
killForceAtlas2 :: Sigma -> Effect Unit killForceAtlas2 :: Sigma -> Effect Unit
killForceAtlas2 = runEffectFn1 _killForceAtlas2 killForceAtlas2 = runEffectFn1 _killForceAtlas2
isForceAtlas2Running :: Sigma -> Effect Boolean
isForceAtlas2Running = runEffectFn1 _isForceAtlas2Running
foreign import _startForceAtlas2 :: forall s. EffectFn2 Sigma s Unit foreign import _startForceAtlas2 :: forall s. EffectFn2 Sigma s Unit
foreign import _stopForceAtlas2 :: EffectFn1 Sigma Unit foreign import _stopForceAtlas2 :: EffectFn1 Sigma Unit
foreign import _killForceAtlas2 :: EffectFn1 Sigma Unit foreign import _killForceAtlas2 :: EffectFn1 Sigma Unit
foreign import _isForceAtlas2Running :: EffectFn1 Sigma Boolean
newtype SigmaEasing = SigmaEasing String newtype SigmaEasing = SigmaEasing String
......
...@@ -3701,10 +3701,8 @@ shelljs@^0.8.2, shelljs@^0.8.3: ...@@ -3701,10 +3701,8 @@ shelljs@^0.8.2, shelljs@^0.8.3:
interpret "^1.0.0" interpret "^1.0.0"
rechoir "^0.6.2" rechoir "^0.6.2"
sigma@^1.2.1: sigma@../sigma.js:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/sigma/-/sigma-1.2.1.tgz#2ebf3df2971715afe49ad0c08945c574bb6c5771"
integrity sha512-9Z0m1pssXv6sndPMvOzXnM1mVO73YCWDE6X5bKxJyG+9J0B9zJkgtgoBM7cnxEaJMzmrbxPceKTVpwF7cS/xqA==
signal-exit@^3.0.0, signal-exit@^3.0.2: signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2" version "3.0.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment