From 11be4bf0d27bdfaa5de8f8beab73a8dcd4f0ba53 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Mon, 28 Jan 2019 12:59:25 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B5?= =?UTF-8?q?=20=D1=88=D1=80=D0=B8=D1=84=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Reader/TextPage/TextPage.vue | 44 ++++++++++--------- client/store/modules/reader.js | 6 +-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 721de613..87e4d849 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -257,15 +257,32 @@ class TextPage extends Vue { this.pageChangeTransitionSpeed = settings.pageChangeTransitionSpeed; //0-100% } + async calcPropsAndLoadFonts(omitLoadFonts) { + this.calcDrawProps(); + + if (!omitLoadFonts) + await this.loadFonts(); + + //this.draw(); + + // шрифты хрен знает когда подгружаются, поэтому + if (!this.parsed.force) { + let i = 0; + this.parsed.force = true; + while (i < 10) { + this.draw(); + await sleep(1000); + i++; + } + this.parsed.force = false; + } + } + loadSettings() { (async() => { let fontName = this.fontName; - this.getSettings(); - this.calcDrawProps(); - - if (fontName != this.fontName) - await this.loadFonts(); + await this.calcPropsAndLoadFonts(fontName == this.fontName); this.draw(); })(); @@ -311,22 +328,7 @@ class TextPage extends Vue { this.parsed = this.book.parsed; - this.calcDrawProps(); - - await this.loadFonts(); - - //this.draw(); - - // шрифты хрен знает когда подгружаются, поэтому - let i = 0; - this.parsed.force = true; - while (i < 10) { - this.draw(); - await sleep(1000); - i++; - } - this.parsed.force = false; - + this.calcPropsAndLoadFonts(); this.refreshTime(); })(); } diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index 2993d3f2..441110fd 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -11,10 +11,10 @@ const fonts = [ ]; const webFonts = [ - {css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: 0}, + {css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: -20}, {css: 'https://fonts.googleapis.com/css?family=Lobster', name: 'Lobster', fontVertShift: 0}, - {css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: 0}, - {css: 'https://fonts.googleapis.com/css?family=Comfortaa', name: 'Comfortaa', fontVertShift: 0}, + {css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: -40}, + {css: 'https://fonts.googleapis.com/css?family=Comfortaa', name: 'Comfortaa', fontVertShift: 10}, ];