diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index 5ab70ca1..6c9c41f7 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -594,7 +594,7 @@ class RecentBooksPage { } async handleDel(item) { - if (item.group) { + if (item.group?.length) { const keys = [{key: item.key}]; for (const book of item.group) keys.push({key: book.key}); @@ -615,14 +615,14 @@ class RecentBooksPage { } else { if (await this.$root.stdDialog.confirm('Подтвердите удаление книги из архива:', ' ')) { await bookManager.delRecentBooks([{key: item.key}], 2); - this.$root.notify.info('Книга удалено безвозвратно'); + this.$root.notify.info('Книга удалена безвозвратно'); } } } } async handleRestore(item) { - if (item.group) { + if (item.group?.length) { const keys = [{key: item.key}]; for (const book of item.group) keys.push({key: book.key}); @@ -637,7 +637,7 @@ class RecentBooksPage { async loadBook(item, force = false) { if (item.deleted) - await this.handleRestore(item.key); + await this.handleRestore(item); this.$emit('load-book', {url: item.url, path: item.path, force}); this.close(); diff --git a/client/components/Reader/TextPage/DrawHelper.js b/client/components/Reader/TextPage/DrawHelper.js index f3bf9e77..9446e967 100644 --- a/client/components/Reader/TextPage/DrawHelper.js +++ b/client/components/Reader/TextPage/DrawHelper.js @@ -14,6 +14,11 @@ export default class DrawHelper { return this.context.measureText(text).width; } + measureTextMetrics(text, style) {// eslint-disable-line no-unused-vars + this.context.font = this.fontByStyle(style); + return this.context.measureText(text); + } + measureTextFont(text, font) {// eslint-disable-line no-unused-vars this.context.font = font; return this.context.measureText(text).width; @@ -39,7 +44,6 @@ export default class DrawHelper { let center = false; let space = 0; let j = 0; - const pad = this.fontSize/2; //формируем строку for (const part of line.parts) { let tOpen = ''; @@ -47,10 +51,20 @@ export default class DrawHelper { tOpen += (part.style.italic ? '' : ''); tOpen += (part.style.sup ? '' : ''); tOpen += (part.style.sub ? '' : ''); - tOpen += (part.style.note ? `` + - `__TEXT` : ''); + if (part.style.note) { + const t = part.text; + const m = this.measureTextMetrics(t, part.style); + const d = this.fontSize - 1.1*m.fontBoundingBoxAscent; + const w = m.width; + const size = (this.fontSize > 18 ? this.fontSize : 18); + const pad = size/2; + const btnW = (w >= size ? w : size) + pad*2; + + tOpen += `` + + ``; + } let tClose = ''; tClose += (part.style.note ? '' : ''); tClose += (part.style.sub ? '' : ''); @@ -70,9 +84,6 @@ export default class DrawHelper { if (text && text.trim() == '') text = `${text}`; - if (part.style.note) - tOpen = tOpen.replace('__TEXT', text); - lineText += `${tOpen}${text}${tClose}`; center = center || part.style.center; diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index bc890feb..4c069573 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -21,6 +21,7 @@ v-show="clickControl" ref="layoutEvents" class="layout events" oncontextmenu="return false;" @mousedown.prevent.stop="onMouseDown" @mouseup.prevent.stop="onMouseUp" + @mouseover.prevent.stop="onMouseEvent" @mouseout.prevent.stop="onMouseEvent" @mousemove.prevent.stop="onMouseEvent" @wheel.prevent.stop="onMouseWheel" @touchstart.stop="onTouchStart" @touchend.stop="onTouchEnd" @touchmove.stop="onTouchMove" @touchcancel.prevent.stop="onTouchCancel" > @@ -38,9 +39,9 @@ - +
@@ -49,7 +50,7 @@