@@ -11,7 +11,7 @@ let version_id = '7.4.0';
1111
1212/** @summary version date
1313 * @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';
1515
1616/** @summary version id and date
1717 * @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -741,7 +741,13 @@ function parseMulti(json) {
741741 * Or one can again parse json with {@link parse} function
742742 * @param {object} obj - JavaScript object to convert
743743 * @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); */
745751function toJSON(obj, spacing) {
746752 if (!isObject(obj)) return '';
747753
@@ -1024,7 +1030,7 @@ const prROOT = 'ROOT.', clTObject = 'TObject', clTNamed = 'TNamed', clTString =
10241030 * @desc Supported classes: `TObject`, `TNamed`, `TList`, `TAxis`, `TLine`, `TText`, `TLatex`, `TPad`, `TCanvas`
10251031 * @param {string} typename - ROOT class name
10261032 * @example
1027- * import { create } from 'path_to_jsroot /modules/core.mjs';
1033+ * import { create } from 'https://root.cern/js/latest /modules/core.mjs';
10281034 * let obj = create('TNamed');
10291035 * obj.fName = 'name';
10301036 * obj.fTitle = 'title'; */
@@ -8516,7 +8522,8 @@ function makeTranslate(x,y) {
85168522 return null;
85178523}
85188524
8519- /** @summary Configure special style used for highlight or dragging elements */
8525+ /** @summary Configure special style used for highlight or dragging elements
8526+ * @private */
85208527function addHighlightStyle(elem, drag) {
85218528 if (drag)
85228529 elem.style('stroke', 'steelblue')
@@ -65324,7 +65331,7 @@ class StandaloneMenu extends JSRootMenu {
6532465331 * @param {object} [handler] - object with handling function, in this case one not need to bind function
6532565332 * @param {string} [menuname] - optional menu name
6532665333 * @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';
6532865335 * let menu = await createMenu());
6532965336 * menu.add('First', () => console.log('Click first'));
6533065337 * let flag = true;
@@ -87482,7 +87489,7 @@ class TGeoPainter extends ObjectPainter {
8748287489 exact = false;
8748387490 }
8748487491
87485- this.findNodeWithVolume(regexp, function( arg) {
87492+ this.findNodeWithVolume(regexp, arg => {
8748687493 setInvisibleAll(arg.node.fVolume, (sign !== '+'));
8748787494 return exact ? arg : null; // continue search if not exact expression provided
8748887495 });
@@ -87918,11 +87925,10 @@ class TGeoPainter extends ObjectPainter {
8791887925 mesh.getMatrixAt(i, item.matrix0);
8791987926 item.minvert.copy(item.matrix0).invert();
8792087927
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);
8792387929
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);
8792687932 }
8792787933 }
8792887934
@@ -88395,14 +88401,14 @@ class TGeoPainter extends ObjectPainter {
8839588401 let wireframe = this.accessObjectWireFrame(obj);
8839688402
8839788403 if (wireframe !== undefined)
88398- menu.addchk(wireframe, 'Wireframe', n, function( indx) {
88404+ menu.addchk(wireframe, 'Wireframe', n, indx => {
8839988405 let m = intersects[indx].object.material;
8840088406 m.wireframe = !m.wireframe;
8840188407 this.render3D();
88402- });
88408+ }, 'Toggle wireframe mode for the node' );
8840388409
8840488410 if (cnt > 1)
88405- menu.add('Manifest', n, function( indx) {
88411+ menu.add('Manifest', n, indx => {
8840688412
8840788413 if (this._last_manifest)
8840888414 this._last_manifest.wireframe = !this._last_manifest.wireframe;
@@ -88422,15 +88428,15 @@ class TGeoPainter extends ObjectPainter {
8842288428 this._last_manifest.wireframe = !this._last_manifest.wireframe;
8842388429
8842488430 this.render3D();
88425- });
88431+ }, 'Manifest selected node' );
8842688432
8842788433
88428- menu.add('Focus', n, function( indx) {
88434+ menu.add('Focus', n, indx => {
8842988435 this.focusCamera(intersects[indx].object);
8843088436 });
8843188437
8843288438 if (!this._geom_viewer) {
88433- menu.add('Hide', n, function( indx) {
88439+ menu.add('Hide', n, indx => {
8843488440 let resolve = this._clones.resolveStack(intersects[indx].object.stack);
8843588441 if (resolve.obj && (resolve.node.kind === kindGeo) && resolve.obj.fVolume) {
8843688442 setGeoBit(resolve.obj.fVolume, geoBITS.kVisThis, false);
@@ -96476,7 +96482,7 @@ class TProxyFile extends TFile {
9647696482 * @return {object} - Promise with {@link TFile} instance when file is opened
9647796483 * @example
9647896484 *
96479- * import { openFile } from '/path_to_jsroot /modules/io.mjs';
96485+ * import { openFile } from 'https://root.cern/js/latest /modules/io.mjs';
9648096486 * let f = await openFile('https://root.cern/js/files/hsimple.root');
9648196487 * console.log(`Open file ${f.getFileName()}`); */
9648296488function openFile(arg) {
@@ -99578,7 +99584,11 @@ function getDrawSettings(kind, selector) {
9957899584 return res;
9957999585}
9958099586
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'); */
9958299592function setDefaultDrawOpt(classname, opt) {
9958399593 let handle = getDrawHandle(prROOT + classname, 0);
9958499594 if (handle)
@@ -99712,7 +99722,18 @@ async function draw(dom, obj, opt) {
9971299722 * @return {Promise} with painter object
9971399723 * @desc If drawing was not done before, it will be performed with {@link draw}.
9971499724 * 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); */
9971699737async function redraw(dom, obj, opt) {
9971799738
9971899739 if (!isObject(obj))
@@ -99821,8 +99842,8 @@ function addStreamerInfosForPainter(lst) {
9982199842 * import { openFile, makeImage } from 'jsroot';
9982299843 * let file = await openFile('https://root.cern/js/files/hsimple.root');
9982399844 * 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 }); */
9982699847async function makeImage(args) {
9982799848 if (!args) args = {};
9982899849
@@ -103859,7 +103880,7 @@ function readStyleFromURL(url) {
103859103880 * @param {String} gui_kind - either 'online', 'nobrowser', 'draw'
103860103881 * @return {Promise} with {@link HierarchyPainter} instance
103861103882 * @example
103862- * import { buildGUI } from '/path_to_jsroot /modules/gui.mjs';
103883+ * import { buildGUI } from 'https://root.cern/js/latest /modules/gui.mjs';
103863103884 * buildGUI('guiDiv'); */
103864103885async function buildGUI(gui_element, gui_kind = '') {
103865103886 let myDiv = select(isStr(gui_element) ? `#${gui_element}` : gui_element);
0 commit comments