From 95b55ddd3e4945b7757b0832abad6119a968f3b1 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 19 Jan 2019 03:22:22 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/TextPage/TextPage.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index f3230e06..78c68a42 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -211,6 +211,7 @@ class TextPage extends Vue { y += this.lineHeight; let filled = false; + // если выравнивание по ширине включено if (this.textAlignJustify && !line.last) { let lineText = ''; for (const part of line.parts) { @@ -231,20 +232,21 @@ class TextPage extends Vue { for (let i = 0; i < partWords.length; i++) { let word = partWords[i]; context.fillText(word, x, y); - x += this.measureText(word, part.style) + (i < partWords.length - 1 ? space : 0); + x += this.measureText(word) + (i < partWords.length - 1 ? space : 0); } } filled = true; } } + // просто выводим текст if (!filled) { let x = indent; for (const part of line.parts) { let text = part.text; context.font = this.fontByStyle(part.style); context.fillText(text, x, y); - x += this.measureText(text, part.style); + x += this.measureText(text); } } }