Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions the-graph/the-graph-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -423,7 +432,7 @@
}.bind(this),
// f for fit
70: function () {
this.triggerFit();
this.triggerFitAnimated();
}.bind(this),
// s for selected
83: function () {
Expand Down