Move ImageExportController to ExportController and Fix line height for toolbox titles

This commit is contained in:
Julian Descottes
2016-05-22 15:46:26 +02:00
parent e272fbe32f
commit 32e701aa55
2 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
(function () {
var ns = $.namespace('pskl.controller.settings.exportimage');
ns.ImageExportController = function (piskelController) {
this.piskelController = piskelController;
this.pngExportController = new ns.PngExportController(piskelController);
this.gifExportController = new ns.GifExportController(piskelController);
this.cExportController = new ns.CExportController(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.addEventListener(scalingFactorInput, 'input', this.onScalingFactorChange_);
this.updateScalingFactorText_(scalingFactorInput.value);
this.pngExportController.init();
this.gifExportController.init();
this.cExportController.init();
};
ns.ImageExportController.prototype.destroy = function () {
this.pngExportController.destroy();
this.gifExportController.destroy();
this.cExportController.destroy();
this.superclass.destroy.call(this);
};
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';
};
})();