diff options
| author | Henry Jameson <me@hjkos.com> | 2018-11-23 08:24:55 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-11-23 08:24:55 +0300 |
| commit | 754d71ec1933d897f9206ddca080bb258256edbb (patch) | |
| tree | e11069a63e4c5f2d694b47f7e4b0faa3f3bcd4e7 /src/components/style_switcher/style_switcher.js | |
| parent | 91ea9b7b0e7b2ad818c0ac026951cd5a9c68bfdf (diff) | |
added checkboxes to keep current roundness and shadows, also cleaned up how
shadows/roundness are reset when switching themes
Diffstat (limited to 'src/components/style_switcher/style_switcher.js')
| -rw-r--r-- | src/components/style_switcher/style_switcher.js | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index edc614c3..0c302e93 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -27,6 +27,9 @@ export default { selected: this.$store.state.config.theme, invalidThemeImported: false, + keepShadows: false, + keepRoundness: false, + textColorLocal: '', linkColorLocal: '', @@ -375,6 +378,19 @@ export default { }) }, + clearRoundness () { + Object.keys(this.$data) + .filter(_ => _.endsWith('RadiusLocal')) + .forEach(key => { + set(this.$data, key, undefined) + }) + }, + + clearShadows () { + this.shadowsLocal = {} + console.log(this.shadowsLocal) + }, + /** * This applies stored theme data onto form. * @param {Object} input - input data @@ -420,17 +436,24 @@ export default { this[key + 'ColorLocal'] = rgb2hex(colors[key]) }) - // TODO optimize this - this.btnRadiusLocal = radii.btn - this.inputRadiusLocal = radii.input - this.checkboxRadiusLocal = radii.checkbox - this.panelRadiusLocal = radii.panel - this.avatarRadiusLocal = radii.avatar - this.avatarAltRadiusLocal = radii.avatarAlt - this.tooltipRadiusLocal = radii.tooltip - this.attachmentRadiusLocal = radii.attachment + if (!this.keepRoundness) { + this.clearRoundness() + // TODO optimize this + this.btnRadiusLocal = radii.btn + this.inputRadiusLocal = radii.input + this.checkboxRadiusLocal = radii.checkbox + this.panelRadiusLocal = radii.panel + this.avatarRadiusLocal = radii.avatar + this.avatarAltRadiusLocal = radii.avatarAlt + this.tooltipRadiusLocal = radii.tooltip + this.attachmentRadiusLocal = radii.attachment + } - this.shadowsLocal = shadows + if (!this.keepShadows) { + this.clearShadows() + this.shadowsLocal = shadows + this.shadowSelected = this.shadowsAvailable[0] + } Object.entries(opacity).forEach(([k, v]) => { if (typeof v === 'undefined' || v === null || Number.isNaN(v)) return @@ -441,7 +464,16 @@ export default { watch: { selected () { if (this.selectedVersion === 1) { + if (!this.keepRoundness) { + this.clearRoundness() + } + + if (!this.keepShadows) { + this.clearShadows() + } + this.clearV1() + this.bgColorLocal = this.selected[1] this.fgColorLocal = this.selected[2] this.textColorLocal = this.selected[3] |
