mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Adds the ability to export a scaled spritesheet.
This commit is contained in:
@@ -7,7 +7,15 @@
|
||||
this.gifExportController = new ns.GifExportController(piskelController);
|
||||
};
|
||||
|
||||
pskl.utils.inherit(ns.ImageExportController, pskl.controller.settings.AbstractSettingController);
|
||||
|
||||
ns.ImageExportController.prototype.init = function () {
|
||||
// Output Scaling Factor
|
||||
var scalingFactorInput = document.querySelector('.scaling-factor-input');
|
||||
scalingFactorInput.value = pskl.UserSettings.get(pskl.UserSettings.EXPORT_SCALING);
|
||||
this.addEventListener(scalingFactorInput, 'change', this.onScalingFactorChange_);
|
||||
this.updateScalingFactorText_(scalingFactorInput.value);
|
||||
|
||||
this.pngExportController.init();
|
||||
this.gifExportController.init();
|
||||
};
|
||||
@@ -16,4 +24,20 @@
|
||||
this.pngExportController.destroy();
|
||||
this.gifExportController.destroy();
|
||||
};
|
||||
|
||||
ns.ImageExportController.prototype.onScalingFactorChange_ = function (evt) {
|
||||
var target = evt.target;
|
||||
var value = Math.round(parseFloat(target.value));
|
||||
if (!isNaN(value)) {
|
||||
this.updateScalingFactorText_(value);
|
||||
pskl.UserSettings.set(pskl.UserSettings.EXPORT_SCALING, value);
|
||||
} else {
|
||||
target.value = pskl.UserSettings.get(pskl.UserSettings.EXPORT_SCALING);
|
||||
}
|
||||
};
|
||||
|
||||
ns.ImageExportController.prototype.updateScalingFactorText_ = function (scale) {
|
||||
var scalingFactorText = document.querySelector('.scaling-factor-text');
|
||||
scalingFactorText.innerHTML = scale + 'x';
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user