Skip to content

Commit

Permalink
move focusAnimationDuration to TheGraph.config flowhub#169
Browse files Browse the repository at this point in the history
  • Loading branch information
forresto committed Sep 15, 2014
1 parent 5c27647 commit beb09f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
15 changes: 4 additions & 11 deletions the-graph/the-graph-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
tooltipY: 0,
tooltipVisible: false,
contextElement: null,
contextType: null,
focusAnimationDuration: 1000
contextType: null
};
},
zoomFactor: 0,
Expand Down Expand Up @@ -259,22 +258,16 @@
});
},
focusNode: function (node) {
var duration = this.state.focusAnimationDuration;
var fit = TheGraph.findNodeFit(node,
this.state.width,
this.state.height);
var duration = TheGraph.config.focusAnimationDuration;
var fit = TheGraph.findNodeFit(node, this.state.width, this.state.height);
var start_point = {
x: -(this.state.x - this.state.width / 2) / this.state.scale,
y: -(this.state.y - this.state.height / 2) / this.state.scale,
}, end_point = {
x: node.metadata.x,
y: node.metadata.y,
};
var graphfit = TheGraph.findAreaFit(start_point,
end_point,
this.state.width,
this.state.height);

var graphfit = TheGraph.findAreaFit(start_point, end_point, this.state.width, this.state.height);
var scale_ratio_1 = Math.abs(graphfit.scale - this.state.scale);
var scale_ratio_2 = Math.abs(fit.scale - graphfit.scale);
var scale_ratio_diff = scale_ratio_1 + scale_ratio_2;
Expand Down
3 changes: 2 additions & 1 deletion the-graph/the-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
nodeHeight: defaultNodeSize,
autoSizeNode: true,
maxPortCount: 9,
nodeHeightIncrement: 12
nodeHeightIncrement: 12,
focusAnimationDuration: 1500
},
factories: {}
};
Expand Down

0 comments on commit beb09f5

Please sign in to comment.