Skip to content

Commit c18eaef

Browse files
committed
Build with RNTuple player
1 parent 612f641 commit c18eaef

2 files changed

Lines changed: 56 additions & 21 deletions

File tree

‎build/jsroot.js‎

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -167381,7 +167381,7 @@ const drawFuncs = { lst: [
167381167381
{ name: clTBranchFunc, icon: 'img_leaf_method', draw: () => import_tree().then(h => h.drawTree), opt: ';dump;dumpall', noinspect: true, transform: true },
167382167382
{ name: /^TBranch/, icon: 'img_branch', draw: () => import_tree().then(h => h.drawTree), dflt: 'expand', opt: ';dump;dumpall', ctrl: 'dump', shift: kInspect, ignore_online: true, always_draw: true, transform: true },
167383167383
{ name: /^TLeaf/, icon: 'img_leaf', noexpand: true, draw: () => import_tree().then(h => h.drawTree), opt: ';dump;dumpall', ctrl: 'dump', ignore_online: true, always_draw: true, transform: true },
167384-
{ name: 'ROOT::RNTuple', icon: 'img_tree', get_expand: () => Promise.resolve().then(function () { return rntuple; }).then(h => h.tupleHierarchy), draw: () => Promise.resolve().then(function () { return RNTuple; }).then(h => h.drawRNTuple), dflt: 'expand', pm: true, transform: true },
167384+
{ name: 'ROOT::RNTuple', icon: 'img_tree', get_expand: () => Promise.resolve().then(function () { return rntuple; }).then(h => h.tupleHierarchy), draw: () => Promise.resolve().then(function () { return RNTuple; }).then(h => h.drawRNTuple), dflt: 'expand', opt: 'player', pm: true, transform: true },
167385167385
{ name: 'ROOT::RNTupleField', icon: 'img_leaf', draw: () => Promise.resolve().then(function () { return RNTuple; }).then(h => h.drawRNTuple), opt: ';dump;dumpall', ctrl: 'dump', shift: kInspect, ignore_online: true, always_draw: true, transform: true },
167386167386
{ name: clTList, icon: 'img_list', draw: () => import_h().then(h => h.drawList), get_expand: () => import_h().then(h => h.listHierarchy), dflt: 'expand' },
167387167387
{ name: clTHashList, sameas: clTList },
@@ -173206,9 +173206,14 @@ async function treeDrawProgress(obj, final) {
173206173206

173207173207
/** @summary Create painter to perform tree drawing on server side
173208173208
* @private */
173209-
function createTreePlayer(player) {
173209+
function createTreePlayer(player, tree, rntuple) {
173210173210
player.draw_first = true;
173211173211

173212+
if (tree)
173213+
player.local_tree = tree;
173214+
else if (rntuple)
173215+
player.local_rntuple = rntuple;
173216+
173212173217
player.configureOnline = function(itemname, url, askey, root_version, expr) {
173213173218
this.setItemName(itemname, '', this);
173214173219
this.url = url;
@@ -173217,13 +173222,9 @@ function createTreePlayer(player) {
173217173222
this.draw_expr = expr;
173218173223
};
173219173224

173220-
player.configureTree = function(tree) {
173221-
this.local_tree = tree;
173222-
};
173223-
173224173225
player.showExtraButtons = function(args) {
173225173226
const main = this.selectDom(),
173226-
numentries = this.local_tree?.fEntries || 0;
173227+
numentries = this.local_tree?.fEntries || (this.local_rntuple ? 10000000 : 0);
173227173228

173228173229
main.select('.treedraw_more').remove(); // remove more button first
173229173230

@@ -173264,13 +173265,13 @@ function createTreePlayer(player) {
173264173265
// ObjectPainter allow such usage of methods from BasePainter
173265173266
this.setTopPainter();
173266173267

173267-
if (this.local_tree) {
173268-
main.select('.treedraw_buttons')
173269-
.attr('title', 'Tree draw player for: ' + this.local_tree.fName);
173270-
}
173268+
if (this.local_tree)
173269+
main.select('.treedraw_buttons').attr('title', 'Tree draw player for: ' + this.local_tree.fName);
173270+
else if (this.local_rntuple)
173271+
main.select('.treedraw_buttons').attr('title', 'RNTuple draw player for local rntuple');
173271173272
main.select('.treedraw_exe').on('click', () => this.performDraw());
173272173273
main.select('.treedraw_varexp')
173273-
.attr('value', args?.parse_expr || this.draw_expr || 'px:py')
173274+
.attr('value', args?.parse_expr || args?.expr || this.draw_expr || 'px:py')
173274173275
.on('change', () => this.performDraw());
173275173276
main.select('.treedraw_varexp_info')
173276173277
.attr('title', 'Example of valid draw expressions:\n' +
@@ -173301,9 +173302,6 @@ function createTreePlayer(player) {
173301173302
};
173302173303

173303173304
player.performLocalDraw = function() {
173304-
if (!this.local_tree)
173305-
return;
173306-
173307173305
const frame = this.selectDom(),
173308173306
args = { expr: this.getValue('.treedraw_varexp') };
173309173307

@@ -173329,13 +173327,23 @@ function createTreePlayer(player) {
173329173327
delete args.firstentry;
173330173328
}
173331173329

173330+
const json = JSON.stringify(args);
173331+
173332+
// prevent execute same expression twice because of some extra browser events
173333+
if (this._last_args_json && this._last_args_json === json)
173334+
return;
173335+
this._last_args_json = json;
173336+
173332173337
cleanup(this.drawid);
173333173338

173334173339
args.drawid = this.drawid;
173335173340

173336173341
args.progress = treeDrawProgress.bind(args);
173337173342

173338-
treeDraw(this.local_tree, args).then(obj => args.progress(obj, true));
173343+
if (this.local_tree)
173344+
treeDraw(this.local_tree, args).then(obj => args.progress(obj, true));
173345+
else if (this.local_rntuple && isFunc(this.rntupleDraw))
173346+
this.rntupleDraw(this.local_rntuple, args).then(obj => args.progress(obj, true));
173339173347
};
173340173348

173341173349
player.getDrawOpt = function() {
@@ -173347,7 +173355,7 @@ function createTreePlayer(player) {
173347173355
};
173348173356

173349173357
player.performDraw = function() {
173350-
if (this.local_tree)
173358+
if (this.local_tree || this.local_rntuple)
173351173359
return this.performLocalDraw();
173352173360

173353173361
const frame = this.selectDom();
@@ -173540,8 +173548,7 @@ async function drawTree(dom, obj, opt) {
173540173548

173541173549
if (args.player) {
173542173550
painter = new ObjectPainter(dom, obj, opt);
173543-
createTreePlayer(painter);
173544-
painter.configureTree(tree);
173551+
createTreePlayer(painter, tree);
173545173552
painter.showPlayer(args);
173546173553
args.drawid = painter.drawid;
173547173554
} else
@@ -173567,6 +173574,7 @@ async function drawTree(dom, obj, opt) {
173567173574

173568173575
var TTree = /*#__PURE__*/Object.freeze({
173569173576
__proto__: null,
173577+
createTreePlayer: createTreePlayer,
173570173578
drawLeafPlayer: drawLeafPlayer,
173571173579
drawTree: drawTree,
173572173580
drawTreePlayer: drawTreePlayer,
@@ -183170,16 +183178,42 @@ async function drawRNTuple(dom, obj, opt) {
183170183178
} else {
183171183179
tuple = obj;
183172183180
args.expr = opt;
183181+
if (args.expr && isStr(args.expr)) {
183182+
const p = args.expr.indexOf('player');
183183+
if (p === 0) {
183184+
args.player = true;
183185+
args.expr = args.expr.slice(6);
183186+
if (args.expr[0] === ':')
183187+
args.expr = args.expr.slice(1);
183188+
} else if ((p >= 0) && (p === args.expr.length - 6)) {
183189+
args.player = true;
183190+
args.expr = args.expr.slice(0, p);
183191+
if ((p > 0) && (args.expr[p - 1] === ';'))
183192+
args.expr = args.expr.slice(0, p - 1);
183193+
}
183194+
}
183173183195
}
183174183196

183175183197
if (!tuple)
183176183198
throw Error('No RNTuple object available for drawing');
183177183199

183178-
args.drawid = dom;
183200+
let painter;
183201+
183202+
if (args.player) {
183203+
painter = new ObjectPainter(dom, obj, opt);
183204+
createTreePlayer(painter, null, tuple);
183205+
painter.rntupleDraw = rntupleDraw;
183206+
painter.showPlayer(args);
183207+
args.drawid = painter.drawid;
183208+
} else
183209+
args.drawid = dom;
183179183210

183180183211
args.progress = treeDrawProgress.bind(args);
183181183212

183182-
return rntupleDraw(tuple, args).then(res => args.progress(res, true));
183213+
if (args.expr || args.branch)
183214+
return rntupleDraw(tuple, args).then(res => args.progress(res, true));
183215+
183216+
return painter;
183183183217
}
183184183218

183185183219
var RNTuple = /*#__PURE__*/Object.freeze({

‎changes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1. Let copy and paste histogram title, `TLatex` text and `TPave` label via context menu
1111
1. Use "JSROOT" label for main pad button, hide it after 5 seconds from the drawing
1212
1. Let preserve `BigInt` values when calling `rntupleProcess()` function #418
13+
1. Let use primitive "player" for RNTuple to edit draw expressions
1314
1. Use `8.6g`/`10.8g` format for float/double historgam content-to-text conversion in tooltips
1415
1. Add `@vite-ignore` comment to dynamic imports to suppress Vite/Rollup analysis warnings
1516
1. Upgrade three.js r183 -> r186 #424

0 commit comments

Comments
 (0)