removing .bind mootools call (phase 1/2)

This commit is contained in:
Ezequiel Bergamaschi
2014-07-06 01:15:34 -03:00
parent fb5546111e
commit fe59b1ce46
17 changed files with 126 additions and 120 deletions

View File

@@ -26,9 +26,13 @@ mindplot.layout.GridSorter = new Class({
var children = this._getSortedChildren(treeSet, node);
// Compute heights ...
var me = this;
var heights = children.map(function(child) {
return {id:child.getId(),height:this._computeChildrenHeight(treeSet, child)};
}.bind(this));
return {
id: child.getId(),
height: me._computeChildrenHeight(treeSet, child)
};
});
// Calculate the offsets ...
var result = {};

View File

@@ -107,12 +107,12 @@ mindplot.layout.OriginalLayout = new Class({
var sorter = node.getSorter();
var offsetById = sorter.computeOffsets(this._treeSet, node);
var parentPosition = node.getPosition();
var me = this;
_.each(children, function (child) {
var offset = offsetById[child.getId()];
var childFreeDisplacement = child.getFreeDisplacement();
var direction = node.getSorter().getChildDirection(this._treeSet, child);
var direction = node.getSorter().getChildDirection(me._treeSet, child);
if ((direction > 0 && childFreeDisplacement.x < 0) || (direction < 0 && childFreeDisplacement.x > 0)) {
child.resetFreeDisplacement();
@@ -125,9 +125,9 @@ mindplot.layout.OriginalLayout = new Class({
var parentX = parentPosition.x;
var parentY = parentPosition.y;
var newPos = {x:parentX + offset.x, y:parentY + offset.y + this._calculateAlignOffset(node, child, heightById)};
this._treeSet.updateBranchPosition(child, newPos);
}.bind(this));
var newPos = {x:parentX + offset.x, y:parentY + offset.y + me._calculateAlignOffset(node, child, heightById)};
me._treeSet.updateBranchPosition(child, newPos);
});
node._branchHeight = newBranchHeight;
}

View File

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