From 11576a18ad0204147cb6f56039a4723f53eea2bf Mon Sep 17 00:00:00 2001 From: Ian Fitzpatrick Date: Fri, 3 Jun 2016 17:46:54 -0700 Subject: [PATCH] Animate hotkey for fitting the window to graph --- the-graph/the-graph-app.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/the-graph/the-graph-app.js b/the-graph/the-graph-app.js index 857571ac..7c32db4a 100644 --- a/the-graph/the-graph-app.js +++ b/the-graph/the-graph-app.js @@ -256,14 +256,23 @@ tooltipVisible: false }); }, + getFit: function () { + return TheGraph.findFit(this.props.graph, this.props.width, this.props.height); + }, triggerFit: function (event) { - var fit = TheGraph.findFit(this.props.graph, this.props.width, this.props.height); + var fit = this.getFit(); this.setState({ x: fit.x, y: fit.y, scale: fit.scale }); }, + triggerFitAnimated: function () { + var duration = TheGraph.config.focusAnimationDuration; + var fit = this.getFit(); + + this.animate(fit, duration, 'out-quint', function() {}); + }, focusNode: function (node) { var duration = TheGraph.config.focusAnimationDuration; var fit = TheGraph.findNodeFit(node, this.state.width, this.state.height); @@ -423,7 +432,7 @@ }.bind(this), // f for fit 70: function () { - this.triggerFit(); + this.triggerFitAnimated(); }.bind(this), // s for selected 83: function () {