Commit 9b63f39a authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-refact' into dev

parents 8c872d4b badd1fa8
...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree where ...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree where
import DOM.Simple.Console (log, log2) import DOM.Simple.Console (log, log2)
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe) import Data.Maybe (Maybe(..))
import Data.Set as Set import Data.Set as Set
import Data.Tuple (Tuple(..), fst, snd) import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
...@@ -12,7 +12,6 @@ import Gargantext.AsyncTasks as GAT ...@@ -12,7 +12,6 @@ import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node (nodeMainSpan) import Gargantext.Components.Forest.Tree.Node (nodeMainSpan)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode) import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
import Gargantext.Components.Forest.Tree.Node.Action.CopyFrom (getNodeTree)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (deleteNode) import Gargantext.Components.Forest.Tree.Node.Action.Delete (deleteNode)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), rename) import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), rename)
import Gargantext.Components.Forest.Tree.Node.Action.Share (ShareValue(..), share) import Gargantext.Components.Forest.Tree.Node.Action.Share (ShareValue(..), share)
...@@ -24,8 +23,10 @@ import Gargantext.Ends (Frontends) ...@@ -24,8 +23,10 @@ import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>)) import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>))
import Gargantext.Routes (AppRoute) import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (OpenNodes, Session, mkNodeId) import Gargantext.Sessions (OpenNodes, Session, mkNodeId, get)
import Gargantext.Types (ID, Reload) import Gargantext.Types (ID, Reload)
import Gargantext.Types as GT
import Gargantext.Routes as GR
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record as Record import Record as Record
...@@ -95,6 +96,13 @@ treeLoadView p = R.createElement treeLoadViewCpt p [] ...@@ -95,6 +96,13 @@ treeLoadView p = R.createElement treeLoadViewCpt p []
} }
useLoader { root, counter: fst reload } fetch paint useLoader { root, counter: fst reload } fetch paint
--------------
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
--------------
type TreeViewProps = ( asyncTasks :: R.State GAT.Storage type TreeViewProps = ( asyncTasks :: R.State GAT.Storage
, tree :: FTree , tree :: FTree
, tasks :: Record Tasks , tasks :: Record Tasks
......
...@@ -19,7 +19,6 @@ type UpdateNodeProps = ...@@ -19,7 +19,6 @@ type UpdateNodeProps =
) )
-} -}
data Action = AddNode String GT.NodeType data Action = AddNode String GT.NodeType
| DeleteNode | DeleteNode
| RenameNode String | RenameNode String
...@@ -30,7 +29,6 @@ data Action = AddNode String GT.NodeType ...@@ -30,7 +29,6 @@ data Action = AddNode String GT.NodeType
| DownloadNode | DownloadNode
| RefreshTree | RefreshTree
instance showShow :: Show Action where instance showShow :: Show Action where
show (AddNode _ _ )= "AddNode" show (AddNode _ _ )= "AddNode"
show DeleteNode = "DeleteNode" show DeleteNode = "DeleteNode"
......
...@@ -8,7 +8,6 @@ import Effect.Aff (Aff) ...@@ -8,7 +8,6 @@ import Effect.Aff (Aff)
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action (Action) import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.CopyFrom (copyFromCorpusView)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete) import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete)
import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc) import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload) import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload)
...@@ -19,8 +18,9 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share ...@@ -19,8 +18,9 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Update (update) import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload) import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS) import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox, SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView)
import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<)) import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<))
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID) import Gargantext.Types (Name, ID)
...@@ -238,12 +238,16 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -238,12 +238,16 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
cpt {action: Config , dispatch, id, nodeType, session} _ = do cpt {action: Config , dispatch, id, nodeType, session} _ = do
pure $ fragmentPT $ "Config " <> show nodeType pure $ fragmentPT $ "Config " <> show nodeType
cpt {action: CopyFromCorpus, dispatch, id, nodeType, session} _ = do -----------
pure $ copyFromCorpusView {dispatch, id, nodeType, session} cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
cpt {action: Link _} _ = pure $ fragmentPT $ "Soon, you will be able " cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
<> "to link the corpus with your Annuaire" pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
<> " (and reciprocally)."
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
-----------
cpt {action : Share, dispatch, id, name } _ = do cpt {action : Share, dispatch, id, name } _ = do
isOpen <- R.useState' true isOpen <- R.useState' true
......
module Gargantext.Components.Forest.Tree.Node.Settings where module Gargantext.Components.Forest.Tree.Node.Settings where
import Prelude (class Eq, class Show, show, (&&), (<>), (==)) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Eq (genericEq)
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Data.Array (foldl) import Data.Array (foldl)
import Gargantext.Types import Gargantext.Types
...@@ -12,16 +15,32 @@ if user has access to node then he can do all his related actions ...@@ -12,16 +15,32 @@ if user has access to node then he can do all his related actions
-} -}
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
data Status a = IsBeta a | IsProd a -- Beta Status
data Status a = TODO a | WIP a | OnTest a | Beta a
data NodeAction = Documentation NodeType data NodeAction = Documentation NodeType
| SearchBox | SearchBox
| Download | Upload | Refresh | Config | Download | Upload | Refresh | Config
| Move | Clone | Delete | Delete
| Share | Link NodeType | Share
| Add (Array NodeType) | Add (Array NodeType)
| CopyFromCorpus | Merge { subTreeParams :: SubTreeParams }
| Move { subTreeParams :: SubTreeParams }
| Link { subTreeParams :: SubTreeParams }
| Clone
------------------------------------------------------------------------
-- TODO move elsewhere
data SubTreeParams = SubTreeParams { showtypes :: Array NodeType
, valitypes :: Array NodeType
}
derive instance eqSubTreeParams :: Eq SubTreeParams
derive instance genericSubTreeParams :: Generic SubTreeParams _
instance showSubTreeParams :: Show SubTreeParams where
show = genericShow
------------------------------------------------------------------------
instance eqNodeAction :: Eq NodeAction where instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y) eq (Documentation x) (Documentation y) = true && (x == y)
...@@ -29,13 +48,13 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -29,13 +48,13 @@ instance eqNodeAction :: Eq NodeAction where
eq Download Download = true eq Download Download = true
eq Upload Upload = true eq Upload Upload = true
eq Refresh Refresh = true eq Refresh Refresh = true
eq Move Move = true eq (Move x) (Move y) = x == y
eq Clone Clone = true eq Clone Clone = true
eq Delete Delete = true eq Delete Delete = true
eq Share Share = true eq Share Share = true
eq (Link x) (Link y) = (x == y) eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = (x == y) eq (Add x) (Add y) = x == y
eq CopyFromCorpus CopyFromCorpus = true eq (Merge x) (Merge y) = x == y
eq Config Config = true eq Config Config = true
eq _ _ = false eq _ _ = false
...@@ -45,14 +64,14 @@ instance showNodeAction :: Show NodeAction where ...@@ -45,14 +64,14 @@ instance showNodeAction :: Show NodeAction where
show Download = "Download" show Download = "Download"
show Upload = "Upload" show Upload = "Upload"
show Refresh = "Refresh" show Refresh = "Refresh"
show Move = "Move" show (Move t) = "Move with subtree params" <> show t
show Clone = "Clone" show Clone = "Clone"
show Delete = "Delete" show Delete = "Delete"
show Share = "Share" show Share = "Share"
show Config = "Config" show Config = "Config"
show (Link x) = "Link to " <> show x show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show CopyFromCorpus = "Copy from corpus" show (Merge t) = "Merge with subtree" <> show t
glyphiconNodeAction :: NodeAction -> String glyphiconNodeAction :: NodeAction -> String
...@@ -63,11 +82,11 @@ glyphiconNodeAction SearchBox = "search" ...@@ -63,11 +82,11 @@ glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload" glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "arrows-h" glyphiconNodeAction (Link _) = "arrows-h"
glyphiconNodeAction Download = "download" glyphiconNodeAction Download = "download"
glyphiconNodeAction CopyFromCorpus = "random" glyphiconNodeAction (Merge _) = "random"
glyphiconNodeAction Refresh = "refresh" glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench" glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Share = "user-plus" glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction Move = "share-square-o" glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction _ = "" glyphiconNodeAction _ = ""
...@@ -138,7 +157,7 @@ settingsBox Folder = ...@@ -138,7 +157,7 @@ settingsBox Folder =
, Folder , Folder
, Annuaire , Annuaire
] ]
, Move , Move moveParameters
, Delete , Delete
] ]
} }
...@@ -154,9 +173,9 @@ settingsBox Corpus = ...@@ -154,9 +173,9 @@ settingsBox Corpus =
, SearchBox , SearchBox
, Upload , Upload
, Download , Download
, Move , Move moveParameters
--, Clone --, Clone
, Link Annuaire , Link linkParams
, Delete , Delete
] ]
} }
...@@ -191,7 +210,17 @@ settingsBox NodeList = ...@@ -191,7 +210,17 @@ settingsBox NodeList =
, Config , Config
, Download , Download
, Upload , Upload
, CopyFromCorpus , Merge {subTreeParams : SubTreeParams { showtypes: [ FolderPrivate
, FolderShared
, Team
, FolderPublic
, Folder
, Corpus
, NodeList
]
, valitypes: [ NodeList ]
}
}
, Delete , Delete
] ]
} }
...@@ -207,10 +236,10 @@ settingsBox Dashboard = ...@@ -207,10 +236,10 @@ settingsBox Dashboard =
settingsBox Annuaire = settingsBox Annuaire =
SettingsBox { show : true SettingsBox { show : true
, edit : false , edit : true
, doc : Documentation Annuaire , doc : Documentation Annuaire
, buttons : [ Upload , buttons : [ Upload
, Move , Move moveParameters
, Delete , Delete
] ]
} }
...@@ -221,3 +250,35 @@ settingsBox _ = ...@@ -221,3 +250,35 @@ settingsBox _ =
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [] , buttons : []
} }
-- | SubTree Parameters
moveParameters = { subTreeParams : SubTreeParams
{ showtypes: [ FolderPrivate
, FolderShared
, Team
, FolderPublic
, Folder
]
, valitypes: [ FolderPrivate
, FolderShared
, Team
, FolderPublic
, Folder
]
}
}
linkParams = { subTreeParams : SubTreeParams
{ showtypes: [ FolderPrivate
, FolderShared
, Team
, FolderPublic
, Folder
, Annuaire
]
, valitypes: [ Annuaire
]
}
}
module Gargantext.Components.Forest.Tree.Node.Action.CopyFrom where module Gargantext.Components.Forest.Tree.Node.Tools.SubTree where
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Props) import Gargantext.Components.Forest.Tree.Node.Action (Props)
import Gargantext.Components.Forest.Tree.Node.Settings (SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..)) import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (discard, map, pure, show, unit, ($), (&&), (/=), (<>)) import Gargantext.Prelude (discard, map, pure, show, unit, ($), (&&), (/=), (<>), class Eq)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get) import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT import Gargantext.Types as GT
...@@ -16,56 +19,71 @@ import Reactix.DOM.HTML as H ...@@ -16,56 +19,71 @@ import Reactix.DOM.HTML as H
------------------------------------------------------------------------ ------------------------------------------------------------------------
getNodeTree :: Session -> GT.ID -> Aff FTree type SubTreeParamsProps =
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) "" ( subTreeParams :: SubTreeParams
| Props
)
copyFromCorpusView :: Record Props -> R.Element subTreeView :: Record SubTreeParamsProps -> R.Element
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props [] subTreeView props = R.createElement subTreeViewCpt props []
copyFromCorpusViewCpt :: R.Component Props subTreeViewCpt :: R.Component SubTreeParamsProps
copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt subTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeView" cpt
where where
cpt { dispatch cpt params@{ dispatch
, id , id
, nodeType , nodeType
, session , session
, subTreeParams
} _ = } _ =
do do
useLoader session loadCorporaTree $ let SubTreeParams {showtypes} = subTreeParams
useLoader session (loadSubTree showtypes) $
\tree -> \tree ->
copyFromCorpusViewLoaded { dispatch subTreeViewLoaded { dispatch
, id , id
, nodeType , nodeType
, session , session
, tree , tree
, subTreeParams
} }
------------------------------------------------------------------------ loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
where
Session { treeId } = session
getSubTree :: Session -> Int -> Array GT.NodeType -> Aff FTree
getSubTree session treeId showtypes = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
------------------------------------------------------------------------
type CorpusTreeProps = type CorpusTreeProps =
( tree :: FTree ( tree :: FTree
| Props | SubTreeParamsProps
) )
copyFromCorpusViewLoaded :: Record CorpusTreeProps -> R.Element subTreeViewLoaded :: Record CorpusTreeProps -> R.Element
copyFromCorpusViewLoaded props = R.createElement copyFromCorpusViewLoadedCpt props [] subTreeViewLoaded props = R.createElement subTreeViewLoadedCpt props []
copyFromCorpusViewLoadedCpt :: R.Component CorpusTreeProps subTreeViewLoadedCpt :: R.Component CorpusTreeProps
copyFromCorpusViewLoadedCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusViewLoadedCpt" cpt subTreeViewLoadedCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeViewLoadedCpt" cpt
where where
cpt p@{dispatch, id, nodeType, session, tree} _ = do cpt p@{dispatch, id, nodeType, session, tree} _ = do
pure $ H.div { className: "copy-from-corpus" } pure $ H.div { className: "copy-from-corpus" }
[ H.div { className: "tree" } [ H.div { className: "tree" }
[copyFromCorpusTreeView p] [subTreeTreeView p]
] ]
copyFromCorpusTreeView :: Record CorpusTreeProps -> R.Element subTreeTreeView :: Record CorpusTreeProps -> R.Element
copyFromCorpusTreeView props = R.createElement copyFromCorpusTreeViewCpt props [] subTreeTreeView props = R.createElement subTreeTreeViewCpt props []
copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps subTreeTreeViewCpt :: R.Component CorpusTreeProps
copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt subTreeTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeTreeViewCpt" cpt
where where
cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary} _ = do cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary, subTreeParams} _ = do
pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} [] pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} []
, -} H.div { className: "node" } , -} H.div { className: "node" }
( [ H.span { className: "name " <> clickable ( [ H.span { className: "name " <> clickable
...@@ -76,29 +94,20 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi ...@@ -76,29 +94,20 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
) )
-- ] -- ]
where where
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType [GT.NodeList]) && (id /= sourceId) SubTreeParams { valitypes } = subTreeParams
children = map (\c -> subTreeTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType valitypes) && (id /= sourceId)
clickable = if validNodeType then "clickable" else "" clickable = if validNodeType then "clickable" else ""
onClick _ = case validNodeType of onClick _ = case validNodeType of
false -> pure unit false -> pure unit
true -> do true -> do
log2 "[copyFromCorpusTreeViewCpt] issue copy into" id log2 "[subTreeTreeViewCpt] issue copy into" id
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId log2 "[subTreeTreeViewCpt] issue copy from" sourceId
loadCorporaTree :: Session -> Aff FTree --------------------------------------------------------------------------------------------
loadCorporaTree session = getCorporaTree session treeId
where
Session { treeId } = session
getCorporaTree :: Session -> Int -> Aff FTree
getCorporaTree session treeId = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" typesList
typesList = [ GT.FolderPrivate
, GT.FolderShared
, GT.Team
, GT.FolderPublic
, GT.Folder
, GT.Corpus
, GT.NodeList
]
...@@ -231,7 +231,8 @@ sigmaSettings = ...@@ -231,7 +231,8 @@ sigmaSettings =
, font: "arial" -- font params , font: "arial" -- font params
, fontStyle: "bold" , fontStyle: "bold"
, hideEdgesOnMove: true , hideEdgesOnMove: true
, labelSize : "proportional" -- alt : proportional --, labelSize : "proportional" -- alt : proportional, fixed
, labelSize: "fixed"
, labelSizeRatio: 2.0 -- label size in ratio of node size , labelSizeRatio: 2.0 -- label size in ratio of node size
, labelThreshold: 7.0 -- min node cam size to start showing label , labelThreshold: 7.0 -- min node cam size to start showing label
, maxEdgeSize: 1.0 , maxEdgeSize: 1.0
......
...@@ -58,6 +58,8 @@ labelSizeButton sigmaRef state = ...@@ -58,6 +58,8 @@ labelSizeButton sigmaRef state =
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
, labelSizeRatio: newValue / 2.5
} }
setValue $ const newValue setValue $ const newValue
} }
......
...@@ -42,6 +42,7 @@ sigma.canvas.nodes.selected = (node, context, settings) => { ...@@ -42,6 +42,7 @@ sigma.canvas.nodes.selected = (node, context, settings) => {
node.type = 'def'; node.type = 'def';
sigma.canvas.hovers.def(node, context, settings); sigma.canvas.hovers.def(node, context, settings);
node.type = 'selected'; node.type = 'selected';
console.log('hovers, settings:', settings);
}; };
CustomShapes.init(); CustomShapes.init();
......
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