Работа над ночным режимом

This commit is contained in:
Book Pauk
2023-01-08 20:08:03 +07:00
parent 91097515f2
commit 9e4be96522
5 changed files with 69 additions and 15 deletions

View File

@@ -115,6 +115,12 @@
<div class="col"></div>
<button v-show="showToolButton['nightMode']" ref="nightMode" v-ripple class="tool-button" :class="buttonActiveClass('nightMode')" @click="buttonClick('nightMode')">
<q-icon name="la la-moon" size="32px" />
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
{{ rstore.readerActions['nightMode'] }}
</q-tooltip>
</button>
<button v-show="showToolButton['clickControl']" ref="clickControl" v-ripple class="tool-button" :class="buttonActiveClass('clickControl')" @click="buttonClick('clickControl')">
<q-icon name="la la-mouse" size="32px" />
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
@@ -290,6 +296,8 @@ class Reader {
contentsActive = false;
libsActive = false;
recentBooksActive = false;
nightModeActive = false;
clickControlActive = false;
settingsActive = false;
@@ -462,8 +470,8 @@ class Reader {
this.allowUrlParamBookPos = settings.allowUrlParamBookPos;
this.copyFullText = settings.copyFullText;
this.showClickMapPage = settings.showClickMapPage;
this.clickControl = settings.clickControl;
this.clickControlActive = this.clickControl;
this.nightModeActive = settings.nightMode;
this.clickControlActive = settings.clickControl;
this.blinkCachedLoad = settings.blinkCachedLoad;
this.showToolButton = settings.showToolButton;
this.toolBarHideOnScroll = settings.toolBarHideOnScroll;
@@ -1014,10 +1022,16 @@ class Reader {
}
}
nightModeToggle() {
if (!this.nightModeActive && !utils.hasProp(this.settings.nightColorSets, 'textColor')) {
this.$root.notify.warning(`Ночной режим активирован впервые. Цвета заданы по умолчанию.`);
}
this.commit('reader/nightModeToggle');
}
clickControlToggle() {
const newSettings = _.cloneDeep(this.settings);
newSettings.clickControl = !this.clickControl;
this.commit('reader/setSettings', newSettings);
this.commit('reader/setSettings', {clickControl: !this.clickControlActive});
}
offlineModeToggle() {
@@ -1119,6 +1133,7 @@ class Reader {
case 'contents':
case 'libs':
case 'recentBooks':
case 'nightMode':
case 'clickControl':
case 'offlineMode':
case 'settings':
@@ -1167,7 +1182,7 @@ class Reader {
}
async activateClickMapPage() {
if (this.clickControl && this.showClickMapPage && !this.clickMapActive) {
if (this.clickControlActive && this.showClickMapPage && !this.clickMapActive) {
this.clickMapActive = true;
await this.$refs.clickMapPage.slowDisappear();
this.clickMapActive = false;
@@ -1525,6 +1540,9 @@ class Reader {
case 'recentBooks':
this.recentBooksToggle();
break;
case 'nightMode':
this.nightModeToggle();
break;
case 'clickControl':
this.clickControlToggle();
break;