Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
b9719ad8
Commit
b9719ad8
authored
Nov 14, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] proper FA pausing works now, even across state refreshes
parent
9c4af297
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
29 deletions
+30
-29
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+12
-29
Sigmax.purs
src/Gargantext/Hooks/Sigmax.purs
+18
-0
No files found.
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
b9719ad8
...
...
@@ -81,18 +81,18 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
--mFAPauseRef <- R.useRef Nothing
--R.useEffect $ handleForceAtlasPause props.sigmaRef localControls.pauseForceAtlas mFAPauseRef
R.useEffect
$ handleForceAtlas
Pause props.sigmaRef localControls.pauseForceAtlas
--
R.useEffectOnce' $ do
--
timeoutId <- setTimeout 2000 $ do
--
--R.setRef mFAPauseRef Nothing
--
let (toggled /\ setToggled) = localControls.pauseForceAtlas
--
if toggled then
--
setToggled $ const false
--
else
--
pure unit
--
--R.setRef mFAPauseRef $ Just timeoutId
--
pure unit
R.useEffect
' $ Sigmax.handleForceAtlas2
Pause props.sigmaRef localControls.pauseForceAtlas
R.useEffectOnce' $ do
timeoutId <- setTimeout 2000 $ do
--R.setRef mFAPauseRef Nothing
let (toggled /\ setToggled) = localControls.pauseForceAtlas
if toggled then
setToggled $ const false
else
pure unit
--R.setRef mFAPauseRef $ Just timeoutId
pure unit
pure $ case getShowControls props of
false -> RH.div {} []
...
...
@@ -118,23 +118,6 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
]
]
]
where
--handleForceAtlasPause sigmaRef (toggled /\ setToggled) mFAPauseRef = do
handleForceAtlasPause sigmaRef (toggled /\ setToggled) = do
let sigma = R.readRef sigmaRef
pure $ Sigmax.dependOnSigma sigma "[handleForceAtlasPause] sigma: Nothing" $ \s -> do
log2 "[handleForceAtlasPause] mSigma: Just " s
log2 "[handleForceAtlasPause] toggled: " toggled
if toggled then
Sigma.stopForceAtlas2 s
else
Sigma.restartForceAtlas2 s
-- handle case when user pressed pause/start fa button before timeout fired
--case R.readRef mFAPauseRef of
-- Nothing -> pure unit
-- Just timeoutId -> do
-- R.setRef mFAPauseRef Nothing
-- clearTimeout timeoutId
useGraphControls :: R.Hooks (Record Controls)
useGraphControls = do
...
...
src/Gargantext/Hooks/Sigmax.purs
View file @
b9719ad8
...
...
@@ -13,6 +13,7 @@ import Data.Nullable (Nullable)
import Data.Sequence (Seq)
import Data.Sequence as Seq
import Data.Traversable (traverse_)
import Data.Tuple.Nested((/\))
import Effect (Effect)
import FFI.Simple (delay)
import Gargantext.Hooks.Sigmax.Sigma as Sigma
...
...
@@ -305,3 +306,20 @@ useForceAtlas2Eff sigma settings = effect
--cleanupFirst sigma (Sigma.killForceAtlas2 sig)
startingMsg = "[useForceAtlas2Eff] Starting ForceAtlas2"
sigmaNotFoundMsg = "[useForceAtlas2Eff] Sigma not found, not initialising"
--handleForceAtlasPause sigmaRef (toggled /\ setToggled) mFAPauseRef = do
handleForceAtlas2Pause :: R.Ref Sigma -> R.State Boolean -> Effect Unit
handleForceAtlas2Pause sigmaRef (toggled /\ setToggled) = do
let sigma = R.readRef sigmaRef
dependOnSigma sigma "[handleForceAtlas2Pause] sigma: Nothing" $ \s -> do
log2 "[handleForceAtlas2Pause] mSigma: Just " s
log2 "[handleForceAtlas2Pause] toggled: " toggled
case toggled of
true -> Sigma.restartForceAtlas2 s
_ -> Sigma.stopForceAtlas2 s
-- handle case when user pressed pause/start fa button before timeout fired
--case R.readRef mFAPauseRef of
-- Nothing -> pure unit
-- Just timeoutId -> do
-- R.setRef mFAPauseRef Nothing
-- clearTimeout timeoutId
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment