diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-17 16:09:53 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-17 16:09:53 +0200 |
commit | 439d241023114e7f156887d3d9ee783f24a3979b (patch) | |
tree | 95a387ba280e5db9565c9098a652d06ce7333543 /app/components/graph | |
parent | 3a9620e8d13dc3d8e576cf4430080bc6ebc1199a (diff) |
added perma labels
Diffstat (limited to 'app/components/graph')
-rw-r--r-- | app/components/graph/graph.tsx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/components/graph/graph.tsx b/app/components/graph/graph.tsx index efda7f7..bf5aff7 100644 --- a/app/components/graph/graph.tsx +++ b/app/components/graph/graph.tsx @@ -201,7 +201,7 @@ export const Graph = observer(function Graph(props: GraphProps): JSX.Element { nodeCanvasObject={(node, ctx, globalScale) => { if(physics.labels){ if(globalScale > physics.labelScale ) { - const label = node.title; + const label = node.title.substring(0, Math.min(node.title.length, 30)); const fontSize = 12/globalScale; ctx.font = `${fontSize}px Sans-Serif`; const textWidth = ctx.measureText(label).width; @@ -212,11 +212,10 @@ export const Graph = observer(function Graph(props: GraphProps): JSX.Element { ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; - ctx.fillStyle = node.color; + ctx.fillStyle = "#ffffff"; //node.color; ctx.fillText(label, node.x, node.y); node.__bckgDimensions = bckgDimensions; // to re-use in nodePointerAreaPaint - console.log(globalScale); } } }} |