From 3f97b8af7950d3b263ccd69fe745e53d04c938ed Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 7 Oct 2019 10:15:35 +0300 Subject: [PATCH] [DE mobile] Custom Color (shape fill, border color) --- .../mobile/lib/component/HsbColorPicker.js | 4 +- .../mobile/lib/component/ThemeColorPalette.js | 6 +-- .../resources/less/ios/_color-palette.less | 2 +- .../less/material/_color-palette.less | 2 +- .../mobile/app/view/edit/EditShape.js | 40 +++++++++++++++++-- .../mobile/resources/css/app-ios.css | 2 +- .../mobile/resources/css/app-material.css | 2 +- .../mobile/resources/css/app-ios.css | 2 +- .../mobile/resources/css/app-material.css | 2 +- .../mobile/resources/css/app-ios.css | 2 +- .../mobile/resources/css/app-material.css | 2 +- 11 files changed, 48 insertions(+), 18 deletions(-) diff --git a/apps/common/mobile/lib/component/HsbColorPicker.js b/apps/common/mobile/lib/component/HsbColorPicker.js index fa6c3a985..0d313fecc 100644 --- a/apps/common/mobile/lib/component/HsbColorPicker.js +++ b/apps/common/mobile/lib/component/HsbColorPicker.js @@ -58,7 +58,7 @@ define([ template: _.template([ '
', '
', - '
', + '
', '<% if (android) { %>', '<%= scope.textAddNewColor %>', '<% } else { %>', @@ -310,7 +310,7 @@ define([ } var color = this.colorHslToRgb(this.currentHsl[0], this.currentHsl[1], this.currentHsl[2]); this.currentColor = this.colorRgbToHex(color[0], color[1], color[2]); - $('.color-preview').css({'background-color': this.currentColor}); + $('.color-hsb-preview').css({'background-color': this.currentColor}); }, diff --git a/apps/common/mobile/lib/component/ThemeColorPalette.js b/apps/common/mobile/lib/component/ThemeColorPalette.js index 284f4f03b..81476d4f6 100644 --- a/apps/common/mobile/lib/component/ThemeColorPalette.js +++ b/apps/common/mobile/lib/component/ThemeColorPalette.js @@ -226,13 +226,9 @@ define([ }, saveDynamicColor: function(color) { - this.isDynamicColors = false; var key_name = 'asc.'+Common.localStorage.getId()+'.colors.custom'; var colors = Common.localStorage.getItem(key_name); colors = colors ? colors.split(',') : []; - if (colors.length > 0) { - this.isDynamicColors = true; - } if (colors.push(color) > this.options.dynamiccolors) colors.shift(); this.dynamicColors = colors; Common.localStorage.setItem(key_name, colors.join().toUpperCase()); @@ -251,7 +247,7 @@ define([ templateColors += ''; } } - $('.dynamic-colors .item-inner').html(_.template(templateColors)); + $(this.el).find('.dynamic-colors .item-inner').html(_.template(templateColors)); $(this.el).find('.color-palette .dynamic-colors a').on('click', _.bind(this.onColorClick, this)); }, diff --git a/apps/common/mobile/resources/less/ios/_color-palette.less b/apps/common/mobile/resources/less/ios/_color-palette.less index 8e0201f4b..2f3d12cd1 100644 --- a/apps/common/mobile/resources/less/ios/_color-palette.less +++ b/apps/common/mobile/resources/less/ios/_color-palette.less @@ -43,7 +43,7 @@ } .custom-colors { - .color-preview { + .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/common/mobile/resources/less/material/_color-palette.less b/apps/common/mobile/resources/less/material/_color-palette.less index a902305c4..0a2470663 100644 --- a/apps/common/mobile/resources/less/material/_color-palette.less +++ b/apps/common/mobile/resources/less/material/_color-palette.less @@ -48,7 +48,7 @@ } .custom-colors { - .color-preview { + .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/documenteditor/mobile/app/view/edit/EditShape.js b/apps/documenteditor/mobile/app/view/edit/EditShape.js index b49b37de6..9ffbab093 100644 --- a/apps/documenteditor/mobile/app/view/edit/EditShape.js +++ b/apps/documenteditor/mobile/app/view/edit/EditShape.js @@ -157,7 +157,7 @@ define([ transparent: true }); this.paletteFillColor.on('customcolor', function () { - me.showCustomColor(); + me.showCustomFillColor(); }); var template = _.template(['
', '
    ', @@ -173,7 +173,7 @@ define([ '
', '
'].join('')); $('#tab-shape-fill').append(template({scope: this})); - $('#edit-shape-add-custom-color').single('click', _.bind(this.showCustomColor, this)); + $('#edit-shape-add-custom-color').single('click', _.bind(this.showCustomFillColor, this)); Common.Utils.addScrollIfNeed('.page.shape-style', '.page.shape-style .page-content'); this.fireEvent('page:show', [this, selector]); }, @@ -200,11 +200,29 @@ define([ this.paletteBorderColor = new Common.UI.ThemeColorPalette({ el: $('.page[data-page=edit-shape-border-color] .page-content') }); + this.paletteBorderColor.on('customcolor', function () { + me.showCustomBorderColor(); + }); + var template = _.template([''].join('')); + $('.page[data-page=edit-shape-border-color] .page-content').append(template({scope: this})); + $('#edit-shape-add-custom-border-color').single('click', _.bind(this.showCustomBorderColor, this)); this.fireEvent('page:show', [this, selector]); }, - showCustomColor: function() { + showCustomFillColor: function() { var me = this, selector = '#edit-shape-custom-color-view'; me.showPage(selector, true); @@ -220,6 +238,22 @@ define([ me.fireEvent('page:show', [me, selector]); }, + showCustomBorderColor: function() { + var me = this, + selector = '#edit-shape-custom-color-view'; + me.showPage(selector, true); + + me.customBorderColorPicker = new Common.UI.HsbColorPicker({ + el: $('.page[data-page=edit-shape-custom-color] .page-content'), + color: me.paletteBorderColor.currentColor + }); + me.customBorderColorPicker.on('addcustomcolor', function (colorPicker, color) { + me.paletteBorderColor.addNewDynamicColor(colorPicker, color); + }); + + me.fireEvent('page:show', [me, selector]); + }, + textStyle: 'Style', textWrap: 'Wrap', textReplace: 'Replace', diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index 483b1d233..5171ba1ab 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -6222,7 +6222,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .color-palette .dynamic-colors .item-inner { overflow: visible; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index 6cb2fe283..c6d20d0f1 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -5816,7 +5816,7 @@ html.phone .document-menu .list-block .item-link { .color-palette.list-block:last-child li:last-child a { border-radius: 0; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/presentationeditor/mobile/resources/css/app-ios.css b/apps/presentationeditor/mobile/resources/css/app-ios.css index aa763b7f1..7e405ca8f 100644 --- a/apps/presentationeditor/mobile/resources/css/app-ios.css +++ b/apps/presentationeditor/mobile/resources/css/app-ios.css @@ -6222,7 +6222,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .color-palette .dynamic-colors .item-inner { overflow: visible; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/presentationeditor/mobile/resources/css/app-material.css b/apps/presentationeditor/mobile/resources/css/app-material.css index 7ea8c95b5..4624594da 100644 --- a/apps/presentationeditor/mobile/resources/css/app-material.css +++ b/apps/presentationeditor/mobile/resources/css/app-material.css @@ -5816,7 +5816,7 @@ html.phone .document-menu .list-block .item-link { .color-palette.list-block:last-child li:last-child a { border-radius: 0; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css index c83f2a4aa..5d9144e18 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css @@ -6222,7 +6222,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .color-palette .dynamic-colors .item-inner { overflow: visible; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); } diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-material.css b/apps/spreadsheeteditor/mobile/resources/css/app-material.css index ce3d48218..e0f3fa264 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-material.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-material.css @@ -5826,7 +5826,7 @@ html.phone .document-menu .list-block .item-link { .color-palette.list-block:last-child li:last-child a { border-radius: 0; } -.custom-colors .color-preview { +.custom-colors .color-hsb-preview { width: 75px; border: 1px solid rgba(0, 0, 0, 0.3); }