replacing old .each mootools' method by _.each

This commit is contained in:
Ezequiel Bergamaschi
2014-03-17 00:36:29 -03:00
parent a0e3c74921
commit 2ab488bfa6
26 changed files with 63 additions and 62 deletions

View File

@@ -38,7 +38,7 @@ mindplot.layout.AbstractBasicSorter = new Class({
result = height;
} else {
var childrenHeight = 0;
children.each(function(child) {
_.each(children, function(child) {
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
}, this);

View File

@@ -77,7 +77,7 @@ mindplot.layout.BalancedSorter = new Class({
var result = null;
var last = children.getLast();
position = position || {x:last.getPosition().x, y:last.getPosition().y + 1};
children.each(function (child, index) {
_.each(children, function (child, index) {
var cpos = child.getPosition();
if (position.y > cpos.y) {
yOffset = child == last ?
@@ -129,7 +129,7 @@ mindplot.layout.BalancedSorter = new Class({
// Filter nodes on one side..
var children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
children.each(function (child, index) {
_.each(children, function (child, index) {
if (child.getOrder() > node.getOrder()) {
child.setOrder(child.getOrder() - 2);
}
@@ -154,7 +154,7 @@ mindplot.layout.BalancedSorter = new Class({
var totalPHeight = 0;
var totalNHeight = 0;
heights.each(function (elem) {
_.each(heights, function (elem) {
if (elem.order % 2 == 0) {
totalPHeight += elem.height;
} else {

View File

@@ -145,7 +145,7 @@ mindplot.layout.LayoutManager = new Class({
},
_flushEvents: function() {
this._events.each(function(event) {
_.each(this._events, function(event) {
this.fireEvent('change', event);
}, this);
this._events = [];
@@ -155,7 +155,7 @@ mindplot.layout.LayoutManager = new Class({
if (!nodes)
nodes = this._treeSet.getTreeRoots();
nodes.each(function(node) {
_.each(nodes, function(node) {
if (node.hasOrderChanged() || node.hasPositionChanged()) {
// Find or create a event ...

View File

@@ -70,7 +70,7 @@ mindplot.layout.OriginalLayout = new Class({
layout:function () {
var roots = this._treeSet.getTreeRoots();
roots.each(function (node) {
_.each(roots, function (node) {
// Calculate all node heights ...
var sorter = node.getSorter();
@@ -108,7 +108,7 @@ mindplot.layout.OriginalLayout = new Class({
var offsetById = sorter.computeOffsets(this._treeSet, node);
var parentPosition = node.getPosition();
children.each(function (child) {
_.each(children, function (child) {
var offset = offsetById[child.getId()];
var childFreeDisplacement = child.getFreeDisplacement();
@@ -133,7 +133,7 @@ mindplot.layout.OriginalLayout = new Class({
}
// Continue reordering the children nodes ...
children.each(function (child) {
_.each(children, function (child) {
this._layoutChildren(child, heightById);
}, this);
},
@@ -183,7 +183,7 @@ mindplot.layout.OriginalLayout = new Class({
this._shiftBranches(node, heightById);
}
children.each(function (child) {
_.each(children, function (child) {
this._fixOverlapping(child, heightById);
}, this);
},
@@ -193,7 +193,7 @@ mindplot.layout.OriginalLayout = new Class({
var siblingsToShift = this._treeSet.getSiblingsInVerticalDirection(node, node.getFreeDisplacement().y);
var last = node;
siblingsToShift.each(function (sibling) {
_.each(siblingsToShift, function (sibling) {
var overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
return this._branchesOverlap(shiftedBranch, sibling, heightById);
}, this);
@@ -209,7 +209,7 @@ mindplot.layout.OriginalLayout = new Class({
return !shiftedBranches.contains(branch);
});
branchesToShift.each(function (branch) {
_.each(branchesToShift, function (branch) {
var bAmount = node.getFreeDisplacement().y;
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
shiftedBranches.push(branch);

View File

@@ -240,7 +240,7 @@ mindplot.layout.RootedTreeSet = new Class({
var yOffset = oldPos.y - position.y;
var children = this.getChildren(node);
children.each(function (child) {
_.each(children, function (child) {
this.shiftBranchPosition(child, xOffset, yOffset);
}.bind(this));
@@ -251,7 +251,7 @@ mindplot.layout.RootedTreeSet = new Class({
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
var children = this.getChildren(node);
children.each(function (child) {
_.each(children, function (child) {
this.shiftBranchPosition(child, xOffset, yOffset);
}.bind(this));
},

View File

@@ -168,7 +168,7 @@ mindplot.layout.SymmetricSorter = new Class({
// Compute the center of the branch ...
var totalHeight = 0;
heights.each(function (elem) {
_.each(heights, function (elem) {
totalHeight += elem.height;
});
var ysum = totalHeight / 2;