Allow to rename basename for PNG in ZIP export option.

This may helps #192
This commit is contained in:
Eduardo San Martin Morote 2014-08-22 11:27:45 +02:00
parent 17824ae1c4
commit 978319af20
2 changed files with 12 additions and 6 deletions

View File

@ -30,7 +30,8 @@
for (var i = 0; i < this.piskelController.getFrameCount(); i++) {
var frame = this.piskelController.getFrameAt(i);
var canvas = this.getFrameAsCanvas_(frame);
var filename = "sprite_" + (i+1) + ".png";
var basename = document.getElementById("zip-file-name").value || "sprite_";
var filename = basename + (i+1) + ".png";
zip.file(filename, pskl.CanvasUtils.getBase64FromCanvas(canvas) + '\n', {base64: true});
}

View File

@ -7,11 +7,16 @@
<span class="settings-description">PNG with all frames side by side.</span>
<button type="button" class="button button-primary png-download-button">Download PNG</button>
</div>
<div class="settings-item">
<span class="settings-description">ZIP with one PNG file per frame.</span>
<div>
<button type="button" class="button button-primary zip-generate-button"/>Download ZIP</button>
<div class="settings-title">
Export as ZIP
</div>
<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>
<div class="settings-item">
<label for="zip-file-name">File prefix:</label>
<input id="zip-file-name" type="text" class="textfield" placeholder="sprite_">
</div>
<button type="button" class="button button-primary zip-generate-button"/>Download ZIP</button>
</div>
<div class="settings-title">
Export to Animated GIF