Dont trunctate node labels on hover

* makes it easier to read long node labels on demand
This commit is contained in:
David Kaltschmidt
2016-04-11 11:59:04 +02:00
parent eb7590944d
commit c5ea970674

View File

@@ -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;