Мелкий рефакторинг

This commit is contained in:
Book Pauk
2019-03-08 13:37:27 +07:00
parent 9a8f35fd8a
commit c7abae10b7

View File

@@ -161,7 +161,6 @@ class TextPage extends Vue {
this.h = this.scrollHeight - 2*this.indentTB; this.h = this.scrollHeight - 2*this.indentTB;
this.lineHeight = this.fontSize + this.lineInterval; this.lineHeight = this.fontSize + this.lineInterval;
this.pageLineCount = 1 + Math.floor((this.h - this.lineHeight + this.lineInterval/2)/this.lineHeight); this.pageLineCount = 1 + Math.floor((this.h - this.lineHeight + this.lineInterval/2)/this.lineHeight);
this.pageSpace = this.scrollHeight - this.pageLineCount*this.lineHeight;
this.$refs.scrollingPage1.style.width = this.w + 'px'; this.$refs.scrollingPage1.style.width = this.w + 'px';
this.$refs.scrollingPage2.style.width = this.w + 'px'; this.$refs.scrollingPage2.style.width = this.w + 'px';
@@ -195,7 +194,6 @@ class TextPage extends Vue {
this.drawHelper.indentLR = this.indentLR; this.drawHelper.indentLR = this.indentLR;
this.drawHelper.textAlignJustify = this.textAlignJustify; this.drawHelper.textAlignJustify = this.textAlignJustify;
this.drawHelper.lineHeight = this.lineHeight; this.drawHelper.lineHeight = this.lineHeight;
this.drawHelper.pageSpace = this.pageSpace;
this.drawHelper.context = this.context; this.drawHelper.context = this.context;
//сообщение "Загрузка шрифтов..." //сообщение "Загрузка шрифтов..."
@@ -235,15 +233,16 @@ class TextPage extends Vue {
this.statusBarClickable = this.drawHelper.statusBarClickable(this.statusBarTop, this.statusBarHeight); this.statusBarClickable = this.drawHelper.statusBarClickable(this.statusBarTop, this.statusBarHeight);
//scrolling page //scrolling page
let y = this.pageSpace/2; const pageSpace = this.scrollHeight - this.pageLineCount*this.lineHeight;
let y = pageSpace/2;
if (this.showStatusBar) if (this.showStatusBar)
y += this.statusBarHeight*(this.statusBarTop ? 1 : 0); y += this.statusBarHeight*(this.statusBarTop ? 1 : 0);
let page1 = this.$refs.scrollBox1; let page1 = this.$refs.scrollBox1;
let page2 = this.$refs.scrollBox2; let page2 = this.$refs.scrollBox2;
page1.style.width = this.w + this.indentLR + 'px'; page1.style.width = this.w + this.indentLR + 'px';
page2.style.width = this.w + this.indentLR + 'px'; page2.style.width = this.w + this.indentLR + 'px';
page1.style.height = this.scrollHeight - (this.pageSpace > 0 ? this.pageSpace : 0) + 'px'; page1.style.height = this.scrollHeight - (pageSpace > 0 ? pageSpace : 0) + 'px';
page2.style.height = this.scrollHeight - (this.pageSpace > 0 ? this.pageSpace : 0) + 'px'; page2.style.height = this.scrollHeight - (pageSpace > 0 ? pageSpace : 0) + 'px';
page1.style.top = y + 'px'; page1.style.top = y + 'px';
page2.style.top = y + 'px'; page2.style.top = y + 'px';
page1.style.left = this.indentLR + 'px'; page1.style.left = this.indentLR + 'px';