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
06a55f13
Commit
06a55f13
authored
Oct 18, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sigma] do not render labels when forceatlas is on
parent
4270b0de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
20 deletions
+28
-20
Resources.purs
src/Gargantext/Components/GraphExplorer/Resources.purs
+4
-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 @
06a55f13
...
@@ -111,7 +111,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
...
@@ -111,7 +111,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
Nothing -> do
Nothing -> do
_ <- ECC.error "elRef is empty"
_ <- ECC.error "elRef is empty"
pure $ Left "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
case eSigma of
Left err -> here.warn2 "[graphCpt] error creating sigma" err
Left err -> here.warn2 "[graphCpt] error creating sigma" err
Right sig -> do
Right sig -> do
...
@@ -133,6 +133,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
...
@@ -133,6 +133,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
Sigmax.bindSelectedNodesClick sigma selectedNodeIds multiSelectEnabled
Sigmax.bindSelectedNodesClick sigma selectedNodeIds multiSelectEnabled
Sigmax.bindShiftWheel sigma mouseSelectorSize
Sigmax.bindShiftWheel sigma mouseSelectorSize
_ <- Sigma.bindMouseSelectorPlugin sigma
_ <- Sigma.bindMouseSelectorPlugin sigma
Sigma.setSettings sigma { renderLabels: false }
pure unit
pure unit
Sigmax.setSigmaEdgesVisibility sig { edgeConfluence: edgeConfluence'
Sigmax.setSigmaEdgesVisibility sig { edgeConfluence: edgeConfluence'
...
@@ -281,6 +282,7 @@ type SigmaSettings =
...
@@ -281,6 +282,7 @@ type SigmaSettings =
-- , nodeBorderColor :: String
-- , nodeBorderColor :: String
-- , nodeHoverColor :: String
-- , nodeHoverColor :: String
--, nodesPowRatio :: Number
--, nodesPowRatio :: Number
, renderLabels :: Boolean
-- , rescaleIgnoreSize :: Boolean
-- , rescaleIgnoreSize :: Boolean
-- , scalingMode :: String
-- , scalingMode :: String
-- , sideMargin :: Number
-- , sideMargin :: Number
...
@@ -349,6 +351,7 @@ sigmaSettings theme =
...
@@ -349,6 +351,7 @@ sigmaSettings theme =
-- , mouseZoomDuration : 150.0
-- , mouseZoomDuration : 150.0
-- , nodeBorderColor : "default" -- choices: "default" color vs. "node" color
-- , nodeBorderColor : "default" -- choices: "default" color vs. "node" color
--, nodesPowRatio : 10.8
--, nodesPowRatio : 10.8
, renderLabels: false -- initially false, because of forceatlas
-- , rescaleIgnoreSize : false
-- , rescaleIgnoreSize : false
-- , singleHover : true
-- , singleHover : true
-- , touchEnabled : true
-- , touchEnabled : true
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
06a55f13
...
@@ -21,6 +21,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
...
@@ -21,6 +21,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
...
@@ -101,8 +102,12 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -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.
-- NOTE This is a hack anyways. It's force atlas that should be fixed.
R.useEffect2' sigmaRef forceAtlasState' $ do
R.useEffect2' sigmaRef forceAtlasState' $ do
T.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
T.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
v <- T.read showEdges
let renderLabels = SigmaxT.forceAtlasLabelState forceAtlasState'
here.log2 "[controls] modifed showEdges to forceAtlasState'" v
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).
-- Automatic opening of sidebar when a node is selected (but only first time).
R.useEffect' $ do
R.useEffect' $ do
...
...
src/Gargantext/Hooks/Sigmax/Sigma.js
View file @
06a55f13
...
@@ -165,7 +165,7 @@ function _sigma(left, right, el, opts) {
...
@@ -165,7 +165,7 @@ function _sigma(left, right, el, opts) {
try
{
try
{
let
graph
=
new
Graph
();
let
graph
=
new
Graph
();
let
s
=
new
sigma
(
graph
,
el
,
opts
.
settigns
);
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
);
console
.
log
(
'[_sigma] labelRenderedSizeThreshold'
,
opts
.
settings
.
labelRenderedSizeThreshold
);
sigmaMouseSelector
(
s
);
sigmaMouseSelector
(
s
);
return
right
(
s
);
return
right
(
s
);
...
@@ -207,6 +207,7 @@ let dummy = function() {};
...
@@ -207,6 +207,7 @@ let dummy = function() {};
let
_setSettings
=
function
(
g
,
settings
)
{
let
_setSettings
=
function
(
g
,
settings
)
{
for
(
const
key
in
settings
)
{
for
(
const
key
in
settings
)
{
//console.log('[setSettings] key', key, settings[key]);
g
.
setSetting
(
key
,
settings
[
key
]);
g
.
setSetting
(
key
,
settings
[
key
]);
}
}
}
}
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
06a55f13
...
@@ -178,7 +178,6 @@ toggleForceAtlasState Killed = InitialRunning
...
@@ -178,7 +178,6 @@ toggleForceAtlasState Killed = InitialRunning
-- | NOTE ETempHiddenThenShow state is a hack for force atlas
-- | NOTE ETempHiddenThenShow state is a hack for force atlas
-- | flickering. Ideally it should be removed from here.
-- | flickering. Ideally it should be removed from here.
data ShowEdgesState = EShow | EHide | ETempHiddenThenShow
data ShowEdgesState = EShow | EHide | ETempHiddenThenShow
derive instance Generic ShowEdgesState _
derive instance Generic ShowEdgesState _
instance Eq ShowEdgesState where
instance Eq ShowEdgesState where
eq = genericEq
eq = genericEq
...
@@ -199,21 +198,6 @@ toggleShowEdgesState s =
...
@@ -199,21 +198,6 @@ toggleShowEdgesState s =
else
else
EHide
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
-- | Return state in which showEdges should be depending on forceAtlasState
forceAtlasEdgeState :: ForceAtlasState -> ShowEdgesState -> ShowEdgesState
forceAtlasEdgeState :: ForceAtlasState -> ShowEdgesState -> ShowEdgesState
forceAtlasEdgeState InitialRunning EShow = ETempHiddenThenShow
forceAtlasEdgeState InitialRunning EShow = ETempHiddenThenShow
...
@@ -227,6 +211,21 @@ forceAtlasEdgeState Killed ETempHiddenThenShow = EShow
...
@@ -227,6 +211,21 @@ forceAtlasEdgeState Killed ETempHiddenThenShow = EShow
forceAtlasEdgeState Killed es = es
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 :: SGraph -> Array (Record Louvain.Edge)
louvainEdges g = Seq.toUnfoldable $ Seq.map (\{source, target, weight} -> {source, target, weight}) (graphEdges g)
louvainEdges g = Seq.toUnfoldable $ Seq.map (\{source, target, weight} -> {source, target, weight}) (graphEdges g)
louvainNodes :: SGraph -> Array Louvain.Node
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