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

[GraphExplorer] label size & threshold work now

parent 1ed34b98
Pipeline #3245 canceled with stage
...@@ -28,105 +28,109 @@ here = R2.here "Gargantext.Components.GraphExplorer.Store" ...@@ -28,105 +28,109 @@ here = R2.here "Gargantext.Components.GraphExplorer.Store"
type Store = type Store =
-- Data -- Data
( graph :: T.Box SigmaxT.SGraph ( graph :: T.Box SigmaxT.SGraph
, graphId :: T.Box GET.GraphId , graphId :: T.Box GET.GraphId
, mMetaData :: T.Box (Maybe GET.MetaData) , mMetaData :: T.Box (Maybe GET.MetaData)
, hyperdataGraph :: T.Box GET.HyperdataGraph , hyperdataGraph :: T.Box GET.HyperdataGraph
-- Layout -- Layout
, showControls :: T.Box Boolean , showControls :: T.Box Boolean
, sideTab :: T.Box GET.SideTab , sideTab :: T.Box GET.SideTab
, showSidebar :: T.Box GT.SidePanelState , showSidebar :: T.Box GT.SidePanelState
, showDoc :: T.Box (Maybe GET.GraphSideDoc) , showDoc :: T.Box (Maybe GET.GraphSideDoc)
, expandSelection :: T.Box Boolean , expandSelection :: T.Box Boolean
, expandNeighborhood :: T.Box Boolean , expandNeighborhood :: T.Box Boolean
-- Controls -- Controls
, multiSelectEnabled :: T.Box Boolean , multiSelectEnabled :: T.Box Boolean
, edgeConfluence :: T.Box Range.NumberRange , edgeConfluence :: T.Box Range.NumberRange
, edgeWeight :: T.Box Range.NumberRange , edgeWeight :: T.Box Range.NumberRange
, forceAtlasState :: T.Box SigmaxT.ForceAtlasState , forceAtlasState :: T.Box SigmaxT.ForceAtlasState
, graphStage :: T.Box GET.Stage , graphStage :: T.Box GET.Stage
, nodeSize :: T.Box Range.NumberRange , nodeSize :: T.Box Range.NumberRange
, showEdges :: T.Box SigmaxT.ShowEdgesState , showEdges :: T.Box SigmaxT.ShowEdgesState
, showLouvain :: T.Box Boolean , showLouvain :: T.Box Boolean
, labelSize :: T.Box Number , labelSize :: T.Box Number
, mouseSelectorSize :: T.Box Number , labelRenderedSizeThreshold :: T.Box Number
, startForceAtlas :: T.Box Boolean , mouseSelectorSize :: T.Box Number
, startForceAtlas :: T.Box Boolean
-- Terms update -- Terms update
, removedNodeIds :: T.Box SigmaxT.NodeIds , removedNodeIds :: T.Box SigmaxT.NodeIds
, selectedNodeIds :: T.Box SigmaxT.NodeIds , selectedNodeIds :: T.Box SigmaxT.NodeIds
) )
type State = type State =
-- Data -- Data
( graph :: SigmaxT.SGraph ( graph :: SigmaxT.SGraph
, graphId :: GET.GraphId , graphId :: GET.GraphId
, mMetaData :: Maybe GET.MetaData , mMetaData :: Maybe GET.MetaData
, hyperdataGraph :: GET.HyperdataGraph , hyperdataGraph :: GET.HyperdataGraph
-- Layout -- Layout
, showControls :: Boolean , showControls :: Boolean
, sideTab :: GET.SideTab , sideTab :: GET.SideTab
, showSidebar :: GT.SidePanelState , showSidebar :: GT.SidePanelState
, showDoc :: Maybe GET.GraphSideDoc , showDoc :: Maybe GET.GraphSideDoc
, expandSelection :: Boolean , expandSelection :: Boolean
, expandNeighborhood :: Boolean , expandNeighborhood :: Boolean
-- Controls -- Controls
, multiSelectEnabled :: Boolean , multiSelectEnabled :: Boolean
, edgeConfluence :: Range.NumberRange , edgeConfluence :: Range.NumberRange
, edgeWeight :: Range.NumberRange , edgeWeight :: Range.NumberRange
, forceAtlasState :: SigmaxT.ForceAtlasState , forceAtlasState :: SigmaxT.ForceAtlasState
, graphStage :: GET.Stage , graphStage :: GET.Stage
, nodeSize :: Range.NumberRange , nodeSize :: Range.NumberRange
, showEdges :: SigmaxT.ShowEdgesState , showEdges :: SigmaxT.ShowEdgesState
, showLouvain :: Boolean , showLouvain :: Boolean
, labelSize :: Number , labelSize :: Number
, mouseSelectorSize :: Number , labelRenderedSizeThreshold :: Number
, startForceAtlas :: Boolean , mouseSelectorSize :: Number
, startForceAtlas :: Boolean
-- Terms update -- Terms update
, removedNodeIds :: SigmaxT.NodeIds , removedNodeIds :: SigmaxT.NodeIds
, selectedNodeIds :: SigmaxT.NodeIds , selectedNodeIds :: SigmaxT.NodeIds
) )
options :: options ::
-- Layout -- Layout
{ showControls :: Boolean { showControls :: Boolean
, showDoc :: Maybe GET.GraphSideDoc , showDoc :: Maybe GET.GraphSideDoc
, showSidebar :: GT.SidePanelState , showSidebar :: GT.SidePanelState
, sideTab :: GET.SideTab , sideTab :: GET.SideTab
, expandSelection :: Boolean , expandSelection :: Boolean
, expandNeighborhood :: Boolean , expandNeighborhood :: Boolean
-- Controls -- Controls
, labelSize :: Number , labelSize :: Number
, mouseSelectorSize :: Number , labelRenderedSizeThreshold :: Number
, multiSelectEnabled :: Boolean , mouseSelectorSize :: Number
, edgeConfluence :: Range.NumberRange , multiSelectEnabled :: Boolean
, graphStage :: GET.Stage , edgeConfluence :: Range.NumberRange
, nodeSize :: Range.NumberRange , graphStage :: GET.Stage
, showLouvain :: Boolean , nodeSize :: Range.NumberRange
, showEdges :: SigmaxT.ShowEdgesState , showLouvain :: Boolean
, showEdges :: SigmaxT.ShowEdgesState
-- Terms update -- Terms update
, removedNodeIds :: SigmaxT.NodeIds , removedNodeIds :: SigmaxT.NodeIds
, selectedNodeIds :: SigmaxT.NodeIds , selectedNodeIds :: SigmaxT.NodeIds
} }
options = options =
-- Layout -- Layout
{ showControls : false { showControls : false
, sideTab : GET.SideTabLegend , sideTab : GET.SideTabLegend
, showSidebar : GT.InitialClosed , showSidebar : GT.InitialClosed
, showDoc : Nothing , showDoc : Nothing
, expandSelection : getter _.expandSelection GET.defaultCacheParams , expandSelection : getter _.expandSelection GET.defaultCacheParams
, expandNeighborhood : getter _.expandNeighborhood GET.defaultCacheParams , expandNeighborhood : getter _.expandNeighborhood GET.defaultCacheParams
-- Controls -- Controls
, multiSelectEnabled : false , multiSelectEnabled : false
, labelSize : 14.0 , labelSize : 14.0
, mouseSelectorSize : 15.0 , labelRenderedSizeThreshold : 6.0
, edgeConfluence : Range.Closed { min: 0.0, max: 1.0 } , mouseSelectorSize : 15.0
, graphStage : GET.Init , edgeConfluence : Range.Closed { min: 0.0, max: 1.0 }
, nodeSize : Range.Closed { min: 0.0, max: 100.0 } , graphStage : GET.Init
, showLouvain : false , nodeSize : Range.Closed { min: 0.0, max: 100.0 }
, showEdges : SigmaxT.EShow , showLouvain : false
, showEdges : SigmaxT.EShow
-- Terms update -- Terms update
, removedNodeIds : Set.empty , removedNodeIds : Set.empty
, selectedNodeIds : Set.empty , selectedNodeIds : Set.empty
} }
context :: R.Context (Record Store) context :: R.Context (Record Store)
......
...@@ -16,7 +16,7 @@ import Gargantext.Components.GraphExplorer.Resources as Graph ...@@ -16,7 +16,7 @@ import Gargantext.Components.GraphExplorer.Resources as Graph
import Gargantext.Components.GraphExplorer.Store as GraphStore import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Toolbar.Buttons (centerButton, cameraButton, edgesToggleButton, louvainToggleButton, pauseForceAtlasButton, multiSelectEnabledButton) 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.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.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
...@@ -56,6 +56,9 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -56,6 +56,9 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, graphId , graphId
, graphStage , graphStage
, hyperdataGraph , hyperdataGraph
, labelRenderedSizeThreshold
, labelSize
, mouseSelectorSize
, multiSelectEnabled , multiSelectEnabled
, nodeSize , nodeSize
, selectedNodeIds , selectedNodeIds
...@@ -63,8 +66,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -63,8 +66,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, showLouvain , showLouvain
, showSidebar , showSidebar
, sideTab , sideTab
, mouseSelectorSize
, labelSize
} <- GraphStore.use } <- GraphStore.use
forceAtlasState' <- R2.useLive' forceAtlasState forceAtlasState' <- R2.useLive' forceAtlasState
...@@ -262,6 +263,24 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -262,6 +263,24 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, state: nodeSize } , 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 ...@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer.Toolbar.SlideButton
( Props ( Props
, sizeButton , sizeButton
, labelSizeButton , labelSizeButton
, labelRenderedSizeThresholdButton
, mouseSelectorSizeButton , mouseSelectorSizeButton
) where ) where
...@@ -73,14 +74,35 @@ labelSizeButton sigmaRef state = ...@@ -73,14 +74,35 @@ labelSizeButton sigmaRef state =
Just newValue -> Just newValue ->
Sigmax.dependOnSigma sigma "[labelSizeButton] sigma: Nothing" $ \s -> do Sigmax.dependOnSigma sigma "[labelSizeButton] sigma: Nothing" $ \s -> do
Sigma.setSettings s { Sigma.setSettings s {
defaultLabelSize: newValue defaultLabelSize: newValue
, drawLabels: true , drawLabels: true
, labelSize: newValue
, maxNodeSize: newValue / 2.5 , maxNodeSize: newValue / 2.5
--, labelSizeRatio: newValue / 2.5 --, labelSizeRatio: newValue / 2.5
} }
T.write_ newValue state 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 :: R.Ref Sigmax.Sigma -> T.Box Number -> R.Element
mouseSelectorSizeButton sigmaRef state = mouseSelectorSizeButton sigmaRef state =
sizeButton { 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