Skip to content

Commit 70b43b6

Browse files
committed
build with internal svg2pdf.js
1 parent 34d56d2 commit 70b43b6

File tree

3 files changed

+56
-86
lines changed

3 files changed

+56
-86
lines changed

build/jsroot.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// https://root.cern/js/ v7.5.99
1+
// https://root.cern/js/ v7.6.1
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
44
typeof 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 = 'dev',
10+
const version_id = '7.6.x',
1111

1212
/** @summary version date
1313
* @desc Release date in format day/month/year like '14/04/2022' */
14-
version_date = '22/02/2024',
14+
version_date = '7/03/2024',
1515

1616
/** @summary version id and date
1717
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -10317,7 +10317,7 @@ async function svgToPDF(args, as_buffer) {
1031710317
let _jspdf, _svg2pdf, need_symbols = false;
1031810318

1031910319
const pr = nodejs
10320-
? Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }).then(h => { _jspdf = h; return Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }); }).then(h => { _svg2pdf = h.default; })
10320+
? Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }).then(h1 => { _jspdf = h1; return Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }); }).then(h2 => { _svg2pdf = h2; })
1032110321
: loadScript(exports.source_dir + 'scripts/jspdf.umd.min.js').then(() => loadScript(exports.source_dir + 'scripts/svg2pdf.umd.min.js')).then(() => { _jspdf = globalThis.jspdf; _svg2pdf = globalThis.svg2pdf; }),
1032210322
restore_fonts = [], restore_dominant = [], restore_text = [],
1032310323
node_transform = args.node.getAttribute('transform'), custom_fonts = {};
@@ -70513,12 +70513,11 @@ class TPavePainter extends ObjectPainter {
7051370513
const align = entry.fTextAlign || this.textatt.align,
7051470514
halign = Math.floor(align/10),
7051570515
valign = align % 10,
70516-
tsize = this.textatt.getAltSize(entry.fTextSize, pad_height),
7051770516
x = entry.fX ? entry.fX*width : (halign === 1 ? margin_x : (halign === 2 ? width / 2 : width - margin_x)),
70518-
y = entry.fY ? (1 - entry.fY)*height : (texty + (valign === 2 ? tsize / 2 : (valign === 3 ? tsize : 0))),
70517+
y = entry.fY ? (1 - entry.fY)*height : (texty + (valign === 2 ? stepy / 2 : (valign === 3 ? stepy : 0))),
7051970518
sub_g = text_g.append('svg:g');
7052070519

70521-
this.startTextDrawing(this.textatt.font, tsize, sub_g);
70520+
this.startTextDrawing(this.textatt.font, this.textatt.getAltSize(entry.fTextSize, pad_height), sub_g);
7052270521

7052370522
this.drawText({ align, x, y, text: entry.fTitle, color,
7052470523
latex: (entry._typename === clTText) ? 0 : 1, draw_g: sub_g, fast });
@@ -70527,7 +70526,7 @@ class TPavePainter extends ObjectPainter {
7052770526
} else {
7052870527
// default position
7052970528
if (num_default++ === 0)
70530-
this.startTextDrawing(this.textatt.font, height/(nlines * 1.2), text_g, max_font_size);
70529+
this.startTextDrawing(this.textatt.font, 0.85*height/nlines, text_g, max_font_size);
7053170530

7053270531
this.drawText({ x: margin_x, y: texty, width: width - 2*margin_x, height: stepy,
7053370532
align: entry.fTextAlign || this.textatt.align,
@@ -110920,8 +110919,10 @@ class TGraph2DPainter extends ObjectPainter {
110920110919
res.Triangles = 11; // wireframe and colors
110921110920
else if (d.check('TRI2'))
110922110921
res.Triangles = 10; // only color triangles
110923-
else if (d.check('TRIW') || d.check('TRI'))
110922+
else if (d.check('TRIW'))
110924110923
res.Triangles = 1;
110924+
else if (d.check('TRI'))
110925+
res.Triangles = 2;
110925110926
else
110926110927
res.Triangles = 0;
110927110928
res.Line = d.check('LINE');
@@ -111053,8 +111054,9 @@ class TGraph2DPainter extends ObjectPainter {
111053111054
if (!dulaunay) return;
111054111055

111055111056
const main_grz = !fp.logz ? fp.grz : value => (value < fp.scale_zmin) ? -0.1 : fp.grz(value),
111056-
do_faces = this.options.Triangles >= 10,
111057-
do_lines = this.options.Triangles % 10 === 1,
111057+
plain_mode = this.options.Triangles === 2,
111058+
do_faces = (this.options.Triangles >= 10) || plain_mode,
111059+
do_lines = (this.options.Triangles % 10 === 1) || (plain_mode && (graph.fLineColor !== graph.fFillColor)),
111058111060
triangles = new Triangles3DHandler(levels, main_grz, 0, 2*fp.size_z3d, do_lines);
111059111061

111060111062
for (triangles.loop = 0; triangles.loop < 2; ++triangles.loop) {
@@ -111088,8 +111090,8 @@ class TGraph2DPainter extends ObjectPainter {
111088111090

111089111091
triangles.callFuncs((lvl, pos) => {
111090111092
const geometry = createLegoGeom(this.getMainPainter(), pos, null, 100, 100),
111091-
color = palette.calcColor(lvl, levels.length),
111092-
material = new MeshBasicMaterial(getMaterialArgs(color, { side: DoubleSide, vertexColors: false })),
111093+
color = plain_mode ? this.getColor(graph.fFillColor) : palette.calcColor(lvl, levels.length),
111094+
material = new MeshBasicMaterial(getMaterialArgs(color, { side: DoubleSide, vertexColors: false })),
111093111095

111094111096
mesh = new Mesh(geometry, material);
111095111097

@@ -111200,7 +111202,7 @@ class TGraph2DPainter extends ObjectPainter {
111200111202

111201111203
scale *= 7 * Math.max(fp.size_x3d / fp.getFrameWidth(), fp.size_z3d / fp.getFrameHeight());
111202111204

111203-
if (this.options.Color || this.options.Triangles) {
111205+
if (this.options.Color || (this.options.Triangles >= 10)) {
111204111206
levels = main.getContourLevels(true);
111205111207
palette = main.getHistPalette();
111206111208
}

modules/core.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/** @summary version id
22
* @desc For the JSROOT release the string in format 'major.minor.patch' like '7.0.0' */
3-
const version_id = '7.6.0',
3+
const version_id = '7.6.x',
44

55
/** @summary version date
66
* @desc Release date in format day/month/year like '14/04/2022' */
7-
version_date = '23/02/2024',
7+
version_date = '7/03/2024',
88

99
/** @summary version id and date
1010
* @desc Produced by concatenation of {@link version_id} and {@link version_date}

0 commit comments

Comments
 (0)