From 32e701aa558b78b9a5bb6a8e1d3564c35e94b630 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Sun, 22 May 2016 15:46:26 +0200 Subject: [PATCH 1/5] Move ImageExportController to ExportController and Fix line height for toolbox titles --- src/css/toolbox.css | 2 +- .../{ImageExportController.js => ExportController.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/js/controller/settings/exportimage/{ImageExportController.js => ExportController.js} (100%) diff --git a/src/css/toolbox.css b/src/css/toolbox.css index 1bc7bbd8..ad7c5526 100644 --- a/src/css/toolbox.css +++ b/src/css/toolbox.css @@ -13,7 +13,7 @@ margin: 0; font-size: 15px; /* reset for firefox */ - height: 17px; + height: 16px; background: #222; } diff --git a/src/js/controller/settings/exportimage/ImageExportController.js b/src/js/controller/settings/exportimage/ExportController.js similarity index 100% rename from src/js/controller/settings/exportimage/ImageExportController.js rename to src/js/controller/settings/exportimage/ExportController.js From f66c2578abee42b9096ebce959a4d711855ca3a3 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Sun, 22 May 2016 23:37:28 +0200 Subject: [PATCH 2/5] Issue #446: Add export tabs, move zoom controls --- src/css/settings-application.css | 2 +- src/css/settings-export.css | 67 +++++++- src/css/settings.css | 1 - src/index.html | 4 + .../controller/settings/SettingsController.js | 2 +- .../settings/exportimage/ExportController.js | 156 +++++++++++++----- .../exportimage/GifExportController.js | 33 +--- ...tController.js => MiscExportController.js} | 12 +- .../exportimage/PngExportController.js | 90 +--------- .../exportimage/ZipExportController.js | 73 ++++++++ .../settings/resize/ResizeController.js | 9 +- src/js/rendering/DrawingLoop.js | 3 +- src/js/widgets/SizeInput.js | 41 ++++- src/piskel-script-list.js | 5 +- src/templates/settings/application.html | 2 +- src/templates/settings/export.html | 81 ++------- src/templates/settings/export/gif.html | 17 ++ src/templates/settings/export/misc.html | 9 + src/templates/settings/export/png.html | 9 + src/templates/settings/export/zip.html | 19 +++ src/templates/settings/import.html | 2 +- src/templates/settings/resize.html | 2 +- src/templates/settings/save.html | 2 +- 23 files changed, 396 insertions(+), 245 deletions(-) rename src/js/controller/settings/exportimage/{CExportController.js => MiscExportController.js} (84%) create mode 100644 src/js/controller/settings/exportimage/ZipExportController.js create mode 100644 src/templates/settings/export/gif.html create mode 100644 src/templates/settings/export/misc.html create mode 100644 src/templates/settings/export/png.html create mode 100644 src/templates/settings/export/zip.html diff --git a/src/css/settings-application.css b/src/css/settings-application.css index 9b49a7b0..b60042df 100644 --- a/src/css/settings-application.css +++ b/src/css/settings-application.css @@ -56,6 +56,6 @@ margin: 5px; } -.settings-section--application-general > .settings-item > label { +.settings-section-application > .settings-item > label { display: block; } \ No newline at end of file diff --git a/src/css/settings-export.css b/src/css/settings-export.css index aad86bb8..f0f0da9a 100644 --- a/src/css/settings-export.css +++ b/src/css/settings-export.css @@ -57,17 +57,17 @@ color: white; } -.scaling-factor { +.export-scale { margin-bottom: 10px; } -.scaling-factor-input { +.export-scale .scale-input { margin: 5px; vertical-align: middle; - width: 145px; + width: 150px; } -.scaling-factor-text { +.export-scale .scale-text { height: 31px; display: inline-block; line-height: 30px; @@ -77,3 +77,62 @@ border-radius: 3px; text-align: center; } + +.export-resize { + margin: 10px 0; + overflow: hidden; +} + +.export-resize > * { + float: left; +} + +.export-resize > *:not(:last-child) { + margin-right: 10px; +} + +.export-resize > .resize-field { + width: 70px; +} + +.export-resize > .resize-label { + height: 23px; + line-height: 23px; +} + +.export-tabs { + overflow: hidden; + position: relative; +} + +.export-tabs:after { + content: ""; + display: block; + position: absolute; + bottom: 0; + width: 100%; + height: 1px; + z-index: 0; + background-color: gold; +} + +.export-tab { + float: left; + cursor: pointer; + padding: 5px; + border: 1px solid transparent; + /* Make sure the tab and its border are positioned above the :after element; */ + position: relative; + z-index: 1; +} + +.export-tab.selected, +.export-tab:hover { + color: gold; +} + +.export-tab.selected { + border-color: gold gold #444 gold; + border-style: solid; + border-width: 1px; +} diff --git a/src/css/settings.css b/src/css/settings.css index 0a16c425..606f9551 100644 --- a/src/css/settings.css +++ b/src/css/settings.css @@ -72,7 +72,6 @@ } .settings-title { - color : gold; margin-top: 20px; margin-bottom: 10px; text-transform: uppercase; diff --git a/src/index.html b/src/index.html index a54301b6..9227c069 100644 --- a/src/index.html +++ b/src/index.html @@ -101,6 +101,10 @@ @@include('templates/settings/save.html', {}) @@include('templates/settings/import.html', {}) @@include('templates/settings/export.html', {}) + @@include('templates/settings/export/png.html', {}) + @@include('templates/settings/export/gif.html', {}) + @@include('templates/settings/export/zip.html', {}) + @@include('templates/settings/export/misc.html', {}) diff --git a/src/templates/settings/export/gif.html b/src/templates/settings/export/gif.html new file mode 100644 index 00000000..00db1ddb --- /dev/null +++ b/src/templates/settings/export/gif.html @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/src/templates/settings/export/misc.html b/src/templates/settings/export/misc.html new file mode 100644 index 00000000..5f2e004c --- /dev/null +++ b/src/templates/settings/export/misc.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/templates/settings/export/png.html b/src/templates/settings/export/png.html new file mode 100644 index 00000000..57779662 --- /dev/null +++ b/src/templates/settings/export/png.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/templates/settings/export/zip.html b/src/templates/settings/export/zip.html new file mode 100644 index 00000000..b688d854 --- /dev/null +++ b/src/templates/settings/export/zip.html @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/src/templates/settings/import.html b/src/templates/settings/import.html index 87c26877..85d9e3ac 100644 --- a/src/templates/settings/import.html +++ b/src/templates/settings/import.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/templates/settings/export/zip.html b/src/templates/settings/export/zip.html index b688d854..564795e9 100644 --- a/src/templates/settings/export/zip.html +++ b/src/templates/settings/export/zip.html @@ -1,19 +1,19 @@ \ No newline at end of file From c63c764060de1a8392b8392f8d5c7d86bda21078 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Mon, 23 May 2016 22:29:20 +0200 Subject: [PATCH 4/5] Issue #446: Improve export panels style consistency --- src/css/settings-export.css | 26 +++++++++++-------- src/css/settings.css | 2 +- src/css/style.css | 1 - .../exportimage/ZipExportController.js | 1 + src/templates/settings/export/gif.html | 8 +++--- src/templates/settings/export/misc.html | 19 +++++++++----- src/templates/settings/export/png.html | 8 +++--- src/templates/settings/export/zip.html | 26 +++++++++---------- 8 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/css/settings-export.css b/src/css/settings-export.css index 9e069ac4..1dbf14e2 100644 --- a/src/css/settings-export.css +++ b/src/css/settings-export.css @@ -137,13 +137,24 @@ border-width: 1px; } -.export-panel-gif .settings-item { +.export-info { + padding: 10px 5px 0px; + font-weight: normal; + text-shadow: none; + font-style: italic; +} + +.export-panel-section { + padding: 5px; + margin-top: 10px; + border: 1px solid #5d5d5d; + border-radius: 2px; +} + +.export-panel-gif .export-panel-section { display: flex; align-items: center; overflow: hidden; - padding: 5px; - border: 1px solid #5d5d5d; - border-radius: 2px; } .export-panel-gif .button { @@ -151,10 +162,3 @@ width: 75px; flex-shrink: 0; } - -.gif-export-info { - padding: 10px 5px 0px; - font-weight: normal; - text-shadow: none; - font-style: italic; -} diff --git a/src/css/settings.css b/src/css/settings.css index 606f9551..f5a615ef 100644 --- a/src/css/settings.css +++ b/src/css/settings.css @@ -35,7 +35,7 @@ .drawer-content { overflow: hidden; background-color: #444; - height: 650px; + height: 550px; max-height: 100%; width: 280px; border-top-left-radius: 4px; diff --git a/src/css/style.css b/src/css/style.css index 8375d1a2..3f69f9f3 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -52,7 +52,6 @@ body { } .checkbox-fix { - vertical-align: -2px; margin-left: 0; } diff --git a/src/js/controller/settings/exportimage/ZipExportController.js b/src/js/controller/settings/exportimage/ZipExportController.js index 9d0185d0..be0ab283 100644 --- a/src/js/controller/settings/exportimage/ZipExportController.js +++ b/src/js/controller/settings/exportimage/ZipExportController.js @@ -53,6 +53,7 @@ var layers = this.piskelController.getLayers(); var framePaddingLength = ('' + this.piskelController.getFrameCount()).length; var layerPaddingLength = ('' + layers.length).length; + var zoom = this.exportController.getExportZoom(); for (var j = 0; this.piskelController.hasLayerAt(j); j++) { var layer = this.piskelController.getLayerAt(j); var layerid = pskl.utils.StringUtils.leftPad(j, layerPaddingLength, '0'); diff --git a/src/templates/settings/export/gif.html b/src/templates/settings/export/gif.html index d839ba85..7162762c 100644 --- a/src/templates/settings/export/gif.html +++ b/src/templates/settings/export/gif.html @@ -1,11 +1,13 @@ \ No newline at end of file diff --git a/src/templates/settings/export/png.html b/src/templates/settings/export/png.html index fd0dc42c..39f176f0 100644 --- a/src/templates/settings/export/png.html +++ b/src/templates/settings/export/png.html @@ -1,6 +1,8 @@ \ No newline at end of file diff --git a/src/templates/settings/export/zip.html b/src/templates/settings/export/zip.html index 564795e9..362d0fa7 100644 --- a/src/templates/settings/export/zip.html +++ b/src/templates/settings/export/zip.html @@ -1,19 +1,17 @@ \ No newline at end of file From 2f295825f2e642f15e425a41420d4e0927f9c6c6 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Mon, 23 May 2016 22:51:48 +0200 Subject: [PATCH 5/5] Issue #446: store selected export tab in user preferences --- src/js/controller/settings/exportimage/ExportController.js | 6 +++--- src/js/utils/UserSettings.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/controller/settings/exportimage/ExportController.js b/src/js/controller/settings/exportimage/ExportController.js index 3d96f6e8..68b282c9 100644 --- a/src/js/controller/settings/exportimage/ExportController.js +++ b/src/js/controller/settings/exportimage/ExportController.js @@ -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) { diff --git a/src/js/utils/UserSettings.js b/src/js/utils/UserSettings.js index 59d282ab..bc056cf1 100644 --- a/src/js/utils/UserSettings.js +++ b/src/js/utils/UserSettings.js @@ -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,