Commit 3268a4c7 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[Graph] more forceAtlas work, still not done

parent 0a44304c
......@@ -8,6 +8,7 @@ import Prelude
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null)
import DOM.Simple.Console (log2)
import FFI.Simple (delay)
import Reactix as R
import Reactix.DOM.HTML as RH
import Gargantext.Hooks.Sigmax
......@@ -43,16 +44,24 @@ graphCpt = R.hooksComponent "Graph" cpt
cpt props _ = do
ref <- R.useRef null
let mSigma = R.readRef props.sigmaRef
_ <- pure $ log2 "[graphCpt] mSigma" mSigma
sigma <- case mSigma of
Just s -> pure s
Nothing -> do
sigma_ <- useSigma ref props.sigmaSettings
_ <- pure $ R.setRef props.sigmaRef $ Just sigma_
pure sigma_
sigma <- useSigma ref props.sigmaSettings
useCanvasRenderer ref sigma
useData sigma props.graph
useForceAtlas2 sigma props.forceAtlas2Settings
R.useLayoutEffect $
delay unit $ \_ -> do
log2 "[graphCpt] mSigma" mSigma
pure $ case mSigma of
Just s -> do
log2 "[graphCpt] mSigma is Just" s
pure unit
Nothing -> do
log2 "[graphCpt] setting sigmaRef" $ Just sigma
log2 "[graphCpt] readSigma" $ readSigma sigma
R.setRef props.sigmaRef $ Just sigma
pure $ RH.div { ref, style: {height: "95%"} } []
type SigmaSettings =
......
......@@ -84,8 +84,10 @@ pauseForceAtlasButton sigmaRef state = R.createElement el props []
Just sigma -> do
log2 "[pauseForceAtlasButton] sigma" sigma
log2 "[pauseForceAtlasButton] toggled" toggled
let rSigma = Sigmax.readSigma sigma
log2 "[pauseForceAtlasButton] rSigma" rSigma
if toggled then
case Sigmax.readSigma sigma of
case rSigma of
Nothing -> pure unit
Just s -> stopForceAtlas2 s
else
......
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