mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
Use Object.values instead of _.each : 96ddb50
This commit is contained in:
parent
e6d7edd130
commit
70b7a72bd7
1 changed files with 9 additions and 10 deletions
|
@ -1,4 +1,3 @@
|
|||
var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
|
||||
var intl = require('../intl');
|
||||
|
@ -83,7 +82,7 @@ GitVisuals.prototype.resetAll = function() {
|
|||
visTag.remove();
|
||||
}, this);
|
||||
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
visNode.remove();
|
||||
}, this);
|
||||
|
||||
|
@ -207,7 +206,7 @@ GitVisuals.prototype.animateAllAttrKeys = function(keys, attr, speed, easing) {
|
|||
this.visBranchCollection.each(animate);
|
||||
this.visEdgeCollection.each(animate);
|
||||
this.visTagCollection.each(animate);
|
||||
_.each(this.visNodeMap, animate);
|
||||
Object.values(this.visNodeMap).forEach(animate);
|
||||
|
||||
var time = (speed !== undefined) ? speed : GRAPHICS.defaultAnimationTime;
|
||||
setTimeout(function() {
|
||||
|
@ -322,7 +321,7 @@ GitVisuals.prototype.finishAnimation = function(speed) {
|
|||
GitVisuals.prototype.explodeNodes = function(speed) {
|
||||
var deferred = Q.defer();
|
||||
var funcs = [];
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
funcs.push(visNode.getExplodeStepFunc(speed));
|
||||
});
|
||||
|
||||
|
@ -369,7 +368,7 @@ GitVisuals.prototype.animateAllFromAttrToAttr = function(fromSnapshot, toSnapsho
|
|||
this.visBranchCollection.each(animate);
|
||||
this.visEdgeCollection.each(animate);
|
||||
this.visTagCollection.each(animate);
|
||||
_.each(this.visNodeMap, animate);
|
||||
Object.values(this.visNodeMap).forEach(animate);
|
||||
};
|
||||
|
||||
/***************************************
|
||||
|
@ -393,7 +392,7 @@ GitVisuals.prototype.genSnapshot = function() {
|
|||
this.fullCalc();
|
||||
|
||||
var snapshot = {};
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
snapshot[visNode.get('id')] = visNode.getAttributes();
|
||||
}, this);
|
||||
|
||||
|
@ -633,7 +632,7 @@ GitVisuals.prototype.calcDepth = function() {
|
|||
}
|
||||
|
||||
var depthIncrement = this.getDepthIncrement(maxDepth);
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
visNode.setDepthBasedOn(depthIncrement, this.getHeaderOffset());
|
||||
}, this);
|
||||
};
|
||||
|
@ -656,7 +655,7 @@ GitVisuals.prototype.calcDepth = function() {
|
|||
**************************************/
|
||||
|
||||
GitVisuals.prototype.animateNodePositions = function(speed) {
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
visNode.animateUpdatedPosition(speed);
|
||||
}, this);
|
||||
};
|
||||
|
@ -854,7 +853,7 @@ GitVisuals.prototype.zIndexReflow = function() {
|
|||
};
|
||||
|
||||
GitVisuals.prototype.visNodesFront = function() {
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
visNode.toFront();
|
||||
});
|
||||
};
|
||||
|
@ -893,7 +892,7 @@ GitVisuals.prototype.drawTreeFirstTime = function() {
|
|||
this.gitReady = true;
|
||||
this.calcTreeCoords();
|
||||
|
||||
_.each(this.visNodeMap, function(visNode) {
|
||||
Object.values(this.visNodeMap).forEach(function(visNode) {
|
||||
visNode.genGraphics(this.paper);
|
||||
}, this);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue