Issue #446: store selected export tab in user preferences

This commit is contained in:
Julian Descottes 2016-05-23 22:51:48 +02:00
parent c63c764060
commit 2f295825f2
2 changed files with 5 additions and 3 deletions

View File

@ -20,8 +20,6 @@
}
};
var DEFAULT_TAB = 'png';
ns.ExportController = function (piskelController) {
this.piskelController = piskelController;
this.onSizeInputChange_ = this.onSizeInputChange_.bind(this);
@ -53,7 +51,8 @@
this.exportTabs = document.querySelector('.export-tabs');
this.addEventListener(this.exportTabs, 'click', this.onTabsClicked_);
this.selectTab(DEFAULT_TAB);
var tab = pskl.UserSettings.get(pskl.UserSettings.EXPORT_TAB);
this.selectTab(tab);
};
ns.ExportController.prototype.destroy = function () {
@ -75,6 +74,7 @@
this.currentController = new tabs[tabId].controller(this.piskelController, this);
this.currentController.init();
this.currentTab = tabId;
pskl.UserSettings.set(pskl.UserSettings.EXPORT_TAB, tabId);
var selectedTab = this.exportTabs.querySelector('.selected');
if (selectedTab) {

View File

@ -13,6 +13,7 @@
LAYER_PREVIEW : 'LAYER_PREVIEW',
LAYER_OPACITY : 'LAYER_OPACITY',
EXPORT_SCALING: 'EXPORT_SCALING',
EXPORT_TAB: 'EXPORT_TAB',
PEN_SIZE : 'PEN_SIZE',
RESIZE_SETTINGS: 'RESIZE_SETTINGS',
KEY_TO_DEFAULT_VALUE_MAP_ : {
@ -30,6 +31,7 @@
'LAYER_OPACITY' : 0.2,
'LAYER_PREVIEW' : true,
'EXPORT_SCALING' : 1,
'EXPORT_TAB' : 'png',
'PEN_SIZE' : 1,
'RESIZE_SETTINGS': {
maintainRatio : true,