@@ -11,7 +11,7 @@ let version_id = '7.4.0';
11
11
12
12
/** @summary version date
13
13
* @desc Release date in format day/month/year like '14/04/2022' */
14
- let version_date = '14 /06/2023';
14
+ let version_date = '15 /06/2023';
15
15
16
16
/** @summary version id and date
17
17
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -741,7 +741,13 @@ function parseMulti(json) {
741
741
* Or one can again parse json with {@link parse} function
742
742
* @param {object} obj - JavaScript object to convert
743
743
* @param {number} [spacing] - optional line spacing in JSON
744
- * @return {string} produced JSON code */
744
+ * @return {string} produced JSON code
745
+ * @example
746
+ * import { openFile, draw, toJSON } from 'https://root.cern/js/latest/modules/main.mjs';
747
+ * let file = await openFile('https://root.cern/js/files/hsimple.root');
748
+ * let obj = await file.readObject('hpxpy;1');
749
+ * obj.fTitle = 'New histogram title';
750
+ * let json = toJSON(obj); */
745
751
function toJSON(obj, spacing) {
746
752
if (!isObject(obj)) return '';
747
753
@@ -1024,7 +1030,7 @@ const prROOT = 'ROOT.', clTObject = 'TObject', clTNamed = 'TNamed', clTString =
1024
1030
* @desc Supported classes: `TObject`, `TNamed`, `TList`, `TAxis`, `TLine`, `TText`, `TLatex`, `TPad`, `TCanvas`
1025
1031
* @param {string} typename - ROOT class name
1026
1032
* @example
1027
- * import { create } from 'path_to_jsroot /modules/core.mjs';
1033
+ * import { create } from 'https://root.cern/js/latest /modules/core.mjs';
1028
1034
* let obj = create('TNamed');
1029
1035
* obj.fName = 'name';
1030
1036
* obj.fTitle = 'title'; */
@@ -8516,7 +8522,8 @@ function makeTranslate(x,y) {
8516
8522
return null;
8517
8523
}
8518
8524
8519
- /** @summary Configure special style used for highlight or dragging elements */
8525
+ /** @summary Configure special style used for highlight or dragging elements
8526
+ * @private */
8520
8527
function addHighlightStyle(elem, drag) {
8521
8528
if (drag)
8522
8529
elem.style('stroke', 'steelblue')
@@ -65324,7 +65331,7 @@ class StandaloneMenu extends JSRootMenu {
65324
65331
* @param {object} [handler] - object with handling function, in this case one not need to bind function
65325
65332
* @param {string} [menuname] - optional menu name
65326
65333
* @example
65327
- * import { createMenu } from 'path_to_jsroot /modules/gui/menu.mjs';
65334
+ * import { createMenu } from 'https://root.cern/js/latest /modules/gui/menu.mjs';
65328
65335
* let menu = await createMenu());
65329
65336
* menu.add('First', () => console.log('Click first'));
65330
65337
* let flag = true;
@@ -87482,7 +87489,7 @@ class TGeoPainter extends ObjectPainter {
87482
87489
exact = false;
87483
87490
}
87484
87491
87485
- this.findNodeWithVolume(regexp, function( arg) {
87492
+ this.findNodeWithVolume(regexp, arg => {
87486
87493
setInvisibleAll(arg.node.fVolume, (sign !== '+'));
87487
87494
return exact ? arg : null; // continue search if not exact expression provided
87488
87495
});
@@ -87918,11 +87925,10 @@ class TGeoPainter extends ObjectPainter {
87918
87925
mesh.getMatrixAt(i, item.matrix0);
87919
87926
item.minvert.copy(item.matrix0).invert();
87920
87927
87921
- let box3 = new Box3().copy(mesh.geometry.boundingBox).applyMatrix4(item.matrix0),
87922
- signz = 1; //mesh._flippedMesh ? -1 : 1;
87928
+ let box3 = new Box3().copy(mesh.geometry.boundingBox).applyMatrix4(item.matrix0);
87923
87929
87924
- item.vect0 = new Vector3((box3.max.x + box3.min.x) / 2, (box3.max.y + box3.min.y) / 2, signz * (box3.max.z + box3.min.z) / 2);// .applyMatrix4(item.matrix0 );
87925
- item.vect1 = new Vector3(0,0, 0).applyMatrix4(item.minvert);
87930
+ item.vect0 = new Vector3((box3.max.x + box3.min.x) / 2, (box3.max.y + box3.min.y) / 2, (box3.max.z + box3.min.z) / 2);
87931
+ item.vect1 = new Vector3(0, 0, 0).applyMatrix4(item.minvert);
87926
87932
}
87927
87933
}
87928
87934
@@ -88395,14 +88401,14 @@ class TGeoPainter extends ObjectPainter {
88395
88401
let wireframe = this.accessObjectWireFrame(obj);
88396
88402
88397
88403
if (wireframe !== undefined)
88398
- menu.addchk(wireframe, 'Wireframe', n, function( indx) {
88404
+ menu.addchk(wireframe, 'Wireframe', n, indx => {
88399
88405
let m = intersects[indx].object.material;
88400
88406
m.wireframe = !m.wireframe;
88401
88407
this.render3D();
88402
- });
88408
+ }, 'Toggle wireframe mode for the node' );
88403
88409
88404
88410
if (cnt > 1)
88405
- menu.add('Manifest', n, function( indx) {
88411
+ menu.add('Manifest', n, indx => {
88406
88412
88407
88413
if (this._last_manifest)
88408
88414
this._last_manifest.wireframe = !this._last_manifest.wireframe;
@@ -88422,15 +88428,15 @@ class TGeoPainter extends ObjectPainter {
88422
88428
this._last_manifest.wireframe = !this._last_manifest.wireframe;
88423
88429
88424
88430
this.render3D();
88425
- });
88431
+ }, 'Manifest selected node' );
88426
88432
88427
88433
88428
- menu.add('Focus', n, function( indx) {
88434
+ menu.add('Focus', n, indx => {
88429
88435
this.focusCamera(intersects[indx].object);
88430
88436
});
88431
88437
88432
88438
if (!this._geom_viewer) {
88433
- menu.add('Hide', n, function( indx) {
88439
+ menu.add('Hide', n, indx => {
88434
88440
let resolve = this._clones.resolveStack(intersects[indx].object.stack);
88435
88441
if (resolve.obj && (resolve.node.kind === kindGeo) && resolve.obj.fVolume) {
88436
88442
setGeoBit(resolve.obj.fVolume, geoBITS.kVisThis, false);
@@ -96476,7 +96482,7 @@ class TProxyFile extends TFile {
96476
96482
* @return {object} - Promise with {@link TFile} instance when file is opened
96477
96483
* @example
96478
96484
*
96479
- * import { openFile } from '/path_to_jsroot /modules/io.mjs';
96485
+ * import { openFile } from 'https://root.cern/js/latest /modules/io.mjs';
96480
96486
* let f = await openFile('https://root.cern/js/files/hsimple.root');
96481
96487
* console.log(`Open file ${f.getFileName()}`); */
96482
96488
function openFile(arg) {
@@ -99578,7 +99584,11 @@ function getDrawSettings(kind, selector) {
99578
99584
return res;
99579
99585
}
99580
99586
99581
- /** @summary Set default draw option for provided class */
99587
+ /** @summary Set default draw option for provided class
99588
+ * @example
99589
+ import { setDefaultDrawOpt } from 'https://root.cern/js/latest/modules/draw.mjs';
99590
+ setDefaultDrawOpt('TH1', 'text');
99591
+ setDefaultDrawOpt('TH2', 'col'); */
99582
99592
function setDefaultDrawOpt(classname, opt) {
99583
99593
let handle = getDrawHandle(prROOT + classname, 0);
99584
99594
if (handle)
@@ -99712,7 +99722,18 @@ async function draw(dom, obj, opt) {
99712
99722
* @return {Promise} with painter object
99713
99723
* @desc If drawing was not done before, it will be performed with {@link draw}.
99714
99724
* Otherwise drawing content will be updated
99715
- * @public */
99725
+ * @public
99726
+ * @example
99727
+ * import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
99728
+ * import { draw, redraw } from 'https://root.cern/js/latest/modules/draw.mjs';
99729
+ * let file = await openFile('https://root.cern/js/files/hsimple.root');
99730
+ * let obj = await file.readObject('hpxpy;1');
99731
+ * await draw('drawing', obj, 'colz');
99732
+ * let cnt = 0;
99733
+ * setInterval(() => {
99734
+ * obj.fTitle = `Next iteration ${cnt++}`;
99735
+ * redraw('drawing', obj, 'colz');
99736
+ * }, 1000); */
99716
99737
async function redraw(dom, obj, opt) {
99717
99738
99718
99739
if (!isObject(obj))
@@ -99821,8 +99842,8 @@ function addStreamerInfosForPainter(lst) {
99821
99842
* import { openFile, makeImage } from 'jsroot';
99822
99843
* let file = await openFile('https://root.cern/js/files/hsimple.root');
99823
99844
* let object = await file.readObject('hpxpy;1');
99824
- * let png64 = await makeImage({ format: 'png', object, option: 'lego2,pal67 ', width: 1200, height: 800 });
99825
- * let pngbuf = await makeImage({ format: 'png', as_buffer: true, object, option: 'lego2,pal67 ', width: 1200, height: 800 }); */
99845
+ * let png64 = await makeImage({ format: 'png', object, option: 'colz ', width: 1200, height: 800 });
99846
+ * let pngbuf = await makeImage({ format: 'png', as_buffer: true, object, option: 'colz ', width: 1200, height: 800 }); */
99826
99847
async function makeImage(args) {
99827
99848
if (!args) args = {};
99828
99849
@@ -103859,7 +103880,7 @@ function readStyleFromURL(url) {
103859
103880
* @param {String} gui_kind - either 'online', 'nobrowser', 'draw'
103860
103881
* @return {Promise} with {@link HierarchyPainter} instance
103861
103882
* @example
103862
- * import { buildGUI } from '/path_to_jsroot /modules/gui.mjs';
103883
+ * import { buildGUI } from 'https://root.cern/js/latest /modules/gui.mjs';
103863
103884
* buildGUI('guiDiv'); */
103864
103885
async function buildGUI(gui_element, gui_kind = '') {
103865
103886
let myDiv = select(isStr(gui_element) ? `#${gui_element}` : gui_element);
0 commit comments