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
136
Issues
136
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
6963af35
Commit
6963af35
authored
Jul 14, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] force atlas flickering fix
parent
b2e22224
Pipeline
#1590
failed with stage
Changes
7
Pipelines
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
121 deletions
+131
-121
Graph.purs
src/Gargantext/Components/Graph.purs
+35
-26
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+12
-10
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+3
-3
Sigma.purs
src/Gargantext/Hooks/Sigmax/Sigma.purs
+1
-2
Sigmajs.purs
src/Gargantext/Hooks/Sigmax/Sigmajs.purs
+0
-2
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+2
-0
yarn.lock
yarn.lock
+78
-78
No files found.
src/Gargantext/Components/Graph.purs
View file @
6963af35
...
...
@@ -54,14 +54,9 @@ graph = R.createElement graphCpt
graphCpt :: forall s fa2. R.Component (Props s fa2)
graphCpt = here.component "graph" cpt where
cpt props@{ elRef
, mCamera
, multiSelectEnabledRef
, selectedNodeIds
, showEdges
, sigmaRef
, stage
, startForceAtlas
, transformedGraph } _ = do
, stage } _ = do
showEdges' <- T.useLive T.unequal showEdges
stage' <- T.useLive T.unequal stage
...
...
@@ -83,8 +78,16 @@ graphCpt = here.component "graph" cpt where
Nothing -> RH.div {} []
Just el -> R.createPortal [] el
stageHooks props@{ elRef, mCamera, multiSelectEnabledRef, selectedNodeIds, forceAtlas2Settings: fa2, graph: graph'
, sigmaRef, stage, stage': Init, startForceAtlas } = do
stageHooks { elRef
, mCamera
, multiSelectEnabledRef
, selectedNodeIds
, forceAtlas2Settings: fa2
, graph: graph'
, sigmaRef
, stage
, stage': Init
, startForceAtlas } = do
R.useEffectOnce' $ do
let rSigma = R.readRef sigmaRef
...
...
@@ -126,7 +129,7 @@ graphCpt = here.component "graph" cpt where
Sigma.updateCamera sig { ratio, x, y }
pure unit
Just sig -> do
Just
_
sig -> do
pure unit
T.write Ready stage
...
...
@@ -145,7 +148,9 @@ graphCpt = here.component "graph" cpt where
Sigmax.performDiff sigma transformedGraph
Sigmax.updateEdges sigma tEdgesMap
Sigmax.updateNodes sigma tNodesMap
Sigmax.setEdges sigma (not $ SigmaxTypes.edgeStateHidden showEdges')
let edgesState = not $ SigmaxTypes.edgeStateHidden showEdges'
here.log2 "[graphCpt] edgesState" edgesState
Sigmax.setEdges sigma edgesState
stageHooks _ = pure unit
...
...
@@ -305,8 +310,10 @@ type ForceAtlas2Settings =
( adjustSizes :: Boolean
, barnesHutOptimize :: Boolean
-- , barnesHutTheta :: Number
, batchEdgesDrawing :: Boolean
, edgeWeightInfluence :: Number
-- , fixedY :: Boolean
, hideEdgesOnMove :: Boolean
, gravity :: Number
, includeHiddenEdges :: Boolean
, includeHiddenNodes :: Boolean
...
...
@@ -326,16 +333,18 @@ forceAtlas2Settings :: {|ForceAtlas2Settings}
forceAtlas2Settings =
{ adjustSizes : true
, barnesHutOptimize : true
, batchEdgesDrawing : true
, edgeWeightInfluence : 1.0
-- fixedY : false
, gravity : 0.01
, includeHiddenEdges: false
, includeHiddenNodes: true
, hideEdgesOnMove : true
, includeHiddenEdges : false
, includeHiddenNodes : true
, iterationsPerRender : 50.0 -- 10.0
, linLogMode : false -- false
, outboundAttractionDistribution: false
, outboundAttractionDistribution
: false
, scalingRatio : 1000.0
, skipHidden: false
, skipHidden
: false
, slowDown : 1.0
, startingIterations : 10.0
, strongGravityMode : false
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
6963af35
...
...
@@ -78,9 +78,8 @@ explorerWriteGraph :: R2.Component GraphWriteProps
explorerWriteGraph = R.createElement explorerWriteGraphCpt
explorerWriteGraphCpt :: R.Component GraphWriteProps
explorerWriteGraphCpt = here.component "explorerWriteGraph" cpt where
cpt props@{ boxes: { sidePanelGraph
, sidePanelState
}
cpt props@{ boxes: { sidePanelGraph }
, graph
, hyperdataGraph
, mMetaData' } _ = do
R.useEffectOnce' $ do
T.write_ (Just { mGraph: Just graph
...
...
@@ -99,13 +98,13 @@ explorer = R.createElement explorerCpt
explorerCpt :: R.Component Props
explorerCpt = here.component "explorer" cpt
where
cpt
props@{ boxes: boxes@
{ graphVersion, handed, reloadForest, showTree, sidePanelGraph, sidePanelState }
cpt
{ boxes:
{ graphVersion, handed, reloadForest, showTree, sidePanelGraph, sidePanelState }
, graph
, graphId
, hyperdataGraph
, session
} _ = do
{ mMetaData
, sideTab
} <- GEST.focusedSidePanel sidePanelGraph
{ mMetaData } <- GEST.focusedSidePanel sidePanelGraph
graphVersion' <- T.useLive T.unequal graphVersion
handed' <- T.useLive T.unequal handed
mMetaData' <- T.useLive T.unequal mMetaData
...
...
@@ -318,7 +317,10 @@ transformGraph graph { edgeConfluence'
hasSelection = not $ Set.isEmpty selectedNodeIds'
newEdges' = Seq.filter edgeFilter $ Seq.map (
edgeHideWeight <<< edgeHideConfluence <<< edgeShowFilter <<< edgeMarked
-- NOTE We don't use edgeShowFilter anymore because of
-- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/304
-- edgeHideWeight <<< edgeHideConfluence <<< edgeShowFilter <<< edgeMarked
edgeHideWeight <<< edgeHideConfluence <<< edgeMarked
) edges
newNodes = Seq.filter nodeFilter $ Seq.map (nodeMarked <<< nodeHideSize) nodes
newEdges = Seq.filter (edgeInGraph $ Set.fromFoldable $ Seq.map _.id newNodes) newEdges'
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
6963af35
...
...
@@ -85,7 +85,6 @@ controlsCpt = here.component "controls" cpt
, showControls
, showEdges
, showLouvain
, showTree
, sidePanelState
, sideTab
, sigmaRef } _ = do
...
...
@@ -112,8 +111,9 @@ controlsCpt = here.component "controls" cpt
-- Handle automatic edge hiding when FA is running (to prevent flickering).
-- TODO Commented temporarily: this breaks forceatlas rendering after reset
-- R.useEffect2' sigmaRef forceAtlasState' $ do
-- T.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
-- NOTE This is a hack anyways. It's force atlas that should be fixed.
R.useEffect2' sigmaRef forceAtlasState' $ do
T.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
-- Automatic opening of sidebar when a node is selected (but only first time).
R.useEffect' $ do
...
...
src/Gargantext/Hooks/Sigmax/Sigma.purs
View file @
6963af35
...
...
@@ -6,7 +6,6 @@ import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Either (Either(..))
import Data.Maybe (Maybe)
import Data.Nullable (null)
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse_)
...
...
@@ -48,7 +47,7 @@ sigma = runEffectFn3 _sigma Left Right
-- | Kill a sigmajs instance.
kill :: Sigma -> Effect Unit
kill s
igma = pure $ sigma
... "kill" $ []
kill s
= pure $ s
... "kill" $ []
-- | Call the `refresh()` method on a sigmajs instance.
refresh :: Sigma -> Effect Unit
...
...
src/Gargantext/Hooks/Sigmax/Sigmajs.purs
View file @
6963af35
...
...
@@ -2,10 +2,8 @@ module Gargantext.Hooks.Sigmax.Sigmajs where
import Prelude
import Data.Nullable (Nullable)
import Effect (Effect)
import Effect.Uncurried (EffectFn1, runEffectFn1)
import React (SyntheticEventHandler)
import React.Ref as RR
import Record.Unsafe (unsafeGet)
import Unsafe.Coerce (unsafeCoerce)
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
6963af35
...
...
@@ -173,6 +173,8 @@ toggleForceAtlasState Killed = InitialRunning
-- | Custom state for show edges. Normally it is EShow or EHide (show/hide
-- | edges). However, edges are temporarily turned off when forceAtlas is
-- | running.
-- | NOTE ETempHiddenThenShow state is a hack for force atlas
-- | flickering. Ideally it should be removed from here.
data ShowEdgesState = EShow | EHide | ETempHiddenThenShow
derive instance Generic ShowEdgesState _
...
...
yarn.lock
View file @
6963af35
This diff is collapsed.
Click to expand it.
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