mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fixed bug when reaching stage 0
This commit is contained in:
parent
17bf7b3807
commit
14bf3f97c5
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
ns.Frame = function (pixels) {
|
ns.Frame = function (pixels) {
|
||||||
this.pixels = pixels;
|
this.pixels = pixels;
|
||||||
this.previousStates = [pixels];
|
this.previousStates = [this._clonePixels()];
|
||||||
this.stateIndex = 0;
|
this.stateIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.Frame.prototype.containsPixel = function (col, row) {
|
ns.Frame.prototype.containsPixel = function (col, row) {
|
||||||
return col >= 0 && row >= 0 && col <= this.pixels.length && row <= this.pixels[0].length;
|
return col >= 0 && row >= 0 && col < this.pixels.length && row < this.pixels[0].length;
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.Frame.prototype.saveState = function () {
|
ns.Frame.prototype.saveState = function () {
|
||||||
@ -69,7 +69,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.Frame.prototype.loadPreviousState = function () {
|
ns.Frame.prototype.loadPreviousState = function () {
|
||||||
if (this.stateIndex >= 0) {
|
if (this.stateIndex > 0) {
|
||||||
this.stateIndex--;
|
this.stateIndex--;
|
||||||
this.pixels = this.previousStates[this.stateIndex];
|
this.pixels = this.previousStates[this.stateIndex];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user