|
1 | 1 | import { version, gStyle, httpRequest, create, createHttpRequest, loadScript, loadModules, decodeUrl,
|
2 | 2 | source_dir, settings, internals, browser, findFunction, toJSON,
|
3 | 3 | isArrayProto, isRootCollection, isBatchMode, isNodeJs, isObject, isFunc, isStr, _ensureJSROOT,
|
4 |
| - prROOT, clTList, clTMap, clTObjString, clTKey, clTFile, clTText, clTLatex, clTColor, clTStyle, |
| 4 | + clTList, clTMap, clTObjString, clTKey, clTFile, clTText, clTLatex, clTColor, clTStyle, |
5 | 5 | getKindForType, getTypeForKind, kInspect, isPromise } from '../core.mjs';
|
6 | 6 | import { select as d3_select } from '../d3.mjs';
|
7 | 7 | import { openFile, kBaseClass, clTStreamerInfoList, clTDirectory, clTDirectoryFile, nameStreamerInfo, addUserStreamer } from '../io.mjs';
|
@@ -1227,7 +1227,7 @@ class HierarchyPainter extends BasePainter {
|
1227 | 1227 | can_click = true;
|
1228 | 1228 |
|
1229 | 1229 | let can_menu = can_click;
|
1230 |
| - if (!can_menu && isStr(hitem._kind) && (hitem._kind.indexOf(prROOT) === 0)) |
| 1230 | + if (!can_menu && getTypeForKind(hitem._kind)) |
1231 | 1231 | can_menu = can_click = true;
|
1232 | 1232 |
|
1233 | 1233 | if (!img2) img2 = img1;
|
@@ -1715,7 +1715,7 @@ class HierarchyPainter extends BasePainter {
|
1715 | 1715 | return this.expandItem(itemname, d3cont);
|
1716 | 1716 |
|
1717 | 1717 | // cannot draw, but can inspect ROOT objects
|
1718 |
| - if (isStr(hitem._kind) && (hitem._kind.indexOf(prROOT) === 0) && sett.inspect && (can_draw !== false)) |
| 1718 | + if (getTypeForKind(hitem._kind) && sett.inspect && (can_draw !== false)) |
1719 | 1719 | return this.display(itemname, kInspect, null, true);
|
1720 | 1720 |
|
1721 | 1721 | if (!hitem._childs || (hitem === this.h)) return;
|
@@ -2139,12 +2139,12 @@ class HierarchyPainter extends BasePainter {
|
2139 | 2139 |
|
2140 | 2140 | if (!updating) showProgress(`Drawing ${display_itemname} ...`);
|
2141 | 2141 |
|
2142 |
| - let handle = obj._typename ? getDrawHandle(prROOT + obj._typename) : null; |
| 2142 | + let handle = obj._typename ? getDrawHandle(getKindForType(obj._typename)) : null; |
2143 | 2143 |
|
2144 | 2144 | if (handle?.draw_field && obj[handle.draw_field]) {
|
2145 | 2145 | obj = obj[handle.draw_field];
|
2146 | 2146 | if (!drawopt) drawopt = handle.draw_field_opt || '';
|
2147 |
| - handle = obj._typename ? getDrawHandle(prROOT + obj._typename) : null; |
| 2147 | + handle = obj._typename ? getDrawHandle(getKindForType(obj._typename)) : null; |
2148 | 2148 | }
|
2149 | 2149 |
|
2150 | 2150 | if (use_dflt_opt && !drawopt && handle?.dflt && (handle.dflt !== kExpand))
|
@@ -2219,7 +2219,7 @@ class HierarchyPainter extends BasePainter {
|
2219 | 2219 | d3_select(frame).on('dragover', ev => {
|
2220 | 2220 | const itemname = ev.dataTransfer.getData('item'),
|
2221 | 2221 | ditem = h.findItem(itemname);
|
2222 |
| - if (isStr(ditem?._kind) && (ditem._kind.indexOf(prROOT) === 0)) |
| 2222 | + if (getTypeForKind(ditem?._kind)) |
2223 | 2223 | ev.preventDefault(); // let accept drop, otherwise it will be refused
|
2224 | 2224 | }).on('dragenter', function() {
|
2225 | 2225 | d3_select(this).classed('jsroot_drag_area', true);
|
@@ -2286,7 +2286,7 @@ class HierarchyPainter extends BasePainter {
|
2286 | 2286 | if (isFunc(mp?.performDrop))
|
2287 | 2287 | return mp.performDrop(res.obj, itemname, res.item, opt).then(p => drop_complete(p, mp === p));
|
2288 | 2288 |
|
2289 |
| - const sett = res.obj._typename ? getDrawSettings(prROOT + res.obj._typename) : null; |
| 2289 | + const sett = res.obj._typename ? getDrawSettings(getKindForType(res.obj._typename)) : null; |
2290 | 2290 | if (!sett?.draw)
|
2291 | 2291 | return null;
|
2292 | 2292 |
|
@@ -2676,7 +2676,7 @@ class HierarchyPainter extends BasePainter {
|
2676 | 2676 | if (handle?.expand_item && !hpainter._inspector) {
|
2677 | 2677 | _obj = _obj[handle.expand_item];
|
2678 | 2678 | _item.expand_item = handle.expand_item; // remember that was expand item
|
2679 |
| - handle = _obj?._typename ? getDrawHandle(prROOT + _obj._typename, '::expand') : null; |
| 2679 | + handle = _obj?._typename ? getDrawHandle(getKindForType(_obj._typename), '::expand') : null; |
2680 | 2680 | }
|
2681 | 2681 |
|
2682 | 2682 | if (handle?.expand || handle?.get_expand) {
|
@@ -3066,7 +3066,7 @@ class HierarchyPainter extends BasePainter {
|
3066 | 3066 | }
|
3067 | 3067 | }
|
3068 | 3068 |
|
3069 |
| - if (!req && item._kind.indexOf(prROOT)) |
| 3069 | + if (!req && getTypeForKind(item._kind)) |
3070 | 3070 | req = 'item.json.gz?compact=3';
|
3071 | 3071 | }
|
3072 | 3072 |
|
@@ -3153,10 +3153,8 @@ class HierarchyPainter extends BasePainter {
|
3153 | 3153 | .then(() => {
|
3154 | 3154 | this.forEachItem(item => {
|
3155 | 3155 | if (!('_drawfunc' in item) || !('_kind' in item)) return;
|
3156 |
| - let typename = 'kind:' + item._kind; |
3157 |
| - if (item._kind.indexOf(prROOT) === 0) |
3158 |
| - typename = item._kind.slice(5); |
3159 |
| - const drawopt = item._drawopt; |
| 3156 | + const typename = getTypeForKind(item._kind) || `kind:${item._kind}`, |
| 3157 | + drawopt = item._drawopt; |
3160 | 3158 | if (!canDrawHandle(typename) || drawopt)
|
3161 | 3159 | addDrawFunc({ name: typename, func: item._drawfunc, script: item._drawscript, opt: drawopt });
|
3162 | 3160 | });
|
@@ -3201,7 +3199,7 @@ class HierarchyPainter extends BasePainter {
|
3201 | 3199 | const node = this.findItem(itemname),
|
3202 | 3200 | sett = getDrawSettings(node._kind, 'nosame;noinspect'),
|
3203 | 3201 | handle = getDrawHandle(node._kind),
|
3204 |
| - root_type = isStr(node._kind) ? node._kind.indexOf(prROOT) === 0 : false; |
| 3202 | + root_type = getTypeForKind(node._kind); |
3205 | 3203 |
|
3206 | 3204 | if (sett.opts && (node._can_draw !== false)) {
|
3207 | 3205 | sett.opts.push(kInspect);
|
@@ -3450,7 +3448,7 @@ class HierarchyPainter extends BasePainter {
|
3450 | 3448 | /** @summary function updates object drawings for other painters
|
3451 | 3449 | * @private */
|
3452 | 3450 | updateOnOtherFrames(painter, obj) {
|
3453 |
| - const handle = obj._typename ? getDrawHandle(prROOT + obj._typename) : null; |
| 3451 | + const handle = obj._typename ? getDrawHandle(getKindForType(obj._typename)) : null; |
3454 | 3452 | if (handle?.draw_field && obj[handle?.draw_field])
|
3455 | 3453 | obj = obj[handle?.draw_field];
|
3456 | 3454 |
|
|
0 commit comments