Skip to content

Commit b9c1f9f

Browse files
committed
Fix - natively support TList/TObjArray browsing
1 parent 376cf36 commit b9c1f9f

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

scripts/JSRootCore.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@
445445
}
446446

447447
JSROOT.findFunction = function(name) {
448+
if (typeof name === 'function') return name;
448449
var func = window[name];
449450
if (typeof func == 'function') return func;
450451
var separ = name.lastIndexOf(".");

scripts/JSRootPainter.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6577,6 +6577,27 @@
65776577
return true;
65786578
}
65796579

6580+
JSROOT.Painter.ListHierarchy = function(folder, lst) {
6581+
if (lst._typename != 'TList' && lst._typename != 'TObjArray' && lst._typename != 'TClonesArray') return false;
6582+
6583+
if (lst.arr.length === 0) {
6584+
folder._more = false;
6585+
return true;
6586+
}
6587+
6588+
folder._childs = [];
6589+
for ( var i = 0; i < lst.arr.length; ++i) {
6590+
var obj = lst.arr[i];
6591+
var item = {
6592+
_name : obj.fName,
6593+
_kind : "ROOT." + obj._typename,
6594+
_readobj : obj
6595+
};
6596+
folder._childs.push(item);
6597+
}
6598+
return true;
6599+
}
6600+
65806601
JSROOT.Painter.ObjectHierarchy = function(top, obj, nosimple) {
65816602
if ((top==null) || (obj==null)) return false;
65826603

@@ -6784,10 +6805,6 @@
67846805
item._kind = "ROOT.TStreamerInfoList";
67856806
item._title = "List of streamer infos for binary I/O";
67866807
item._readobj = file.fStreamerInfos;
6787-
} else
6788-
if (key.fClassName == 'TList' || key.fClassName == 'TObjArray' || key.fClassName == 'TClonesArray') {
6789-
item._more = true;
6790-
item._expand = JSROOT.Painter.ListHierarchy;
67916808
}
67926809

67936810
folder._childs.push(item);
@@ -8437,8 +8454,9 @@
84378454
JSROOT.addDrawFunc({ name: "TNtuple", icon: "img_tree", noinspect:true });
84388455
JSROOT.addDrawFunc({ name: "TBranch", icon: "img_branch", noinspect:true });
84398456
JSROOT.addDrawFunc({ name: /^TLeaf/, icon: "img_leaf" });
8440-
JSROOT.addDrawFunc({ name: "TList", icon: "img_list" });
8441-
JSROOT.addDrawFunc({ name: "TObjArray", icon: "img_list" });
8457+
JSROOT.addDrawFunc({ name: "TList", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy });
8458+
JSROOT.addDrawFunc({ name: "TObjArray", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy });
8459+
JSROOT.addDrawFunc({ name: "TClonesArray", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy });
84428460
JSROOT.addDrawFunc({ name: "TColor", icon: "img_color" });
84438461
JSROOT.addDrawFunc({ name: "TFile", icon: "img_file", noinspect:true });
84448462
JSROOT.addDrawFunc({ name: "TMemFile", icon: "img_file", noinspect:true });

0 commit comments

Comments
 (0)