From c5ea9706748efc0ebdfd2d3791c1854506854efa Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Mon, 11 Apr 2016 11:59:04 +0200 Subject: [PATCH] Dont trunctate node labels on hover * makes it easier to read long node labels on demand --- client/app/scripts/charts/node.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/app/scripts/charts/node.js b/client/app/scripts/charts/node.js index ceeb8e899..05fef8e9d 100644 --- a/client/app/scripts/charts/node.js +++ b/client/app/scripts/charts/node.js @@ -27,7 +27,7 @@ const nodeShapes = { cloud: NodeShapeCloud }; -function getNodeShape({shape, stack}) { +function getNodeShape({ shape, stack }) { const nodeShape = nodeShapes[shape]; if (!nodeShape) { throw new Error(`Unknown shape: ${shape}!`); @@ -59,8 +59,9 @@ export default class Node extends React.Component { subLabel, scaleFactor, transform, zoomScale } = this.props; const color = getNodeColor(rank, label, pseudo); - const labelText = ellipsis(label, 14, nodeScale(4 * scaleFactor)); - const subLabelText = ellipsis(subLabel, 12, nodeScale(4 * scaleFactor)); + const truncate = !focused && !highlighted; + const labelText = truncate ? ellipsis(label, 14, nodeScale(4 * scaleFactor)) : label; + const subLabelText = truncate ? ellipsis(subLabel, 12, nodeScale(4 * scaleFactor)) : subLabel; let labelOffsetY = 18; let subLabelOffsetY = 35;