1- // https://root.cern/js/ v7.7.3
1+ // https://root.cern/js/ v7.7.4
22(function (global, factory) {
33typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
44typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -7,11 +7,11 @@ typeof define === 'function' && define.amd ? define(['exports'], factory) :
77
88/** @summary version id
99 * @desc For the JSROOT release the string in format 'major.minor.patch' like '7.0.0' */
10- const version_id = '7.7.3 ',
10+ const version_id = '7.7.x ',
1111
1212/** @summary version date
1313 * @desc Release date in format day/month/year like '14/04/2022' */
14- version_date = '23/08 /2024',
14+ version_date = '24/09 /2024',
1515
1616/** @summary version id and date
1717 * @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -2601,7 +2601,7 @@ function compareValue(compare) {
26012601}
26022602
26032603function chord() {
2604- return chord$1(false, false );
2604+ return chord$1(false);
26052605}
26062606
26072607function chord$1(directed, transpose) {
@@ -2618,9 +2618,7 @@ function chord$1(directed, transpose) {
26182618 groups = new Array(n),
26192619 k = 0, dx;
26202620
2621- matrix = Float64Array.from({length: n * n}, transpose
2622- ? (_, i) => matrix[i % n][i / n | 0]
2623- : (_, i) => matrix[i / n | 0][i % n]);
2621+ matrix = Float64Array.from({length: n * n}, (_, i) => matrix[i / n | 0][i % n]);
26242622
26252623 // Compute the scaling factor from value to angle in [0, 2pi].
26262624 for (let i = 0; i < n; ++i) {
@@ -2637,20 +2635,7 @@ function chord$1(directed, transpose) {
26372635 if (sortGroups) groupIndex.sort((a, b) => sortGroups(groupSums[a], groupSums[b]));
26382636 for (const i of groupIndex) {
26392637 const x0 = x;
2640- if (directed) {
2641- const subgroupIndex = range$1(~n + 1, n).filter(j => j < 0 ? matrix[~j * n + i] : matrix[i * n + j]);
2642- if (sortSubgroups) subgroupIndex.sort((a, b) => sortSubgroups(a < 0 ? -matrix[~a * n + i] : matrix[i * n + a], b < 0 ? -matrix[~b * n + i] : matrix[i * n + b]));
2643- for (const j of subgroupIndex) {
2644- if (j < 0) {
2645- const chord = chords[~j * n + i] || (chords[~j * n + i] = {source: null, target: null});
2646- chord.target = {index: i, startAngle: x, endAngle: x += matrix[~j * n + i] * k, value: matrix[~j * n + i]};
2647- } else {
2648- const chord = chords[i * n + j] || (chords[i * n + j] = {source: null, target: null});
2649- chord.source = {index: i, startAngle: x, endAngle: x += matrix[i * n + j] * k, value: matrix[i * n + j]};
2650- }
2651- }
2652- groups[i] = {index: i, startAngle: x0, endAngle: x, value: groupSums[i]};
2653- } else {
2638+ {
26542639 const subgroupIndex = range$1(0, n).filter(j => matrix[i * n + j] || matrix[j * n + i]);
26552640 if (sortSubgroups) subgroupIndex.sort((a, b) => sortSubgroups(matrix[i * n + a], matrix[i * n + b]));
26562641 for (const j of subgroupIndex) {
@@ -2920,12 +2905,7 @@ function ribbon(headRadius) {
29202905 context.moveTo(sr * cos$1(sa0), sr * sin$1(sa0));
29212906 context.arc(0, 0, sr, sa0, sa1);
29222907 if (sa0 !== ta0 || sa1 !== ta1) {
2923- if (headRadius) {
2924- var hr = +headRadius.apply(this, arguments), tr2 = tr - hr, ta2 = (ta0 + ta1) / 2;
2925- context.quadraticCurveTo(0, 0, tr2 * cos$1(ta0), tr2 * sin$1(ta0));
2926- context.lineTo(tr * cos$1(ta2), tr * sin$1(ta2));
2927- context.lineTo(tr2 * cos$1(ta1), tr2 * sin$1(ta1));
2928- } else {
2908+ {
29292909 context.quadraticCurveTo(0, 0, tr * cos$1(ta0), tr * sin$1(ta0));
29302910 context.arc(0, 0, tr, ta0, ta1);
29312911 }
@@ -2936,10 +2916,6 @@ function ribbon(headRadius) {
29362916 if (buffer) return context = null, buffer + "" || null;
29372917 }
29382918
2939- if (headRadius) ribbon.headRadius = function(_) {
2940- return arguments.length ? (headRadius = typeof _ === "function" ? _ : constant$4(+_), ribbon) : headRadius;
2941- };
2942-
29432919 ribbon.radius = function(_) {
29442920 return arguments.length ? (sourceRadius = targetRadius = typeof _ === "function" ? _ : constant$4(+_), ribbon) : sourceRadius;
29452921 };
@@ -8016,6 +7992,11 @@ class FontHandler {
80167992 this.painter = painter;
80177993 }
80187994
7995+ /** @summary Force setting of style and weight, used in latex */
7996+ setUseFullStyle(flag) {
7997+ this.full_style = flag;
7998+ }
7999+
80198000 /** @summary Assigns font-related attributes */
80208001 addCustomFontToSvg(svg) {
80218002 if (!this.base64 || !this.name)
@@ -8042,8 +8023,8 @@ class FontHandler {
80428023 selection.attr('font-family', this.name)
80438024 .attr('font-size', this.size)
80448025 .attr('xml:space', 'preserve')
8045- .attr('font-weight', this.weight || null)
8046- .attr('font-style', this.style || null);
8026+ .attr('font-weight', this.weight || (this.full_style ? 'normal' : null) )
8027+ .attr('font-style', this.style || (this.full_style ? 'normal' : null) );
80478028 }
80488029
80498030 /** @summary Set font size (optional) */
@@ -9057,6 +9038,7 @@ function parseLatex(node, arg, label, curr) {
90579038 subpos.color = curr.painter.getColor(foundarg);
90589039 else if (found.name === '#font[') {
90599040 subpos.font = new FontHandler(foundarg);
9041+ subpos.font.setUseFullStyle(true); // while embedding - need to enforce full style
90609042 subpos.ufont = true; // mark that custom font is applied
90619043 } else
90629044 subpos.fsize *= foundarg;
@@ -9821,7 +9803,7 @@ function createDefaultPalette(grayscale) {
98219803 if (t < 2 / 3) return p + (q - p) * (2/3 - t) * 6;
98229804 return p;
98239805 }, HLStoRGB = (h, l, s) => {
9824- const q = (l < 0.5) ? l * (1 + s) : l + s - l * s,
9806+ const q = l + s - l * s,
98259807 p = 2 * l - q,
98269808 r = hue2rgb(p, q, h + 1/3),
98279809 g = hue2rgb(p, q, h),
@@ -56033,13 +56015,6 @@ function getMaterialArgs(color$1, args) {
5603356015}
5603456016
5603556017function createSVGRenderer(as_is, precision, doc) {
56036- if (as_is) {
56037- if (doc !== undefined)
56038- globalThis.docuemnt = doc;
56039- const rndr = new SVGRenderer();
56040- rndr.setPrecision(precision);
56041- return rndr;
56042- }
5604356018
5604456019 const excl_style1 = ';stroke-opacity:1;stroke-width:1;stroke-linecap:round',
5604556020 excl_style2 = ';fill-opacity:1',
@@ -56443,7 +56418,7 @@ async function createRender3D(width, height, render3d, args) {
5644356418
5644456419 if (render3d === rc.SVG) {
5644556420 // SVG rendering
56446- const r = createSVGRenderer(false, 0, doc );
56421+ const r = createSVGRenderer(false, 0);
5644756422 r.jsroot_dom = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
5644856423 promise = Promise.resolve(r);
5644956424 } else if (isNodeJs()) {
@@ -61705,14 +61680,14 @@ class StandaloneMenu extends JSRootMenu {
6170561680 * menu.addchk(flag, 'Checked', arg => console.log(`Now flag is ${arg}`));
6170661681 * menu.show(); */
6170761682function createMenu(evnt, handler, menuname) {
61708- const menu = new StandaloneMenu(handler, menuname || 'root_ctx_menu', evnt);
61683+ const menu = new StandaloneMenu(handler, 'root_ctx_menu', evnt);
6170961684 return menu.load();
6171061685}
6171161686
6171261687/** @summary Close previousely created and shown JSROOT menu
6171361688 * @param {string} [menuname] - optional menu name */
6171461689function closeMenu(menuname) {
61715- const element = getDocument().getElementById(menuname || 'root_ctx_menu');
61690+ const element = getDocument().getElementById('root_ctx_menu');
6171661691 element?.remove();
6171761692 return !!element;
6171861693}
@@ -63030,7 +63005,7 @@ class TAxisPainter extends ObjectPainter {
6303063005 .style('cursor', 'crosshair');
6303163006
6303263007 if (this.vertical) {
63033- const rw = (labelsMaxWidth || 2*labelSize) + 3;
63008+ const rw = Math.max (labelsMaxWidth, 2*labelSize) + 3;
6303463009 r.attr('x', (side > 0) ? -rw : 0).attr('y', 0)
6303563010 .attr('width', rw).attr('height', h);
6303663011 } else {
@@ -70034,15 +70009,23 @@ class TPadPainter extends ObjectPainter {
7003470009 btns.remove();
7003570010 }
7003670011
70037- const main = pp.getFramePainter();
70038- if (!isFunc(main?.render3D) || !isFunc(main ?.access3dKind)) return;
70012+ const fp = pp.getFramePainter();
70013+ if (!isFunc(fp ?.access3dKind)) return;
7003970014
70040- const can3d = main .access3dKind();
70015+ const can3d = fp .access3dKind();
7004170016 if ((can3d !== constants$1.Embed3D.Overlay) && (can3d !== constants$1.Embed3D.Embed)) return;
7004270017
70043- const sz2 = main.getSizeFor3d(constants$1.Embed3D.Embed), // get size and position of DOM element as it will be embed
70018+ let main, canvas;
70019+ if (isFunc(fp.render3D)) {
70020+ main = fp;
70021+ canvas = fp.renderer?.domElement;
70022+ } else {
70023+ main = fp.getMainPainter();
70024+ canvas = main?._renderer?.domElement;
70025+ }
70026+ if (!isFunc(main?.render3D) || !isObject(canvas)) return;
7004470027
70045- canvas = main.renderer.domElement;
70028+ const sz2 = fp.getSizeFor3d(constants$1.Embed3D.Embed); // get size and position of DOM element as it will be embed
7004670029 main.render3D(0); // WebGL clears buffers, therefore we should render scene and convert immediately
7004770030 const dataUrl = canvas.toDataURL('image/png');
7004870031
@@ -79024,7 +79007,7 @@ function render3D(tmout) {
7902479007 if (tmout === -1111) {
7902579008 // special handling for direct SVG renderer
7902679009 const doc = getDocument(),
79027- rrr = createSVGRenderer(false, 0, doc );
79010+ rrr = createSVGRenderer(false, 0);
7902879011 rrr.setSize(this.scene_width, this.scene_height);
7902979012 rrr.render(this.scene, this.camera);
7903079013 if (rrr.makeOuterHTML) {
@@ -106406,7 +106389,7 @@ class HierarchyPainter extends BasePainter {
106406106389 async listServerDir(dirname) {
106407106390 return httpRequest(dirname, 'text').then(res => {
106408106391 if (!res) return false;
106409- const h = { _name: 'Files', _kind: kTopFolder, _childs: [], _isopen: true };
106392+ const h = { _name: 'Files', _kind: kTopFolder, _childs: [], _isopen: true }, fmap = {} ;
106410106393 let p = 0;
106411106394 while (p < res.length) {
106412106395 p = res.indexOf('a href="', p+1);
@@ -106417,6 +106400,10 @@ class HierarchyPainter extends BasePainter {
106417106400
106418106401 const fname = res.slice(p, p2);
106419106402 p = p2 + 1;
106403+
106404+ if (fmap[fname]) continue;
106405+ fmap[fname] = true;
106406+
106420106407 if ((fname.lastIndexOf('.root') === fname.length - 5) && (fname.length > 5)) {
106421106408 h._childs.push({
106422106409 _name: fname, _title: dirname + fname, _url: dirname + fname, _kind: kindTFile,
@@ -108711,6 +108698,11 @@ let TGraphPainter$1 = class TGraphPainter extends ObjectPainter {
108711108698 let uxmin = xmin - dx, uxmax = xmax + dx,
108712108699 minimum = ymin - dy, maximum = ymax + dy;
108713108700
108701+ if ((ymin > 0) && (minimum <= 0))
108702+ minimum = (1 - margin) * ymin;
108703+ if ((ymax < 0) && (maximum >= 0))
108704+ maximum = (1 - margin) * ymax;
108705+
108714108706 if (!this._not_adjust_hrange) {
108715108707 const pad_logx = this.getPadPainter()?.getPadLog('x');
108716108708
@@ -108736,7 +108728,10 @@ let TGraphPainter$1 = class TGraphPainter extends ObjectPainter {
108736108728
108737108729 if (graph.fMinimum !== kNoZoom) minimum = ymin = graph.fMinimum;
108738108730 if (graph.fMaximum !== kNoZoom) maximum = graph.fMaximum;
108739- if ((minimum < 0) && (ymin >= 0)) minimum = (1 - margin)*ymin;
108731+ if ((minimum < 0) && (ymin >= 0))
108732+ minimum = (1 - margin)*ymin;
108733+ if ((ymax < 0) && (maximum >= 0))
108734+ maximum = (1 - margin) * ymax;
108740108735
108741108736 setHistogramTitle(histo, this.getObject().fTitle);
108742108737
@@ -110152,7 +110147,7 @@ TDrawSelector.prototype.ShowProgress = function(value) {
110152110147 msg = `TTree draw ${(value * 100).toFixed(ndig)} % `;
110153110148 }
110154110149
110155- showProgress(msg, -1 , () => { this._break = 1; });
110150+ showProgress(msg, 0 , () => { this._break = 1; });
110156110151 return ret;
110157110152};
110158110153
@@ -120891,7 +120886,7 @@ class Sha256 {
120891120886function sha256(message, as_hex) {
120892120887 const m = new Sha256(false);
120893120888 m.update(message);
120894- return as_hex ? m.hex() : m.digest();
120889+ return m.digest();
120895120890}
120896120891
120897120892function sha256_2(message, arr, as_hex) {
0 commit comments