From ddce4f9a7ba953708aa11aee24d53f67a9a720d6 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 16 Jan 2019 21:45:29 +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=BE=D1=82=D1=81=D1=82=D1=83=D0=BF=20=D1=81=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=20=D0=B8=20=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B0?= 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, 6 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index d7141cdf..304e329f 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -50,6 +50,7 @@ class TextPage extends Vue { this.canvas.height = this.$refs.main.clientHeight; this.lineHeight = this.fontSize + this.lineInterval; this.pageLineCount = Math.floor(this.canvas.height/this.lineHeight); + this.w = this.canvas.width - 2*this.indent; } showBook() { @@ -69,9 +70,10 @@ class TextPage extends Vue { this.fontStyle = '';// 'bold','italic' this.fontSize = 20;// px this.fontName = 'arial'; - this.lineInterval = 5;// px + this.lineInterval = 5;// px, межстрочный интервал this.textAlignJustify = true;// выравнивание по ширине this.p = 30;// px, отступ параграфа + this.indent = 20;// px, отступ всего текста слева и справа this.calcDrawProps(); this.drawPage();// пока не загрузили, очистим канвас @@ -97,7 +99,7 @@ class TextPage extends Vue { this.calcDrawProps(); const parsed = this.book.parsed; parsed.p = this.p; - parsed.w = this.canvas.width;// px, ширина страницы + parsed.w = this.w;// px, ширина текста parsed.font = this.font; parsed.measureText = (text, style) => {// eslint-disable-line no-unused-vars return this.context.measureText(text).width; @@ -156,7 +158,7 @@ class TextPage extends Vue { text += part.text; } - let indent = (line.first ? this.p : 0); + let indent = this.indent + (line.first ? this.p : 0); y += this.lineHeight; let filled = false; @@ -164,7 +166,7 @@ class TextPage extends Vue { const words = text.split(' '); if (words.length > 1) { const spaceCount = words.length - 1; - const space = (canvas.width - line.width + spaceWidth*spaceCount)/spaceCount; + const space = (this.w - line.width + spaceWidth*spaceCount)/spaceCount; let x = indent; for (const word of words) {