Добавлено отображение номера изображения в статусбар

This commit is contained in:
Book Pauk
2020-12-16 01:41:37 +07:00
parent 3dbf00344e
commit 72f8977071
3 changed files with 40 additions and 18 deletions

View File

@@ -160,12 +160,13 @@ export default class DrawHelper {
return out;
}
drawPercentBar(x, y, w, h, font, fontSize, bookPos, textLength) {
drawPercentBar(x, y, w, h, font, fontSize, bookPos, textLength, imageNum, imageLength) {
const pad = 3;
const fh = h - 2*pad;
const fh2 = fh/2;
const t1 = `${Math.floor((bookPos + 1)/1000)}/${Math.floor(textLength/1000)}`;
const tImg = (imageNum > 0 ? ` (${imageNum}/${imageLength})` : '');
const t1 = `${Math.floor((bookPos + 1)/1000)}/${Math.floor(textLength/1000)}${tImg}`;
const w1 = this.measureTextFont(t1, font) + fh2;
const read = (bookPos + 1)/textLength;
const t2 = `${(read*100).toFixed(2)}%`;
@@ -188,7 +189,7 @@ export default class DrawHelper {
return out;
}
drawStatusBar(statusBarTop, statusBarHeight, bookPos, textLength, title) {
drawStatusBar(statusBarTop, statusBarHeight, bookPos, textLength, title, imageNum, imageLength) {
let out = `<div class="layout" style="` +
`width: ${this.realWidth}px; height: ${statusBarHeight}px; ` +
@@ -206,7 +207,7 @@ export default class DrawHelper {
out += this.fillTextShift(this.fittingString(title, this.realWidth/2 - fontSize - 3, font), fontSize, 2, font, fontSize);
out += this.drawPercentBar(this.realWidth/2, 2, this.realWidth/2 - timeW - 2*fontSize, statusBarHeight, font, fontSize, bookPos, textLength);
out += this.drawPercentBar(this.realWidth/2, 2, this.realWidth/2 - timeW - 2*fontSize, statusBarHeight, font, fontSize, bookPos, textLength, imageNum, imageLength);
out += '</div>';
return out;