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