mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Added clear method to pskl.model.Frame
This commit is contained in:
parent
99e9cf8856
commit
feadca9d1f
@ -210,8 +210,4 @@
|
|||||||
this.overlayRenderer.render(this.overlayFrame);
|
this.overlayRenderer.render(this.overlayFrame);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.DrawingController.prototype.clearOverlay = function () {
|
|
||||||
this.overlayFrame = pskl.model.Frame.createEmptyFromFrame(this.frame);
|
|
||||||
};
|
|
||||||
})();
|
})();
|
@ -8,6 +8,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.Frame.createEmpty = function (width, height) {
|
ns.Frame.createEmpty = function (width, height) {
|
||||||
|
var pixels = ns.Frame.createEmptyPixelGrid_(width, height);
|
||||||
|
return new ns.Frame(pixels);
|
||||||
|
};
|
||||||
|
|
||||||
|
ns.Frame.createEmptyPixelGrid_ = function (width, height) {
|
||||||
var pixels = []; //new Array(width);
|
var pixels = []; //new Array(width);
|
||||||
for (var columnIndex=0; columnIndex < width; columnIndex++) {
|
for (var columnIndex=0; columnIndex < width; columnIndex++) {
|
||||||
var columnArray = [];
|
var columnArray = [];
|
||||||
@ -16,7 +21,7 @@
|
|||||||
}
|
}
|
||||||
pixels[columnIndex] = columnArray;
|
pixels[columnIndex] = columnArray;
|
||||||
}
|
}
|
||||||
return new ns.Frame(pixels);
|
return pixels;
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.Frame.createEmptyFromFrame = function (frame) {
|
ns.Frame.createEmptyFromFrame = function (frame) {
|
||||||
@ -41,6 +46,13 @@
|
|||||||
this.pixels = this.clonePixels_(pixels);
|
this.pixels = this.clonePixels_(pixels);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ns.Frame.prototype.clear = function () {
|
||||||
|
var pixels = ns.Frame.createEmptyPixelGrid_(this.getWidth(), this.getHeight());
|
||||||
|
this.setPixels(pixels);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone a set of pixels. Should be static utility method
|
* Clone a set of pixels. Should be static utility method
|
||||||
* @private
|
* @private
|
||||||
|
Loading…
Reference in New Issue
Block a user