mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Small cleanup zip export screen
This commit is contained in:
parent
913ef272cf
commit
32e528525c
@ -8,7 +8,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.PngExportController.prototype.init = function () {
|
ns.PngExportController.prototype.init = function () {
|
||||||
this.previewContainerEl = document.querySelectorAll(".png-export-preview")[0];
|
this.previewContainerEl = document.querySelector(".png-export-preview");
|
||||||
|
this.pngFilePrefixInput = document.getElementById('zip-prefix-name');
|
||||||
|
this.pngFilePrefixInput.value = 'sprite_';
|
||||||
|
|
||||||
document.querySelector(".png-download-button").addEventListener('click', this.onPngDownloadButtonClick_.bind(this));
|
document.querySelector(".png-download-button").addEventListener('click', this.onPngDownloadButtonClick_.bind(this));
|
||||||
|
|
||||||
@ -30,7 +32,7 @@
|
|||||||
for (var i = 0; i < this.piskelController.getFrameCount(); i++) {
|
for (var i = 0; i < this.piskelController.getFrameCount(); i++) {
|
||||||
var frame = this.piskelController.getFrameAt(i);
|
var frame = this.piskelController.getFrameAt(i);
|
||||||
var canvas = this.getFrameAsCanvas_(frame);
|
var canvas = this.getFrameAsCanvas_(frame);
|
||||||
var basename = document.getElementById("zip-file-name").value || "sprite_";
|
var basename = this.pngFilePrefixInput.value;
|
||||||
var filename = basename + (i+1) + ".png";
|
var filename = basename + (i+1) + ".png";
|
||||||
zip.file(filename, pskl.CanvasUtils.getBase64FromCanvas(canvas) + '\n', {base64: true});
|
zip.file(filename, pskl.CanvasUtils.getBase64FromCanvas(canvas) + '\n', {base64: true});
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Export as ZIP
|
Export as ZIP
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-item">
|
<div class="settings-item">
|
||||||
<span class="settings-description">ZIP with one PNG file per frame. Name will use the prefix above and append the frame index, ex: sprite_1.png</span>
|
<span class="settings-description">ZIP with one PNG file per frame.</span>
|
||||||
|
<span class="settings-description" style="display:block">File names will start with the prefix below.</span>
|
||||||
<div class="settings-item">
|
<div class="settings-item">
|
||||||
<label for="zip-file-name">File prefix:</label>
|
<label for="zip-prefix-name">Prefix:</label>
|
||||||
<input id="zip-file-name" type="text" class="textfield" placeholder="sprite_">
|
<input id="zip-prefix-name" type="text" class="textfield" placeholder="PNG file prefix ...">
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="button button-primary zip-generate-button"/>Download ZIP</button>
|
<button type="button" class="button button-primary zip-generate-button"/>Download ZIP</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user