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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
gargantext
purescript-gargantext
Commits
ec6db7d5
Commit
ec6db7d5
authored
Sep 24, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] pause forceAtlas after some time
parent
5d299bfb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+22
-1
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+0
-1
No files found.
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
ec6db7d5
...
@@ -11,10 +11,14 @@ module Gargantext.Components.GraphExplorer.Controls
...
@@ -11,10 +11,14 @@ module Gargantext.Components.GraphExplorer.Controls
, getMultiNodeSelect, setMultiNodeSelect
, getMultiNodeSelect, setMultiNodeSelect
) where
) where
import Data.Int (round)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import D
OM.Simple as DOM
import D
ata.Tuple (snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple as DOM
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Prelude
import Prelude
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as RH
import Reactix.DOM.HTML as RH
...
@@ -24,6 +28,7 @@ import Gargantext.Components.GraphExplorer.Button (centerButton)
...
@@ -24,6 +28,7 @@ import Gargantext.Components.GraphExplorer.Button (centerButton)
import Gargantext.Components.GraphExplorer.RangeControl (edgeSizeControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.RangeControl (edgeSizeControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.SlideButton (cursorSizeButton, labelSizeButton)
import Gargantext.Components.GraphExplorer.SlideButton (cursorSizeButton, labelSizeButton)
import Gargantext.Components.GraphExplorer.ToggleButton (edgesToggleButton, pauseForceAtlasButton)
import Gargantext.Components.GraphExplorer.ToggleButton (edgesToggleButton, pauseForceAtlasButton)
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -71,9 +76,25 @@ controls props = R.createElement controlsCpt props []
...
@@ -71,9 +76,25 @@ controls props = R.createElement controlsCpt props []
controlsCpt :: R.Component Controls
controlsCpt :: R.Component Controls
controlsCpt = R.hooksComponent "GraphControls" cpt
controlsCpt = R.hooksComponent "GraphControls" cpt
where
where
forceAtlas2Timeout = 2.0 -- in seconds
cpt props _ = do
cpt props _ = do
localControls <- initialLocalControls
localControls <- initialLocalControls
R.useEffectOnce $ do
_ <- setTimeout (round $ forceAtlas2Timeout * 1000.0) $ do
log2 "Pausing forceatlas" props.sigmaRef
let (pauseForceAtlas /\ setPauseForceAtlas) = localControls.pauseForceAtlas
let mSigma = Sigmax.readSigma <$> R.readRef props.sigmaRef
case mSigma of
Just (Just s) -> if pauseForceAtlas then do
setPauseForceAtlas $ const false
Sigma.stopForceAtlas2 s
else
pure unit
_ -> pure unit
pure $ pure unit
pure $ case getShowControls props of
pure $ case getShowControls props of
false -> RH.div {} []
false -> RH.div {} []
true -> RH.div { className: "col-md-12", style: { paddingBottom: "10px" } }
true -> RH.div { className: "col-md-12", style: { paddingBottom: "10px" } }
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
ec6db7d5
...
@@ -19,4 +19,3 @@ newtype Graph n e = Graph { nodes :: Seq {|n}, edges :: Seq {|e} }
...
@@ -19,4 +19,3 @@ newtype Graph n e = Graph { nodes :: Seq {|n}, edges :: Seq {|e} }
type Renderer = { "type" :: String, container :: Element }
type Renderer = { "type" :: String, container :: Element }
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