diff --git a/client/components/Reader/TextPage/DrawHelper.js b/client/components/Reader/TextPage/DrawHelper.js
index c48e69f7..ec62d9a7 100644
--- a/client/components/Reader/TextPage/DrawHelper.js
+++ b/client/components/Reader/TextPage/DrawHelper.js
@@ -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 = `
`, 0);
- else
- newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount);
+ imageNum++;
- imageIndex++;
- this.images.push({paraIndex, num: imageIndex, id});
+ if (inPara && !this.showInlineImagesInCenter && !center)
+ growParagraph(``, 0);
+ else
+ newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount);
+
+ this.images.push({paraIndex, num: imageNum, id});
if (inPara && this.showInlineImagesInCenter)
newParagraph(' ', 1);
} else {//external
- dimPromises.push(getExternalImageDimensions(href));
- newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount);
+ imageNum++;
- imageIndex++;
- this.images.push({paraIndex, num: imageIndex, id});
+ dimPromises.push(getExternalImageDimensions(href));
+ newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount);
+
+ this.images.push({paraIndex, num: imageNum, id});
}
}
}
@@ -574,6 +576,7 @@ export default class BookParser {
if (attrs.href && attrs.href.value) {
image = this.imageHrefToId(attrs.href.value);
image.inline = false;
+ image.num = (attrs.num && attrs.num.value ? attrs.num.value : 0);
}
break;
}
@@ -582,6 +585,7 @@ export default class BookParser {
if (attrs.href && attrs.href.value) {
const img = this.imageHrefToId(attrs.href.value);
img.inline = true;
+ img.num = (attrs.num && attrs.num.value ? attrs.num.value : 0);
result.push({
style: Object.assign({}, style),
image: img,
@@ -811,6 +815,7 @@ export default class BookParser {
paraIndex,
w: imageWidth,
h: imageHeight,
+ num: part.image.num
}});
lines.push(line);
line = {begin: line.end + 1, parts: []};
@@ -821,7 +826,7 @@ export default class BookParser {
line.last = true;
line.parts.push({style, text: ' ',
image: {local: part.image.local, inline: false, id: part.image.id,
- imageLine: i, lineCount, paraIndex, w: imageWidth, h: imageHeight}
+ imageLine: i, lineCount, paraIndex, w: imageWidth, h: imageHeight, num: part.image.num}
});
continue;
@@ -833,7 +838,7 @@ export default class BookParser {
let imgH = (bin.h > this.fontSize ? this.fontSize : bin.h);
imgW += bin.w*imgH/bin.h;
line.parts.push({style, text: '',
- image: {local: part.image.local, inline: true, id: part.image.id}});
+ image: {local: part.image.local, inline: true, id: part.image.id, num: part.image.num}});
}
}