From d840407218963650d8e46a3e472df9de47be9fc7 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 17 Jan 2019 22:10:33 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8B=D1=80=D0=B0=D0=B2=D0=BD=D0=B8=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=20=D0=B2=D0=B5=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/TextPage/TextPage.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index ea75348b..16674d54 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -44,8 +44,6 @@ class TextPage extends Vue { mounted() { this.canvas = this.$refs.canvas; this.context = this.canvas.getContext('2d'); - this.context.textAlign = 'left'; - this.context.textBaseline = 'bottom'; } async calcDrawProps() { @@ -54,6 +52,10 @@ class TextPage extends Vue { this.lineHeight = this.fontSize + this.lineInterval; this.pageLineCount = Math.floor(this.canvas.height/this.lineHeight); this.w = this.canvas.width - 2*this.indent; + this.h = this.canvas.height; + + this.context.textAlign = 'left'; + this.context.textBaseline = 'bottom'; if (this.parsed) { this.parsed.p = this.p; @@ -130,6 +132,7 @@ class TextPage extends Vue { this.calcDrawProps(); await this.loadFonts(); + this.drawPage(); })(); } @@ -170,7 +173,8 @@ class TextPage extends Vue { let len = lines.length; len = (len > this.pageLineCount ? len = this.pageLineCount : len); - let y = 0; + + let y = -this.lineInterval/2 + (this.h - this.pageLineCount*this.lineHeight)/2; for (let i = 0; i < len; i++) { const line = lines[i]; /* line: