Skip to content

Commit bafbf5a

Browse files
committed
Introduce get_main_id() function for TBasePainter
Simple text id can be required by some external libs (like dabc.js or go4.js). For such libs text id can be generated. Not really required in JSROOT itself
1 parent 1722160 commit bafbf5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/JSRootPainter.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,20 @@
22732273
return res;
22742274
}
22752275

2276+
/** @summary Returns string with value of main element id attribute
2277+
*
2278+
* @desc if main element does not have id, it will be generated */
2279+
TBasePainter.prototype.get_main_id = function() {
2280+
var elem = this.select_main();
2281+
if (elem.empty()) return "";
2282+
var id = elem.attr("id");
2283+
if (!id) {
2284+
id = "jsroot_element_" + JSROOT.id_counter++;
2285+
elem.attr("id", id);
2286+
}
2287+
return id;
2288+
}
2289+
22762290
/** @summary Returns layout kind
22772291
* @private
22782292
*/

0 commit comments

Comments
 (0)