mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Feature : Save Piskel project as File
First commit : Removed Local storage feature Added 'download project' 'open project' options First attempt at simplifying right panel. To be continued ...
This commit is contained in:
@ -9,28 +9,23 @@
|
||||
|
||||
ns.PngExportController.prototype.init = function () {
|
||||
this.previewContainerEl = document.querySelectorAll(".png-export-preview")[0];
|
||||
this.uploadStatusContainerEl = document.querySelectorAll(".png-upload-status")[0];
|
||||
|
||||
document.querySelector(".png-upload-button").addEventListener('click', this.onPngUploadButtonClick_.bind(this));
|
||||
document.querySelector(".png-download-button").addEventListener('click', this.onPngDownloadButtonClick_.bind(this));
|
||||
|
||||
document.querySelector(".zip-generate-button").addEventListener('click', this.onZipButtonClick_.bind(this));
|
||||
|
||||
this.updatePreview_(this.getFramesheetAsCanvas().toDataURL("image/png"));
|
||||
|
||||
(new ns.GifExportController(this.piskelController)).init();
|
||||
};
|
||||
|
||||
ns.PngExportController.prototype.onPngDownloadButtonClick_ = function (evt) {
|
||||
var fileName = this.getPiskelName_() + '.png';
|
||||
pskl.utils.ImageToBlob.canvasToBlob(this.getFramesheetAsCanvas(), function(blob) {
|
||||
pskl.utils.FileUtils.downloadAsFile(fileName, blob);
|
||||
pskl.utils.BlobUtils.canvasToBlob(this.getFramesheetAsCanvas(), function(blob) {
|
||||
pskl.utils.FileUtils.downloadAsFile(blob, fileName);
|
||||
});
|
||||
};
|
||||
|
||||
ns.PngExportController.prototype.onPngUploadButtonClick_ = function (evt) {
|
||||
this.previewContainerEl.classList.add("preview-upload-ongoing");
|
||||
pskl.app.imageUploadService.upload(this.getFramesheetAsCanvas().toDataURL("image/png"), this.onImageUploadCompleted_.bind(this));
|
||||
};
|
||||
|
||||
ns.PngExportController.prototype.onZipButtonClick_ = function () {
|
||||
var zip = new window.JSZip();
|
||||
|
||||
@ -43,8 +38,8 @@
|
||||
|
||||
var fileName = this.getPiskelName_() + '.zip';
|
||||
|
||||
var fileContent = zip.generate({type:"blob"});
|
||||
pskl.utils.FileUtils.downloadAsFile(fileName, fileContent);
|
||||
var blob = zip.generate({type:"blob"});
|
||||
pskl.utils.FileUtils.downloadAsFile(blob, fileName);
|
||||
};
|
||||
|
||||
ns.PngExportController.prototype.getFrameAsCanvas_ = function (frame) {
|
||||
|
Reference in New Issue
Block a user