|
@@ -44,36 +44,26 @@ 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 text = '';
|
|
|
- if (lineIndex == 0 && this.searching) {
|
|
|
- for (let k = 0; k < part.text.length; k++) {
|
|
|
- text += (sel.has(j) ? `<ins>${part.text[k]}</ins>` : part.text[k]);
|
|
|
- j++;
|
|
|
- }
|
|
|
- } else
|
|
|
- text = part.text;
|
|
|
-
|
|
|
- if (text && text.trim() == '')
|
|
|
- text = `<span style="white-space: pre">${text}</span>`;
|
|
|
-
|
|
|
let tOpen = '';
|
|
|
tOpen += (part.style.bold ? '<b>' : '');
|
|
|
tOpen += (part.style.italic ? '<i>' : '');
|
|
|
tOpen += (part.style.sup ? '<span style="vertical-align: baseline; position: relative; line-height: 0; top: -0.3em">' : '');
|
|
|
tOpen += (part.style.sub ? '<span style="vertical-align: baseline; position: relative; line-height: 0; top: 0.3em">' : '');
|
|
|
if (part.style.note) {
|
|
|
- const m = this.measureTextMetrics(text, part.style);
|
|
|
+ const t = part.text;
|
|
|
+ const m = this.measureTextMetrics(t, part.style);
|
|
|
const d = this.fontSize - 1.1*m.fontBoundingBoxAscent;
|
|
|
const w = m.width;
|
|
|
- const btnW = (w >= this.fontSize ? w : this.fontSize) + pad*2;
|
|
|
+ const size = (this.fontSize > 18 ? this.fontSize : 18);
|
|
|
+ const pad = size/2;
|
|
|
+ const btnW = (w >= size ? w : size) + pad*2;
|
|
|
|
|
|
tOpen += `<span style="position: relative;">` +
|
|
|
`<span style="position: absolute; background-color: ${this.textColor}; opacity: 0.1; cursor: pointer; pointer-events: auto; ` +
|
|
|
- `height: ${this.fontSize + pad*2}px; padding: ${pad}px; left: -${(btnW - w)/2 - pad*0.05}px; top: -${pad + d}px; width: ${btnW}px; border-radius: ${this.fontSize}px;" ` +
|
|
|
- `onclick="onNoteClickLiberama('${part.style.note.id}', ${part.style.note.orig ? 1 : 0})"><span style="visibility: hidden;" class="dborder">${text}</span></span>`;
|
|
|
+ `height: ${this.fontSize + pad*2}px; padding: ${pad}px; left: -${(btnW - w)/2 - pad*0.05}px; top: -${pad + d}px; width: ${btnW}px; border-radius: ${size}px;" ` +
|
|
|
+ `onclick="onNoteClickLiberama('${part.style.note.id}', ${part.style.note.orig ? 1 : 0})"><span style="visibility: hidden;" class="dborder">${t}</span></span>`;
|
|
|
}
|
|
|
let tClose = '';
|
|
|
tClose += (part.style.note ? '</span>' : '');
|
|
@@ -82,6 +72,18 @@ export default class DrawHelper {
|
|
|
tClose += (part.style.italic ? '</i>' : '');
|
|
|
tClose += (part.style.bold ? '</b>' : '');
|
|
|
|
|
|
+ let text = '';
|
|
|
+ if (lineIndex == 0 && this.searching) {
|
|
|
+ for (let k = 0; k < part.text.length; k++) {
|
|
|
+ text += (sel.has(j) ? `<ins>${part.text[k]}</ins>` : part.text[k]);
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ text = part.text;
|
|
|
+
|
|
|
+ if (text && text.trim() == '')
|
|
|
+ text = `<span style="white-space: pre">${text}</span>`;
|
|
|
+
|
|
|
lineText += `${tOpen}${text}${tClose}`;
|
|
|
|
|
|
center = center || part.style.center;
|