Skip to content

Commit 5eb6b8e

Browse files
committed
Build with last edits
1 parent c532f7f commit 5eb6b8e

File tree

2 files changed

+53
-38
lines changed

2 files changed

+53
-38
lines changed

build/jsroot.js

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const version_id = 'dev',
1212

1313
/** @summary version date
1414
* @desc Release date in format day/month/year like '14/04/2022' */
15-
version_date = '14/02/2025',
15+
version_date = '17/02/2025',
1616

1717
/** @summary version id and date
1818
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -9249,33 +9249,38 @@ async function svgToImage(svg, image_format, args) {
92499249

92509250
// required with df104.py/df105.py example with RCanvas or any special symbols in TLatex
92519251
const doctype = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
9252-
svg = encodeURIComponent(doctype + svg);
9253-
svg = svg.replace(/%([0-9A-F]{2})/g, (match, p1) => {
9254-
const c = String.fromCharCode('0x'+p1);
9255-
return c === '%' ? '%25' : c;
9256-
});
9257-
9258-
// Cannot use prSVG because of some special cases like RCanvas/rh2
9259-
const img_src = 'data:image/svg+xml;base64,' + btoa_func(decodeURIComponent(svg));
92609252

92619253
if (isNodeJs()) {
9254+
svg = encodeURIComponent(doctype + svg);
9255+
svg = svg.replace(/%([0-9A-F]{2})/g, (match, p1) => {
9256+
const c = String.fromCharCode('0x'+p1);
9257+
return c === '%' ? '%25' : c;
9258+
});
9259+
9260+
const img_src = 'data:image/svg+xml;base64,' + btoa_func(decodeURIComponent(svg));
9261+
92629262
return Promise.resolve().then(function () { return _rollup_plugin_ignore_empty_module_placeholder$1; }).then(async handle => {
92639263
return handle.default.loadImage(img_src).then(img => {
92649264
const canvas = handle.default.createCanvas(img.width, img.height);
92659265

92669266
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
92679267

9268-
if (args?.as_buffer) return canvas.toBuffer('image/' + image_format);
9268+
if (args?.as_buffer)
9269+
return canvas.toBuffer('image/' + image_format);
92699270

92709271
return image_format ? canvas.toDataURL('image/' + image_format) : canvas;
92719272
});
92729273
});
92739274
}
92749275

9276+
const img_src = URL.createObjectURL(new Blob([doctype + svg], { type: 'image/svg+xml;charset=utf-8' }));
9277+
92759278
return new Promise(resolveFunc => {
92769279
const image = document.createElement('img');
92779280

92789281
image.onload = function() {
9282+
URL.revokeObjectURL(img_src);
9283+
92799284
const canvas = document.createElement('canvas');
92809285
canvas.width = image.width;
92819286
canvas.height = image.height;
@@ -9288,11 +9293,12 @@ async function svgToImage(svg, image_format, args) {
92889293
resolveFunc(image_format ? canvas.toDataURL('image/' + image_format) : canvas);
92899294
};
92909295
image.onerror = function(arg) {
9296+
URL.revokeObjectURL(img_src);
92919297
console.log(`IMAGE ERROR ${arg}`);
92929298
resolveFunc(null);
92939299
};
92949300

9295-
image.src = img_src;
9301+
image.setAttribute('src', img_src);
92969302
});
92979303
}
92989304

@@ -13822,12 +13828,15 @@ class ObjectPainter extends BasePainter {
1382213828
* @param {Object} evnt - object with clientX and clientY positions
1382313829
* @private */
1382413830
getToolTip(evnt) {
13825-
if ((evnt?.clientX === undefined) || (evnt?.clientY === undefined)) return null;
13831+
if ((evnt?.clientX === undefined) || (evnt?.clientY === undefined))
13832+
return null;
1382613833

1382713834
const frame = this.getFrameSvg();
13828-
if (frame.empty()) return null;
13835+
if (frame.empty())
13836+
return null;
1382913837
const layer = frame.selectChild('.main_layer');
13830-
if (layer.empty()) return null;
13838+
if (layer.empty())
13839+
return null;
1383113840

1383213841
const pos = pointer(evnt, layer.node()),
1383313842
pnt = { touch: false, x: pos[0], y: pos[1] };
@@ -71088,13 +71097,13 @@ class TPadPainter extends ObjectPainter {
7108871097
if (this.painters.indexOf(objpainter) < 0)
7108971098
this.painters.push(objpainter);
7109071099

71091-
objpainter.snapid = lst[indx].fObjectID;
71100+
objpainter.assignSnapId(lst[indx].fObjectID);
7109271101
const setSubSnaps = p => {
7109371102
if (!p.getUniqueId(true)) return;
7109471103
for (let k = 0; k < this.painters.length; ++k) {
7109571104
const sub = this.painters[k];
7109671105
if (sub.isSecondary(p) && sub.getSecondaryId()) {
71097-
sub.snapid = p.snapid + '#' + sub.getSecondaryId();
71106+
sub.assignSnapId(p.snapid + '#' + sub.getSecondaryId());
7109871107
setSubSnaps(sub);
7109971108
}
7110071109
}
@@ -71234,7 +71243,7 @@ class TPadPainter extends ObjectPainter {
7123471243
const padpainter = new TPadPainter(this, subpad, false);
7123571244
padpainter.decodeOptions(snap.fOption);
7123671245
padpainter.addToPadPrimitives();
71237-
padpainter.snapid = snap.fObjectID;
71246+
padpainter.assignSnapId(snap.fObjectID);
7123871247
padpainter.is_active_pad = !!snap.fActive; // enforce boolean flag
7123971248
padpainter._readonly = snap.fReadOnly ?? false; // readonly flag
7124071249
padpainter._snap_primitives = snap.fPrimitives; // keep list to be able find primitive
@@ -71316,7 +71325,7 @@ class TPadPainter extends ObjectPainter {
7131671325
if (this.snapid === undefined) {
7131771326
// first time getting snap, create all gui elements first
7131871327

71319-
this.snapid = snap.fObjectID;
71328+
this.assignSnapId(snap.fObjectID);
7132071329

7132171330
this.assignObject(first);
7132271331
this.pad = first; // first object is pad
@@ -81605,7 +81614,7 @@ function drawXYZ(toplevel, AxisPainter, opts) {
8160581614
this.x_handle = new AxisPainter(null, this.xaxis);
8160681615
if (opts.v7) {
8160781616
this.x_handle.pad_name = this.pad_name;
81608-
this.x_handle.snapid = this.snapid;
81617+
this.x_handle.assignSnapId(this.snapid);
8160981618
} else if (opts.hist_painter)
8161081619
this.x_handle.setHistPainter(opts.hist_painter, 'x');
8161181620

@@ -81617,7 +81626,7 @@ function drawXYZ(toplevel, AxisPainter, opts) {
8161781626
this.y_handle = new AxisPainter(null, this.yaxis);
8161881627
if (opts.v7) {
8161981628
this.y_handle.pad_name = this.pad_name;
81620-
this.y_handle.snapid = this.snapid;
81629+
this.y_handle.assignSnapId(this.snapid);
8162181630
} else if (opts.hist_painter)
8162281631
this.y_handle.setHistPainter(opts.hist_painter, 'y');
8162381632
this.y_handle.configureAxis('yaxis', this.ymin, this.ymax, ymin, ymax, false, [grminy, grmaxy],
@@ -81628,7 +81637,7 @@ function drawXYZ(toplevel, AxisPainter, opts) {
8162881637
this.z_handle = new AxisPainter(null, this.zaxis);
8162981638
if (opts.v7) {
8163081639
this.z_handle.pad_name = this.pad_name;
81631-
this.z_handle.snapid = this.snapid;
81640+
this.z_handle.assignSnapId(this.snapid);
8163281641
} else if (opts.hist_painter)
8163381642
this.z_handle.setHistPainter(opts.hist_painter, 'z');
8163481643
this.z_handle.configureAxis('zaxis', this.zmin, this.zmax, zmin, zmax, false, [grminz, grmaxz],
@@ -147830,17 +147839,20 @@ class HierarchyPainter extends BasePainter {
147830147839

147831147840
getOptionAsArray = opt => {
147832147841
let res = getUrlOptionAsArray(opt);
147833-
if (res.length > 0 || !gui_div || gui_div.empty()) return res;
147842+
if (res.length > 0 || !gui_div || gui_div.empty())
147843+
return res;
147834147844
while (opt) {
147835147845
const separ = opt.indexOf(';');
147836147846
let part = separ > 0 ? opt.slice(0, separ) : opt;
147837-
if (separ > 0) opt = opt.slice(separ+1); else opt = '';
147847+
opt = separ > 0 ? opt.slice(separ+1) : '';
147838147848

147839147849
let canarray = true;
147840-
if (part[0] === '#') { part = part.slice(1); canarray = false; }
147841-
if (part === 'files') continue; // special case for normal UI
147842-
147843-
if (!gui_div.node().hasAttribute(part)) continue;
147850+
if (part[0] === '#') {
147851+
part = part.slice(1);
147852+
canarray = false;
147853+
}
147854+
if (part === 'files' || !gui_div.node().hasAttribute(part))
147855+
continue;
147844147856

147845147857
const val = gui_div.attr(part);
147846147858

@@ -148097,7 +148109,8 @@ class HierarchyPainter extends BasePainter {
148097148109
* @desc works only when inspector or streamer info is displayed
148098148110
* @private */
148099148111
redrawObject(obj) {
148100-
if (!this._inspector && !this._streamer_info) return false;
148112+
if (!this._inspector && !this._streamer_info)
148113+
return false;
148101148114
if (this._streamer_info)
148102148115
this.h = createStreamerInfoContent(obj);
148103148116
else
@@ -158144,6 +158157,8 @@ const kNormal = 1, /* kLessTraffic = 2, */ kOffline = 3;
158144158157

158145158158
class RObjectPainter extends ObjectPainter {
158146158159

158160+
#pending_request;
158161+
158147158162
constructor(dom, obj, opt, csstype) {
158148158163
super(dom, obj, opt);
158149158164
this.csstype = csstype;
@@ -158452,7 +158467,7 @@ class RObjectPainter extends ObjectPainter {
158452158467
// special situation when snapid not yet assigned - just keep ref until snapid is there
158453158468
// maybe keep full list - for now not clear if really needed
158454158469
if (!this.snapid) {
158455-
this._pending_request = { kind, req, method };
158470+
this.#pending_request = { kind, req, method };
158456158471
return req;
158457158472
}
158458158473

@@ -158463,10 +158478,10 @@ class RObjectPainter extends ObjectPainter {
158463158478
* @desc Overwrite default method */
158464158479
assignSnapId(id) {
158465158480
this.snapid = id;
158466-
if (this.snapid && this._pending_request) {
158467-
const p = this._pending_request;
158481+
if (this.snapid && this.#pending_request) {
158482+
const p = this.#pending_request;
158483+
this.#pending_request = undefined;
158468158484
this.v7SubmitRequest(p.kind, p.req, p.method);
158469-
delete this._pending_request;
158470158485
}
158471158486
}
158472158487

@@ -159945,17 +159960,17 @@ class RFramePainter extends RObjectPainter {
159945159960
this.recalculateRange(0);
159946159961

159947159962
this.x_handle = new RAxisPainter(pp, this, this.xaxis, 'x_');
159948-
this.x_handle.snapid = this.snapid;
159963+
this.x_handle.assignSnapId(this.snapid);
159949159964
this.x_handle.draw_swapside = (sidex < 0);
159950159965
this.x_handle.draw_ticks = ticksx;
159951159966

159952159967
this.y_handle = new RAxisPainter(pp, this, this.yaxis, 'y_');
159953-
this.y_handle.snapid = this.snapid;
159968+
this.y_handle.assignSnapId(this.snapid);
159954159969
this.y_handle.draw_swapside = (sidey < 0);
159955159970
this.y_handle.draw_ticks = ticksy;
159956159971

159957159972
this.z_handle = new RAxisPainter(pp, this, this.zaxis, 'z_');
159958-
this.z_handle.snapid = this.snapid;
159973+
this.z_handle.assignSnapId(this.snapid);
159959159974

159960159975
this.x_handle.configureAxis('xaxis', this.xmin, this.xmax, this.scale_xmin, this.scale_xmax, false, [0, w], w, { reverse: false });
159961159976
this.x_handle.assignFrameMembers(this, 'x');
@@ -160039,7 +160054,7 @@ class RFramePainter extends RObjectPainter {
160039160054
this.scale_x2max = this.x2max;
160040160055
}
160041160056
this.x2_handle = new RAxisPainter(pp, this, this.x2axis, 'x2_');
160042-
this.x2_handle.snapid = this.snapid;
160057+
this.x2_handle.assignSnapId(this.snapid);
160043160058

160044160059
this.x2_handle.configureAxis('x2axis', this.x2min, this.x2max, this.scale_x2min, this.scale_x2max, false, [0, w], w, { reverse: false });
160045160060
this.x2_handle.assignFrameMembers(this, 'x2');
@@ -160057,7 +160072,7 @@ class RFramePainter extends RObjectPainter {
160057160072
}
160058160073

160059160074
this.y2_handle = new RAxisPainter(pp, this, this.y2axis, 'y2_');
160060-
this.y2_handle.snapid = this.snapid;
160075+
this.y2_handle.assignSnapId(this.snapid);
160061160076

160062160077
this.y2_handle.configureAxis('y2axis', this.y2min, this.y2max, this.scale_y2min, this.scale_y2max, true, [h, 0], -h, { reverse: false });
160063160078
this.y2_handle.assignFrameMembers(this, 'y2');

modules/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const version_id = 'dev',
44

55
/** @summary version date
66
* @desc Release date in format day/month/year like '14/04/2022' */
7-
version_date = '14/02/2025',
7+
version_date = '17/02/2025',
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)