Commit 9b1ef410 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski Committed by Alexandre Delanoë

[graph] some settings refactorings, label size threshold at 2

parent 757a3597
...@@ -207,26 +207,26 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where ...@@ -207,26 +207,26 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
type SigmaSettings = type SigmaSettings =
( animationsTime :: Number ( --animationsTime :: Number
, autoRescale :: Boolean --, autoRescale :: Boolean
, autoResize :: Boolean --, autoResize :: Boolean
, batchEdgesDrawing :: Boolean --, batchEdgesDrawing :: Boolean
, borderSize :: Number --, borderSize :: Number
-- , canvasEdgesBatchSize :: Number -- , canvasEdgesBatchSize :: Number
-- , clone :: Boolean -- , clone :: Boolean
-- , defaultEdgeColor :: String -- , defaultEdgeColor :: String
, defaultEdgeHoverColor :: String --, defaultEdgeHoverColor :: String
, defaultEdgeType :: String defaultEdgeType :: String
, defaultHoverLabelBGColor :: String --, defaultHoverLabelBGColor :: String
, defaultHoverLabelColor :: String --, defaultHoverLabelColor :: String
, defaultLabelColor :: String --, defaultLabelColor :: String
-- , defaultLabelHoverColor :: String -- , defaultLabelHoverColor :: String
, defaultLabelSize :: Number , defaultLabelSize :: Number
, defaultNodeBorderColor :: String --, defaultNodeBorderColor :: String
, defaultNodeColor :: String , defaultNodeColor :: String
-- , defaultNodeHoverColor :: String -- , defaultNodeHoverColor :: String
-- , defaultNodeType :: String -- , defaultNodeType :: String
, doubleClickEnabled :: Boolean --, doubleClickEnabled :: Boolean
-- , doubleClickTimeout :: Number -- , doubleClickTimeout :: Number
-- , doubleClickZoomDuration :: Number -- , doubleClickZoomDuration :: Number
-- , doubleClickZoomingRatio :: Number -- , doubleClickZoomingRatio :: Number
...@@ -234,20 +234,20 @@ type SigmaSettings = ...@@ -234,20 +234,20 @@ type SigmaSettings =
-- , dragTimeout :: Number -- , dragTimeout :: Number
-- , drawEdgeLabels :: Boolean -- , drawEdgeLabels :: Boolean
-- , drawEdges :: Boolean -- , drawEdges :: Boolean
, drawLabels :: Boolean -- , drawLabels :: Boolean
, drawNodes :: Boolean -- , drawNodes :: Boolean
-- , edgeColor :: String -- , edgeColor :: String
, edgeHoverColor :: String -- , edgeHoverColor :: String
, edgeHoverExtremities :: Boolean -- , edgeHoverExtremities :: Boolean
, edgeHoverPrecision :: Number -- , edgeHoverPrecision :: Number
, edgeHoverSizeRatio :: Number -- , edgeHoverSizeRatio :: Number
-- , edgesPowRatio :: Number -- , edgesPowRatio :: Number
-- , enableCamera :: Boolean -- , enableCamera :: Boolean
, enableEdgeHovering :: Boolean , enableEdgeHoverEvents :: Boolean
, enableHovering :: Boolean -- , enableHovering :: Boolean
-- , eventsEnabled :: Boolean -- , eventsEnabled :: Boolean
, font :: String -- , font :: String
, fontStyle :: String -- , fontStyle :: String
, hideEdgesOnMove :: Boolean , hideEdgesOnMove :: Boolean
-- , hoverFont :: String -- , hoverFont :: String
-- , hoverFontStyle :: String -- , hoverFontStyle :: String
...@@ -257,117 +257,120 @@ type SigmaSettings = ...@@ -257,117 +257,120 @@ type SigmaSettings =
-- , labelHoverColor :: String -- , labelHoverColor :: String
-- , labelHoverShadow :: String -- , labelHoverShadow :: String
-- , labelHoverShadowColor :: String -- , labelHoverShadowColor :: String
, labelSize :: String -- , labelSize :: String
, labelSizeRatio :: Number -- , labelSizeRatio :: Number
, labelThreshold :: Number , labelRenderedSizeThreshold :: Number
, maxEdgeSize :: Number --, labelThreshold :: Number
, maxNodeSize :: Number -- , maxEdgeSize :: Number
-- , maxNodeSize :: Number
-- , minArrowSize :: Number -- , minArrowSize :: Number
, minEdgeSize :: Number -- , minEdgeSize :: Number
, minNodeSize :: Number -- , minNodeSize :: Number
, mouseEnabled :: Boolean -- , mouseEnabled :: Boolean
-- , mouseInertiaDuration :: Number -- , mouseInertiaDuration :: Number
-- , mouseInertiaRatio :: Number -- , mouseInertiaRatio :: Number
, mouseSelectorSize :: Number -- , mouseSelectorSize :: Number
-- , mouseWheelEnabled :: Boolean -- , mouseWheelEnabled :: Boolean
, mouseZoomDuration :: Number -- , mouseZoomDuration :: Number
, nodeBorderColor :: String -- , nodeBorderColor :: String
-- , nodeHoverColor :: String -- , nodeHoverColor :: String
--, nodesPowRatio :: Number --, nodesPowRatio :: Number
, rescaleIgnoreSize :: Boolean -- , rescaleIgnoreSize :: Boolean
-- , scalingMode :: String -- , scalingMode :: String
-- , sideMargin :: Number -- , sideMargin :: Number
, singleHover :: Boolean -- , singleHover :: Boolean
-- , skipErrors :: Boolean -- , skipErrors :: Boolean
, touchEnabled :: Boolean -- , touchEnabled :: Boolean
-- , touchInertiaDuration :: Number -- , touchInertiaDuration :: Number
-- , touchInertiaRatio :: Number -- , touchInertiaRatio :: Number
, twBorderGreyColor :: String -- , twBorderGreyColor :: String
, twEdgeDefaultOpacity :: Number -- , twEdgeDefaultOpacity :: Number
, twEdgeGreyColor :: String -- , twEdgeGreyColor :: String
, twNodeRendBorderColor :: String -- , twNodeRendBorderColor :: String
, twNodeRendBorderSize :: Number -- , twNodeRendBorderSize :: Number
, twNodesGreyOpacity :: Number -- , twNodesGreyOpacity :: Number
, twSelectedColor :: String -- , twSelectedColor :: String
, verbose :: Boolean -- , verbose :: Boolean
-- , webglEdgesBatchSize :: Number -- , webglEdgesBatchSize :: Number
-- , webglOversamplingRatio :: Number -- , webglOversamplingRatio :: Number
, zoomMax :: Number -- , zoomMax :: Number
, zoomMin :: Number -- , zoomMin :: Number
, zoomingRatio :: Number -- , zoomingRatio :: Number
) )
-- not selected <=> (1-greyness) -- not selected <=> (1-greyness)
-- selected nodes <=> special label -- selected nodes <=> special label
sigmaSettings :: Themes.Theme -> {|SigmaSettings} sigmaSettings :: Themes.Theme -> {|SigmaSettings}
sigmaSettings theme = sigmaSettings theme =
{ animationsTime : 30000.0 { -- animationsTime : 30000.0
, autoRescale : true -- , autoRescale : true
, autoResize : true --, autoResize : true
, batchEdgesDrawing : true --, batchEdgesDrawing : true
, borderSize : 1.0 -- for ex, bigger border when hover --, borderSize : 1.0 -- for ex, bigger border when hover
, defaultEdgeHoverColor : "#f00" --, defaultEdgeHoverColor : "#f00"
, defaultEdgeType : "curve" -- 'curve' or 'line' (curve iff ourRendering) defaultEdgeType : "line" -- 'curve' or 'line' (curve iff ourRendering)
-- , defaultHoverLabelBGColor : "#fff" -- , defaultHoverLabelBGColor : "#fff"
-- , defaultHoverLabelColor : "#000" -- , defaultHoverLabelColor : "#000"
-- , defaultLabelColor : "#000" -- labels text color -- , defaultLabelColor : "#000" -- labels text color
, defaultLabelSize : 15.0 -- (old tina: showLabelsIfZoom) , defaultLabelSize : 15.0 -- (old tina: showLabelsIfZoom)
, defaultNodeBorderColor : "#000" -- <- if nodeBorderColor = 'default' --, defaultNodeBorderColor : "#000" -- <- if nodeBorderColor = 'default'
, defaultNodeColor : "#FFF" , defaultNodeColor : "#FFF"
, doubleClickEnabled : false -- indicates whether or not the graph can be zoomed on double-click --, doubleClickEnabled : false -- indicates whether or not the graph can be zoomed on double-click
-- , drawEdgeLabels : true -- , drawEdgeLabels : true
-- , drawEdges : true -- , drawEdges : true
, drawLabels : true --, drawLabels : true
, drawNodes : true --, drawNodes : true
, enableEdgeHovering : false -- , edgeHoverExtremities : true
, edgeHoverExtremities : true -- , edgeHoverColor : "edge"
, edgeHoverColor : "edge" -- , edgeHoverPrecision : 2.0
, edgeHoverPrecision : 2.0 -- , edgeHoverSizeRatio : 2.0
, edgeHoverSizeRatio : 2.0 , enableEdgeHoverEvents : false
, enableHovering : true -- , enableHovering : true
, font : "arial" -- , font : "arial"
, fontStyle : "" -- , fontStyle : ""
, hideEdgesOnMove : true , hideEdgesOnMove : true
, labelSize : "proportional" -- alt : proportional, fixed -- , labelSize : "proportional" -- alt : proportional, fixed
-- , labelSize : "fixed" -- , labelSize : "fixed"
, labelSizeRatio : 2.0 -- label size in ratio of node size -- , labelSizeRatio : 2.0 -- label size in ratio of node size
, labelThreshold : 9.0 -- 5.0 for more labels -- min node cam size to start showing label , labelRenderedSizeThreshold: 2.0
, maxEdgeSize : 1.0 --, labelThreshold : 5.0 -- 5.0 for more labels -- min node cam size to start showing label
, maxNodeSize : 10.0 -- , maxEdgeSize : 1.0
, minEdgeSize : 0.5 -- in fact used in tina as edge size -- , maxNodeSize : 10.0
, minNodeSize : 1.0 -- , minEdgeSize : 0.5 -- in fact used in tina as edge size
, mouseEnabled : true -- , minNodeSize : 1.0
, mouseSelectorSize : 15.0 -- , mouseEnabled : true
, mouseZoomDuration : 150.0 -- , mouseSelectorSize : 15.0
, nodeBorderColor : "default" -- choices: "default" color vs. "node" color -- , mouseZoomDuration : 150.0
-- , nodeBorderColor : "default" -- choices: "default" color vs. "node" color
--, nodesPowRatio : 10.8 --, nodesPowRatio : 10.8
, rescaleIgnoreSize : false -- , rescaleIgnoreSize : false
, singleHover : true -- , singleHover : true
, touchEnabled : true -- , touchEnabled : true
, twBorderGreyColor : "rgba(100, 100, 100, 0.9)" -- , twBorderGreyColor : "rgba(100, 100, 100, 0.9)"
, twEdgeDefaultOpacity : 0.4 -- initial opacity added to src/tgt colors -- , twEdgeDefaultOpacity : 0.4 -- initial opacity added to src/tgt colors
, twEdgeGreyColor : "rgba(100, 100, 100, 0.25)" -- , twEdgeGreyColor : "rgba(100, 100, 100, 0.25)"
, twNodeRendBorderColor : "#FFF" -- , twNodeRendBorderColor : "#FFF"
, twNodeRendBorderSize : 2.5 -- node borders (only iff ourRendering) -- , twNodeRendBorderSize : 2.5 -- node borders (only iff ourRendering)
, twNodesGreyOpacity : 5.5 -- smaller value: more grey -- , twNodesGreyOpacity : 5.5 -- smaller value: more grey
, twSelectedColor : "node" -- "node" for a label bg like the node color, "default" for white background -- , twSelectedColor : "node" -- "node" for a label bg like the node color, "default" for white background
, verbose : true -- , verbose : true
, zoomMax : 1.7 -- , zoomMax : 1.7
, zoomMin : 0.0 -- , zoomMin : 0.0
, zoomingRatio : 1.4 -- , zoomingRatio : 1.4
} `merge` themeSettings theme }
where -- `merge` themeSettings theme
themeSettings t -- where
| eq t darksterTheme = -- themeSettings t
{ defaultHoverLabelBGColor: "#FFF" -- | eq t darksterTheme =
, defaultHoverLabelColor : "#000" -- { defaultHoverLabelBGColor: "#FFF"
, defaultLabelColor: "#FFF" -- , defaultHoverLabelColor : "#000"
} -- , defaultLabelColor: "#FFF"
| otherwise = -- }
{ defaultHoverLabelBGColor: "#FFF" -- | otherwise =
, defaultHoverLabelColor : "#000" -- { defaultHoverLabelBGColor: "#FFF"
, defaultLabelColor: "#000" -- , defaultHoverLabelColor : "#000"
} -- , defaultLabelColor: "#000"
-- }
type ForceAtlas2Settings = type ForceAtlas2Settings =
( adjustSizes :: Boolean ( adjustSizes :: Boolean
......
...@@ -121,7 +121,7 @@ options = ...@@ -121,7 +121,7 @@ options =
-- Controls -- Controls
, multiSelectEnabled : false , multiSelectEnabled : false
, labelSize : 14.0 , labelSize : 14.0
, labelRenderedSizeThreshold : 6.0 , labelRenderedSizeThreshold : 2.0
, mouseSelectorSize : 15.0 , mouseSelectorSize : 15.0
, edgeConfluence : Range.Closed { min: 0.0, max: 1.0 } , edgeConfluence : Range.Closed { min: 0.0, max: 1.0 }
, graphStage : GET.Init , graphStage : GET.Init
......
...@@ -163,11 +163,13 @@ let sigmaMouseSelector = function(sigma, options) { ...@@ -163,11 +163,13 @@ let sigmaMouseSelector = function(sigma, options) {
function _sigma(left, right, el, opts) { function _sigma(left, right, el, opts) {
try { try {
let graph = new Graph(); let graph = new Graph();
let s = new sigma(graph, el, opts); let s = new sigma(graph, el, opts.settigns);
console.log('initializing sigma with el', el, 'opts', 'sigma', s); console.log('[_sigma] initializing sigma with el', el, 'opts', opts, 'sigma', s);
console.log('[_sigma] labelRenderedSizeThreshold', opts.settings.labelRenderedSizeThreshold);
sigmaMouseSelector(s); sigmaMouseSelector(s);
return right(s); return right(s);
} catch(e) { } catch(e) {
console.log('[_sigma] error', e);
return left(e); return left(e);
} }
} }
......
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