Commit 9e37faed authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[GraphExplorer] label size & threshold work now

parent 1ed34b98
......@@ -49,6 +49,7 @@ type Store =
, showEdges :: T.Box SigmaxT.ShowEdgesState
, showLouvain :: T.Box Boolean
, labelSize :: T.Box Number
, labelRenderedSizeThreshold :: T.Box Number
, mouseSelectorSize :: T.Box Number
, startForceAtlas :: T.Box Boolean
-- Terms update
......@@ -79,6 +80,7 @@ type State =
, showEdges :: SigmaxT.ShowEdgesState
, showLouvain :: Boolean
, labelSize :: Number
, labelRenderedSizeThreshold :: Number
, mouseSelectorSize :: Number
, startForceAtlas :: Boolean
-- Terms update
......@@ -96,6 +98,7 @@ options ::
, expandNeighborhood :: Boolean
-- Controls
, labelSize :: Number
, labelRenderedSizeThreshold :: Number
, mouseSelectorSize :: Number
, multiSelectEnabled :: Boolean
, edgeConfluence :: Range.NumberRange
......@@ -118,6 +121,7 @@ options =
-- Controls
, multiSelectEnabled : false
, labelSize : 14.0
, labelRenderedSizeThreshold : 6.0
, mouseSelectorSize : 15.0
, edgeConfluence : Range.Closed { min: 0.0, max: 1.0 }
, graphStage : GET.Init
......
......@@ -16,7 +16,7 @@ import Gargantext.Components.GraphExplorer.Resources as Graph
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Toolbar.Buttons (centerButton, cameraButton, edgesToggleButton, louvainToggleButton, pauseForceAtlasButton, multiSelectEnabledButton)
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, mouseSelectorSizeButton)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeButton)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
......@@ -56,6 +56,9 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, graphId
, graphStage
, hyperdataGraph
, labelRenderedSizeThreshold
, labelSize
, mouseSelectorSize
, multiSelectEnabled
, nodeSize
, selectedNodeIds
......@@ -63,8 +66,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, showLouvain
, showSidebar
, sideTab
, mouseSelectorSize
, labelSize
} <- GraphStore.use
forceAtlasState' <- R2.useLive' forceAtlasState
......@@ -262,6 +263,24 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, state: nodeSize }
]
,
H.div
{ className: "d-flex justify-content-between" }
[
-- change level
-- file upload
-- run demo
-- search button
-- search topics
labelRenderedSizeThresholdButton sigmaRef labelRenderedSizeThreshold
-- ,
-- -- labels size: 1-4
-- nodeSizeControl
-- { range: nodeSizeRange
-- , state: nodeSize }
]
]
]
......
......@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer.Toolbar.SlideButton
( Props
, sizeButton
, labelSizeButton
, labelRenderedSizeThresholdButton
, mouseSelectorSizeButton
) where
......@@ -75,12 +76,33 @@ labelSizeButton sigmaRef state =
Sigma.setSettings s {
defaultLabelSize: newValue
, drawLabels: true
, labelSize: newValue
, maxNodeSize: newValue / 2.5
--, labelSizeRatio: newValue / 2.5
}
T.write_ newValue state
}
labelRenderedSizeThresholdButton :: R.Ref Sigmax.Sigma -> T.Box Number -> R.Element
labelRenderedSizeThresholdButton sigmaRef state =
sizeButton {
state
, caption: "Label rendered size threshold"
, min: 0.0
, max: 10.0
, onChange: \e -> do
let sigma = R.readRef sigmaRef
let newValue' = DN.fromString $ R.unsafeEventValue e
case newValue' of
Nothing -> pure unit
Just newValue ->
Sigmax.dependOnSigma sigma "[labelRenderdSizeThresholdButton] sigma: Nothing" $ \s -> do
Sigma.setSettings s {
labelRenderedSizeThreshold: newValue
}
T.write_ newValue state
}
mouseSelectorSizeButton :: R.Ref Sigmax.Sigma -> T.Box Number -> R.Element
mouseSelectorSizeButton sigmaRef state =
sizeButton {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment