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
edb80396
Commit
edb80396
authored
Oct 18, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE]
parents
ffda1747
dd5f3c45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
20 deletions
+32
-20
Resources.purs
src/Gargantext/Components/GraphExplorer/Resources.purs
+8
-1
Controls.purs
...Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
+7
-2
Sigma.js
src/Gargantext/Hooks/Sigmax/Sigma.js
+2
-1
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+15
-16
No files found.
src/Gargantext/Components/GraphExplorer/Resources.purs
View file @
edb80396
...
...
@@ -111,7 +111,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
Nothing -> do
_ <- ECC.error "elRef is empty"
pure $ Left "elRef is empty"
Just el -> Sigma.sigma el {
settings: sigmaSettings theme
}
Just el -> Sigma.sigma el {
settings: sigmaSettings theme
}
case eSigma of
Left err -> here.warn2 "[graphCpt] error creating sigma" err
Right sig -> do
...
...
@@ -133,6 +133,11 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
Sigmax.bindSelectedNodesClick sigma selectedNodeIds multiSelectEnabled
Sigmax.bindShiftWheel sigma mouseSelectorSize
_ <- Sigma.bindMouseSelectorPlugin sigma
-- NOTE For some reason, setting 'renderLabels:
-- false' in sigmaSettings and initializing sigma
-- with those settings doesn't work. We need to set
-- the renderLabels: false here again.
Sigma.setSettings sigma { renderLabels: false }
pure unit
Sigmax.setSigmaEdgesVisibility sig { edgeConfluence: edgeConfluence'
...
...
@@ -281,6 +286,7 @@ type SigmaSettings =
-- , nodeBorderColor :: String
-- , nodeHoverColor :: String
--, nodesPowRatio :: Number
, renderLabels :: Boolean
-- , rescaleIgnoreSize :: Boolean
-- , scalingMode :: String
-- , sideMargin :: Number
...
...
@@ -349,6 +355,7 @@ sigmaSettings theme =
-- , mouseZoomDuration : 150.0
-- , nodeBorderColor : "default" -- choices: "default" color vs. "node" color
--, nodesPowRatio : 10.8
, renderLabels: false -- initially false, because of forceatlas
-- , rescaleIgnoreSize : false
-- , singleHover : true
-- , touchEnabled : true
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
edb80396
...
...
@@ -21,6 +21,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Types as GT
import Gargantext.Utils.Range as Range
...
...
@@ -101,8 +102,12 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- 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
v <- T.read showEdges
here.log2 "[controls] modifed showEdges to forceAtlasState'" v
let renderLabels = SigmaxT.forceAtlasLabelState forceAtlasState'
here.log2 "[controls] renderLabels" renderLabels
Sigmax.dependOnSigma (R.readRef sigmaRef) "[graphCpt (Cleanup)] no sigma" $ \sigma -> do
Sigma.setSettings sigma { renderLabels }
-- v <- T.read showEdges
-- here.log2 "[controls] modifed showEdges to forceAtlasState'" v
-- Automatic opening of sidebar when a node is selected (but only first time).
R.useEffect' $ do
...
...
src/Gargantext/Hooks/Sigmax/Sigma.js
View file @
edb80396
...
...
@@ -165,7 +165,7 @@ function _sigma(left, right, el, opts) {
try
{
let
graph
=
new
Graph
();
let
s
=
new
sigma
(
graph
,
el
,
opts
.
settigns
);
console
.
log
(
'[_sigma] initializing sigma with el'
,
el
,
'opts'
,
opts
,
'sigma'
,
s
);
console
.
log
(
'[_sigma] initializing sigma with el'
,
el
,
'opts'
,
opts
.
settings
,
'sigma'
,
s
);
console
.
log
(
'[_sigma] labelRenderedSizeThreshold'
,
opts
.
settings
.
labelRenderedSizeThreshold
);
sigmaMouseSelector
(
s
);
return
right
(
s
);
...
...
@@ -207,6 +207,7 @@ let dummy = function() {};
let
_setSettings
=
function
(
g
,
settings
)
{
for
(
const
key
in
settings
)
{
//console.log('[setSettings] key', key, settings[key]);
g
.
setSetting
(
key
,
settings
[
key
]);
}
}
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
edb80396
...
...
@@ -178,7 +178,6 @@ toggleForceAtlasState Killed = InitialRunning
-- | 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 _
instance Eq ShowEdgesState where
eq = genericEq
...
...
@@ -199,21 +198,6 @@ toggleShowEdgesState s =
else
EHide
-- | Return the temporary hidden state, if applicable.
edgeStateTempHide :: ShowEdgesState -> ShowEdgesState
edgeStateTempHide EHide = EHide
edgeStateTempHide _ = ETempHiddenThenShow
-- | Whether, after disabling the temp state, edges will be shown or hidden.
edgeStateWillBeHidden :: ShowEdgesState -> Boolean
edgeStateWillBeHidden EHide = true
edgeStateWillBeHidden _ = false
-- | Get rid of the temporary transition
edgeStateStabilize :: ShowEdgesState -> ShowEdgesState
edgeStateStabilize ETempHiddenThenShow = EShow
edgeStateStabilize s = s
-- | Return state in which showEdges should be depending on forceAtlasState
forceAtlasEdgeState :: ForceAtlasState -> ShowEdgesState -> ShowEdgesState
forceAtlasEdgeState InitialRunning EShow = ETempHiddenThenShow
...
...
@@ -227,6 +211,21 @@ forceAtlasEdgeState Killed ETempHiddenThenShow = EShow
forceAtlasEdgeState Killed es = es
-- Similar situation for labels: hide them when force atlas is
-- running, to prevent flickering.
-- However, for labels this is simpler because we don't have a toggle
-- button.
-- | Return state in which labels should be depending on forceAtlasState
forceAtlasLabelState :: ForceAtlasState -> Boolean
forceAtlasLabelState InitialRunning = false
forceAtlasLabelState InitialStopped = true
forceAtlasLabelState Running = false
forceAtlasLabelState Paused = true
forceAtlasLabelState Killed = true
louvainEdges :: SGraph -> Array (Record Louvain.Edge)
louvainEdges g = Seq.toUnfoldable $ Seq.map (\{source, target, weight} -> {source, target, weight}) (graphEdges g)
louvainNodes :: SGraph -> Array Louvain.Node
...
...
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