Skip to content

Commit

Permalink
renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jul 5, 2018
1 parent c59fc86 commit 9067e77
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
24 changes: 12 additions & 12 deletions src/js/base/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ ripe.Ripe.prototype.init = function(brand, model, options) {
return;
}

if (ripe.equal(this.parts, this.partsHistory[this.partsHistoryPointer])) {
if (ripe.equal(this.parts, this.history[this.historyPointer])) {
return;
}

var _parts = ripe.clone(this.parts);
this.partsHistory = this.partsHistory.slice(0, this.partsHistoryPointer + 1);
this.partsHistory.push(_parts);
this.partsHistoryPointer = this.partsHistory.length - 1;
this.history = this.history.slice(0, this.historyPointer + 1);
this.history.push(_parts);
this.historyPointer = this.history.length - 1;
});
};

Expand Down Expand Up @@ -111,8 +111,8 @@ ripe.Ripe.prototype.config = function(brand, model, options) {
this,
function(result) {
result = result || this.parts;
this.partsHistory = [];
this.partsHistoryPointer = -1;
this.history = [];
this.historyPointer = -1;
if (this.ready === false) {
this.ready = true;
this.trigger("ready");
Expand Down Expand Up @@ -298,8 +298,8 @@ ripe.Ripe.prototype.undo = function() {
return;
}

this.partsHistoryPointer -= 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer -= 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "undo" });
};

Expand All @@ -314,8 +314,8 @@ ripe.Ripe.prototype.redo = function() {
return;
}

this.partsHistoryPointer += 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer += 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "redo" });
};

Expand All @@ -326,7 +326,7 @@ ripe.Ripe.prototype.redo = function() {
* current parts history stack.
*/
ripe.Ripe.prototype.canUndo = function() {
return this.partsHistoryPointer > 0;
return this.historyPointer > 0;
};

/**
Expand All @@ -336,7 +336,7 @@ ripe.Ripe.prototype.canUndo = function() {
* in the history stack.
*/
ripe.Ripe.prototype.canRedo = function() {
return this.partsHistory.length - 1 > this.partsHistoryPointer;
return this.history.length - 1 > this.historyPointer;
};

ripe.Ripe.prototype.addPlugin = function(plugin) {
Expand Down
10 changes: 5 additions & 5 deletions src/js/ripe-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions src/js/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ ripe.Ripe.prototype.init = function(brand, model, options) {
return;
}

if (ripe.equal(this.parts, this.partsHistory[this.partsHistoryPointer])) {
if (ripe.equal(this.parts, this.history[this.historyPointer])) {
return;
}

var _parts = ripe.clone(this.parts);
this.partsHistory = this.partsHistory.slice(0, this.partsHistoryPointer + 1);
this.partsHistory.push(_parts);
this.partsHistoryPointer = this.partsHistory.length - 1;
this.history = this.history.slice(0, this.historyPointer + 1);
this.history.push(_parts);
this.historyPointer = this.history.length - 1;
});
};

Expand Down Expand Up @@ -356,8 +356,8 @@ ripe.Ripe.prototype.config = function(brand, model, options) {
this,
function(result) {
result = result || this.parts;
this.partsHistory = [];
this.partsHistoryPointer = -1;
this.history = [];
this.historyPointer = -1;
if (this.ready === false) {
this.ready = true;
this.trigger("ready");
Expand Down Expand Up @@ -543,8 +543,8 @@ ripe.Ripe.prototype.undo = function() {
return;
}

this.partsHistoryPointer -= 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer -= 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "undo" });
};

Expand All @@ -559,8 +559,8 @@ ripe.Ripe.prototype.redo = function() {
return;
}

this.partsHistoryPointer += 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer += 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "redo" });
};

Expand All @@ -571,7 +571,7 @@ ripe.Ripe.prototype.redo = function() {
* current parts history stack.
*/
ripe.Ripe.prototype.canUndo = function() {
return this.partsHistoryPointer > 0;
return this.historyPointer > 0;
};

/**
Expand All @@ -581,7 +581,7 @@ ripe.Ripe.prototype.canUndo = function() {
* in the history stack.
*/
ripe.Ripe.prototype.canRedo = function() {
return this.partsHistory.length - 1 > this.partsHistoryPointer;
return this.history.length - 1 > this.historyPointer;
};

ripe.Ripe.prototype.addPlugin = function(plugin) {
Expand Down
24 changes: 12 additions & 12 deletions src/python/ripe_demo/static/js/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ ripe.Ripe.prototype.init = function(brand, model, options) {
return;
}

if (ripe.equal(this.parts, this.partsHistory[this.partsHistoryPointer])) {
if (ripe.equal(this.parts, this.history[this.historyPointer])) {
return;
}

var _parts = ripe.clone(this.parts);
this.partsHistory = this.partsHistory.slice(0, this.partsHistoryPointer + 1);
this.partsHistory.push(_parts);
this.partsHistoryPointer = this.partsHistory.length - 1;
this.history = this.history.slice(0, this.historyPointer + 1);
this.history.push(_parts);
this.historyPointer = this.history.length - 1;
});
};

Expand Down Expand Up @@ -356,8 +356,8 @@ ripe.Ripe.prototype.config = function(brand, model, options) {
this,
function(result) {
result = result || this.parts;
this.partsHistory = [];
this.partsHistoryPointer = -1;
this.history = [];
this.historyPointer = -1;
if (this.ready === false) {
this.ready = true;
this.trigger("ready");
Expand Down Expand Up @@ -543,8 +543,8 @@ ripe.Ripe.prototype.undo = function() {
return;
}

this.partsHistoryPointer -= 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer -= 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "undo" });
};

Expand All @@ -559,8 +559,8 @@ ripe.Ripe.prototype.redo = function() {
return;
}

this.partsHistoryPointer += 1;
var parts = this.partsHistory[this.partsHistoryPointer];
this.historyPointer += 1;
var parts = this.history[this.historyPointer];
parts && this.setParts(parts, false, { action: "redo" });
};

Expand All @@ -571,7 +571,7 @@ ripe.Ripe.prototype.redo = function() {
* current parts history stack.
*/
ripe.Ripe.prototype.canUndo = function() {
return this.partsHistoryPointer > 0;
return this.historyPointer > 0;
};

/**
Expand All @@ -581,7 +581,7 @@ ripe.Ripe.prototype.canUndo = function() {
* in the history stack.
*/
ripe.Ripe.prototype.canRedo = function() {
return this.partsHistory.length - 1 > this.partsHistoryPointer;
return this.history.length - 1 > this.historyPointer;
};

ripe.Ripe.prototype.addPlugin = function(plugin) {
Expand Down

0 comments on commit 9067e77

Please sign in to comment.