Работа над двухстраничным режимом

This commit is contained in:
Book Pauk
2021-02-02 18:09:21 +07:00
parent de849d3447
commit d2167d8605
5 changed files with 33 additions and 3 deletions

View File

@@ -148,7 +148,7 @@ export default @Component({
}) })
class SettingsPage extends Vue { class SettingsPage extends Vue {
selectedTab = 'profiles'; selectedTab = 'profiles';
selectedViewTab = 'color'; selectedViewTab = 'mode';
selectedKeysTab = 'mouse'; selectedKeysTab = 'mouse';
form = {}; form = {};
fontBold = false; fontBold = false;

View File

@@ -7,6 +7,7 @@
no-caps no-caps
class="no-mp bg-grey-4 text-grey-7" class="no-mp bg-grey-4 text-grey-7"
> >
<q-tab name="mode" label="Режим" />
<q-tab name="color" label="Цвет" /> <q-tab name="color" label="Цвет" />
<q-tab name="font" label="Шрифт" /> <q-tab name="font" label="Шрифт" />
<q-tab name="text" label="Текст" /> <q-tab name="text" label="Текст" />
@@ -16,6 +17,10 @@
<div class="q-mb-sm"/> <div class="q-mb-sm"/>
<div class="col tab-panel"> <div class="col tab-panel">
<div v-if="selectedViewTab == 'mode'">
@@include('./ViewTab/Mode.inc');
</div>
<div v-if="selectedViewTab == 'color'"> <div v-if="selectedViewTab == 'color'">
@@include('./ViewTab/Color.inc'); @@include('./ViewTab/Color.inc');
</div> </div>

View File

@@ -0,0 +1,20 @@
<!---------------------------------------------->
<div class="hidden part-header">Режим</div>
<div class="item row">
<div class="label-2"></div>
<div class="col row">
<q-checkbox v-model="dualPageMode" size="xs" label="Двухстраничный режим" />
</div>
</div>
<div class="item row">
<div class="label-2">Отступ</div>
<div class="col row">
<NumInput class="col-left" v-model="dualIndentLR" :min="0" :max="2000" :disable="!dualPageMode">
<q-tooltip :delay="1000" anchor="top middle" self="bottom middle" content-style="font-size: 80%">
Слева/справа внутри страницы
</q-tooltip>
</NumInput>
</div>
</div>

View File

@@ -165,7 +165,8 @@ class TextPage extends Vue {
this.scrollHeight = this.realHeight - (this.showStatusBar ? this.statusBarHeight : 0); this.scrollHeight = this.realHeight - (this.showStatusBar ? this.statusBarHeight : 0);
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); const pageRowsCount = 1 + Math.floor((this.h - this.lineHeight + this.lineInterval/2)/this.lineHeight);
this.pageLineCount = (this.dualPageMode ? pageRowsCount*2 : pageRowsCount)
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';
@@ -189,6 +190,7 @@ class TextPage extends Vue {
this.drawHelper.book = this.book; this.drawHelper.book = this.book;
this.drawHelper.parsed = this.parsed; this.drawHelper.parsed = this.parsed;
this.drawHelper.pageLineCount = this.pageLineCount; this.drawHelper.pageLineCount = this.pageLineCount;
this.drawHelper.dualPageMode = this.dualPageMode;
this.drawHelper.backgroundColor = this.backgroundColor; this.drawHelper.backgroundColor = this.backgroundColor;
this.drawHelper.statusBarColor = this.statusBarColor; this.drawHelper.statusBarColor = this.statusBarColor;
@@ -203,6 +205,7 @@ class TextPage extends Vue {
this.drawHelper.w = this.w; this.drawHelper.w = this.w;
this.drawHelper.h = this.h; this.drawHelper.h = this.h;
this.drawHelper.indentLR = this.indentLR; this.drawHelper.indentLR = this.indentLR;
this.drawHelper.dualIndentLR = this.dualIndentLR;
this.drawHelper.textAlignJustify = this.textAlignJustify; this.drawHelper.textAlignJustify = this.textAlignJustify;
this.drawHelper.lineHeight = this.lineHeight; this.drawHelper.lineHeight = this.lineHeight;
this.drawHelper.context = this.context; this.drawHelper.context = this.context;
@@ -254,7 +257,7 @@ class TextPage extends Vue {
} }
//scrolling page //scrolling page
const pageSpace = this.scrollHeight - this.pageLineCount*this.lineHeight; const pageSpace = this.scrollHeight - pageRowsCount*this.lineHeight;
let top = pageSpace/2; let top = pageSpace/2;
if (this.showStatusBar) if (this.showStatusBar)
top += this.statusBarHeight*(this.statusBarTop ? 1 : 0); top += this.statusBarHeight*(this.statusBarTop ? 1 : 0);

View File

@@ -225,6 +225,8 @@ const settingDefaults = {
indentTB: 0,// px, отступ всего текста сверху и снизу indentTB: 0,// px, отступ всего текста сверху и снизу
wordWrap: true,//перенос по слогам wordWrap: true,//перенос по слогам
keepLastToFirst: false,// перенос последней строки в первую при листании keepLastToFirst: false,// перенос последней строки в первую при листании
dualPageMode: false,
dualIndentLR: 10,// px, отступ слева и справа внутри страницы в двухстраничном режиме
showStatusBar: true, showStatusBar: true,
statusBarTop: false,// top, bottom statusBarTop: false,// top, bottom