From b9ce725561652b91cb9a41b1c7c81158c4747b77 Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Mon, 11 Apr 2016 15:11:03 +0200 Subject: [PATCH] Don't enlarge focused nodes. - Calculate size based on number of nodes that come up into the selection area. --- client/app/scripts/charts/node-container.js | 2 +- client/app/scripts/charts/node.js | 4 +++- client/app/scripts/charts/nodes-chart.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/app/scripts/charts/node-container.js b/client/app/scripts/charts/node-container.js index 2296731ae..75506b290 100644 --- a/client/app/scripts/charts/node-container.js +++ b/client/app/scripts/charts/node-container.js @@ -11,7 +11,7 @@ export default class NodeContainer extends React.Component { render() { const { dx, dy, focused, layoutPrecision, zoomScale } = this.props; const animConfig = [80, 20]; // stiffness, damping - const scaleFactor = focused ? (2 / zoomScale) : 1; + const scaleFactor = focused ? (1 / zoomScale) : 1; const other = _.omit(this.props, 'dx', 'dy'); return ( diff --git a/client/app/scripts/charts/node.js b/client/app/scripts/charts/node.js index ceeb8e899..8c6235806 100644 --- a/client/app/scripts/charts/node.js +++ b/client/app/scripts/charts/node.js @@ -55,9 +55,11 @@ export default class Node extends React.Component { } render() { - const { blurred, focused, highlighted, label, nodeScale, pseudo, rank, + const { blurred, focused, highlighted, label, pseudo, rank, subLabel, scaleFactor, transform, zoomScale } = this.props; + const nodeScale = focused ? this.props.selectedNodeScale : this.props.nodeScale; + const color = getNodeColor(rank, label, pseudo); const labelText = ellipsis(label, 14, nodeScale(4 * scaleFactor)); const subLabelText = ellipsis(subLabel, 12, nodeScale(4 * scaleFactor)); diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js index d6123a582..5316339ae 100644 --- a/client/app/scripts/charts/nodes-chart.js +++ b/client/app/scripts/charts/nodes-chart.js @@ -270,7 +270,7 @@ export default class NodesChart extends React.Component { }); // auto-scale node size for selected nodes - const selectedNodeScale = this.getNodeScale(props); + const selectedNodeScale = this.getNodeScale(Object.assign({}, props, {nodes: adjacentNodes})); return { selectedNodeScale,