From 74671861d07802b02f9152c06ad9cb1518d8c6ae Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Mon, 7 Oct 2024 13:14:52 +0200 Subject: [PATCH] Build with fsize fix --- build/jsroot.js | 47 ++++++++++++++++++++++++++++++----------------- modules/core.mjs | 2 +- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/build/jsroot.js b/build/jsroot.js index 54d924882..aa12f4b4c 100644 --- a/build/jsroot.js +++ b/build/jsroot.js @@ -12,7 +12,7 @@ const version_id = 'dev', /** @summary version date * @desc Release date in format day/month/year like '14/04/2022' */ -version_date = '2/10/2024', +version_date = '7/10/2024', /** @summary version id and date * @desc Produced by concatenation of {@link version_id} and {@link version_date} @@ -9790,13 +9790,13 @@ function approximateLabelWidth(label, font, fsize) { /** @summary array defines features supported by latex parser, used by both old and new parsers * @private */ const latex_features = [ - { name: '#it{' }, // italic - { name: '#bf{' }, // bold + { name: '#it{', bi: 'italic' }, // italic + { name: '#bf{', bi: 'bold' }, // bold { name: '#underline{', deco: 'underline' }, // underline { name: '#overline{', deco: 'overline' }, // overline { name: '#strike{', deco: 'line-through' }, // line through - { name: '#kern[', arg: 'float' }, // horizontal shift - { name: '#lower[', arg: 'float' }, // vertical shift + { name: '#kern[', arg: 'float', shift: 'x' }, // horizontal shift + { name: '#lower[', arg: 'float', shift: 'y' }, // vertical shift { name: '#scale[', arg: 'float' }, // font scale { name: '#color[', arg: 'int' }, // font color { name: '#font[', arg: 'int' }, // font face @@ -10132,7 +10132,7 @@ function parseLatex(node, arg, label, curr) { elem.attr('fill', curr.color || arg.color || null); // set font size directly to element to avoid complex control - if (curr.fisze !== curr.font.size) + if (curr.fsize !== curr.font.size) elem.attr('font-size', Math.round(curr.fsize)); if (curr.font?.isSymbol) { @@ -10417,16 +10417,18 @@ function parseLatex(node, arg, label, curr) { continue; } - if (found.name === '#bf{' || found.name === '#it{') { + if (found.bi) { // bold or italic const sublabel = extractSubLabel(); - if (sublabel === -1) return false; + if (sublabel === -1) + return false; const subpos = createSubPos(); - if (found.name === '#bf{') - subpos.bold = !subpos.bold; - else - subpos.italic = !subpos.italic; + let value; + for (let c = curr; c && (value === undefined && c); c = c.parent) + value = c[found.bi]; + + subpos[found.bi] = !value; parseLatex(currG(), arg, sublabel, subpos); @@ -10453,7 +10455,7 @@ function parseLatex(node, arg, label, curr) { label = label.slice(pos + 2); } - if ((found.name === '#kern[') || (found.name === '#lower[')) { + if (found.shift) { const sublabel = extractSubLabel(); if (sublabel === -1) return false; @@ -10462,9 +10464,12 @@ function parseLatex(node, arg, label, curr) { parseLatex(currG(), arg, sublabel, subpos); let shiftx = 0, shifty = 0; - if (found.name === 'kern[') shiftx = foundarg; else shifty = foundarg; + if (found.shift === 'x') + shiftx = foundarg * subpos.rect.width; + else + shifty = foundarg * subpos.rect.height; - positionGNode(subpos, curr.x + shiftx * subpos.rect.width, curr.y + shifty * subpos.rect.height); + positionGNode(subpos, curr.x + shiftx, curr.y + shifty); shiftX(subpos.rect.width * (shiftx > 0 ? 1 + foundarg : 1)); @@ -10479,6 +10484,11 @@ function parseLatex(node, arg, label, curr) { subpos = createSubPos(); gg.attr('href', foundarg); + if (!isBatchMode()) { + gg.on('mouseenter', () => gg.style('text-decoration', 'underline')) + .on('mouseleave', () => gg.style('text-decoration', null)) + .append('svg:title').text(`link on ${foundarg}`); + } parseLatex(gg, arg, sublabel, subpos); @@ -147115,8 +147125,11 @@ async function drawText$1() { fact = 0.8; } - if (is_url) - this.draw_g.attr('href', text.fName).append('title').text(`Link on ${text.fName}`); + if (is_url) { + this.draw_g.attr('href', text.fName); + if (!this.isBatchMode()) + this.draw_g.append('svg:title').text(`link on ${text.fName}`); + } return this.startTextDrawingAsync(this.textatt.font, this.textatt.getSize(w, h, fact, 0.05)) .then(() => this.drawText(arg)) diff --git a/modules/core.mjs b/modules/core.mjs index 13c73eef3..9cf31e69e 100644 --- a/modules/core.mjs +++ b/modules/core.mjs @@ -4,7 +4,7 @@ const version_id = 'dev', /** @summary version date * @desc Release date in format day/month/year like '14/04/2022' */ -version_date = '2/10/2024', +version_date = '7/10/2024', /** @summary version id and date * @desc Produced by concatenation of {@link version_id} and {@link version_date}