mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
export to file
This commit is contained in:
parent
18764e7d12
commit
992e55dec6
@ -12222,6 +12222,10 @@ if (typeof Function.prototype.bind !== "function") {
|
|||||||
})();;(function () {
|
})();;(function () {
|
||||||
var ns = $.namespace('pskl.utils');
|
var ns = $.namespace('pskl.utils');
|
||||||
|
|
||||||
|
var stopPropagation = function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
ns.FileUtils = {
|
ns.FileUtils = {
|
||||||
readFile : function (file, callback) {
|
readFile : function (file, callback) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
@ -12241,7 +12245,9 @@ if (typeof Function.prototype.bind !== "function") {
|
|||||||
downloadLink.setAttribute('href', content);
|
downloadLink.setAttribute('href', content);
|
||||||
downloadLink.setAttribute('download', filename);
|
downloadLink.setAttribute('download', filename);
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
|
downloadLink.addEventListener('click', stopPropagation);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
|
downloadLink.removeEventListener('click', stopPropagation);
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19134,6 +19140,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
|
|||||||
|
|
||||||
var URL_MAX_LENGTH = 30;
|
var URL_MAX_LENGTH = 30;
|
||||||
var MAX_GIF_COLORS = 256;
|
var MAX_GIF_COLORS = 256;
|
||||||
|
var MAX_EXPORT_ZOOM = 20;
|
||||||
|
var DEFAULT_EXPORT_ZOOM = 10;
|
||||||
|
|
||||||
ns.GifExportController = function (piskelController) {
|
ns.GifExportController = function (piskelController) {
|
||||||
this.piskelController = piskelController;
|
this.piskelController = piskelController;
|
||||||
@ -19144,18 +19152,12 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
|
|||||||
* @static
|
* @static
|
||||||
* @type {Array} array of Objects {zoom:{Number}, default:{Boolean}}
|
* @type {Array} array of Objects {zoom:{Number}, default:{Boolean}}
|
||||||
*/
|
*/
|
||||||
ns.GifExportController.RESOLUTIONS = [
|
ns.GifExportController.RESOLUTIONS = [];
|
||||||
{
|
for (var i = 1 ; i <= MAX_EXPORT_ZOOM ; i++) {
|
||||||
'zoom' : 1
|
ns.GifExportController.RESOLUTIONS.push({
|
||||||
},{
|
zoom : i
|
||||||
'zoom' : 5
|
});
|
||||||
},{
|
}
|
||||||
'zoom' : 10,
|
|
||||||
'default' : true
|
|
||||||
},{
|
|
||||||
'zoom' : 20
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
ns.GifExportController.prototype.init = function () {
|
ns.GifExportController.prototype.init = function () {
|
||||||
this.optionTemplate_ = pskl.utils.Template.get("gif-export-option-template");
|
this.optionTemplate_ = pskl.utils.Template.get("gif-export-option-template");
|
||||||
@ -19171,8 +19173,6 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
|
|||||||
this.downloadButton = $(".gif-download-button");
|
this.downloadButton = $(".gif-download-button");
|
||||||
this.downloadButton.click(this.onDownloadButtonClick_.bind(this));
|
this.downloadButton.click(this.onDownloadButtonClick_.bind(this));
|
||||||
|
|
||||||
this.exportForm = $(".gif-export-form");
|
|
||||||
|
|
||||||
this.exportProgressStatusEl = document.querySelector('.gif-export-progress-status');
|
this.exportProgressStatusEl = document.querySelector('.gif-export-progress-status');
|
||||||
this.exportProgressBarEl = document.querySelector('.gif-export-progress-bar');
|
this.exportProgressBarEl = document.querySelector('.gif-export-progress-bar');
|
||||||
|
|
||||||
@ -19193,7 +19193,6 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
|
|||||||
fps = this.piskelController.getFPS();
|
fps = this.piskelController.getFPS();
|
||||||
|
|
||||||
this.renderAsImageDataAnimatedGIF(zoom, fps, function (imageData) {
|
this.renderAsImageDataAnimatedGIF(zoom, fps, function (imageData) {
|
||||||
pskl.app.imageUploadService.upload(imageData, this.onImageUploadCompleted_.bind(this));
|
|
||||||
pskl.utils.BlobUtils.dataToBlob(imageData, "image/gif", function(blob) {
|
pskl.utils.BlobUtils.dataToBlob(imageData, "image/gif", function(blob) {
|
||||||
pskl.utils.FileUtils.downloadAsFile(blob, fileName);
|
pskl.utils.FileUtils.downloadAsFile(blob, fileName);
|
||||||
});
|
});
|
||||||
@ -19233,7 +19232,9 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
|
|||||||
var label = zoom*this.piskelController.getWidth() + "x" + zoom*this.piskelController.getHeight();
|
var label = zoom*this.piskelController.getWidth() + "x" + zoom*this.piskelController.getHeight();
|
||||||
var value = zoom;
|
var value = zoom;
|
||||||
|
|
||||||
var optionHTML = pskl.utils.Template.replace(this.optionTemplate_, {value : value, label : label});
|
var isSelected = zoom === DEFAULT_EXPORT_ZOOM;
|
||||||
|
var selected = isSelected ? 'selected' : '';
|
||||||
|
var optionHTML = pskl.utils.Template.replace(this.optionTemplate_, {value : value, label : label, selected : selected});
|
||||||
var optionEl = pskl.utils.Template.createFromHTML(optionHTML);
|
var optionEl = pskl.utils.Template.createFromHTML(optionHTML);
|
||||||
|
|
||||||
return optionEl;
|
return optionEl;
|
File diff suppressed because one or more lines are too long
13
js/piskel-packaged-min-2014-07-13-03-54.js
Normal file
13
js/piskel-packaged-min-2014-07-13-03-54.js
Normal file
File diff suppressed because one or more lines are too long
16
js/piskel-packaged-min.js
vendored
16
js/piskel-packaged-min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,9 +1,9 @@
|
|||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See @Gruntfile.js => after build, -2014-07-13-03-15 is replaced by the build version
|
* See @Gruntfile.js => after build, -2014-07-13-03-54 is replaced by the build version
|
||||||
*/
|
*/
|
||||||
var version = '-2014-07-13-03-15';
|
var version = '-2014-07-13-03-54';
|
||||||
var versionHasNotBeenReplaced = version.indexOf('@@') === 0;
|
var versionHasNotBeenReplaced = version.indexOf('@@') === 0;
|
||||||
if (versionHasNotBeenReplaced) {
|
if (versionHasNotBeenReplaced) {
|
||||||
version = '';
|
version = '';
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<label>Select resolution:</label>
|
<label>Select resolution:</label>
|
||||||
<select class="gif-export-select-resolution"></select>
|
<select class="gif-export-select-resolution"></select>
|
||||||
<script type="text/template" id="gif-export-option-template">
|
<script type="text/template" id="gif-export-option-template">
|
||||||
<option value="{{value}}">{{label}}</option>
|
<option value="{{value}}" {{selected}}>{{label}}</option>
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-item">
|
<div class="settings-item">
|
||||||
|
Loading…
Reference in New Issue
Block a user