Skip to content

Commit 43d3e7a

Browse files
committed
5. One can enable MathJax usage with mathjax url option. By default off.
git-svn-id: https://subversion.gsi.de/dabc/trunk/plugins/root/js@3061 bcbf6573-9a26-0410-9ebc-ce4ab7aade96
1 parent a496805 commit 43d3e7a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

demo/drawoptions.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
});
148148

149149
LoadFile("legends.root", function(file) {
150-
draw_item_options(file, "legends;1", "can6_draw", "", 0.);
150+
draw_item_options(file, "legends;1", "can6_draw", ";mathjax=1", 0.);
151151
});
152152

153153
LoadFile("exclusion.root", function(file) {

scripts/JSRootPainter.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
StatFill : { fFillColor: 0, fFillStyle: 1001 },
4747
TimeOffset : 788918400000, // UTC time at 01/01/95
4848
StatFormat : function(v) { return (Math.abs(v) < 1e5) ? v.toFixed(5) : v.toExponential(7); },
49-
StatEntriesFormat : function(v) { return (Math.abs(v) < 1e7) ? v.toFixed(0) : v.toExponential(7); }
49+
StatEntriesFormat : function(v) { return (Math.abs(v) < 1e7) ? v.toFixed(0) : v.toExponential(7); },
50+
MathJax : 0, // 0 - never, 1 - only for complex cases, 2 - always
5051
};
5152

5253
/**
@@ -78,6 +79,13 @@
7879
col = parseInt(col);
7980
if ((col!=NaN) && (col>0) && (col<4)) JSROOT.gStyle.DefaultCol = col;
8081
}
82+
83+
var mathjax = JSROOT.GetUrlOption("mathjax", url);
84+
if (mathjax == "") JSROOT.gStyle.MathJax = 1; else
85+
if (mathjax != null) {
86+
JSROOT.gStyle.MathJax = parseInt(mathjax);
87+
if (JSROOT.gStyle.MathJax == NaN) JSROOT.gStyle.MathJax = 1;
88+
}
8189
}
8290

8391
JSROOT.createMenu = function(menuname) {
@@ -6313,7 +6321,7 @@
63136321
var pos_x = tpos_x;
63146322
if ((lopt.indexOf('h')>=0) || (lopt.length==0)) pos_x = padding_x;
63156323

6316-
if ((label.indexOf("#frac")<0) || JSROOT.browser.isIE) {
6324+
if ((JSROOT.gStyle.MathJax < 1) || (label.indexOf("#frac")<0)) {
63176325
p.append("text")
63186326
.attr("class", "text")
63196327
.attr("text-anchor", "start")
@@ -6355,7 +6363,7 @@
63556363
var rect = body.node().getBoundingClientRect();
63566364
var fact_x = parseInt(rect.right - rect.left) / fo_w;
63576365
var fact_y = parseInt(rect.bottom - rect.top) / fo_h;
6358-
if (Math.max(fact_x, fact_y) > 1)
6366+
if (Math.max(fact_x, fact_y) > 1)
63596367
body.style("font", font.asStyle(Math.round(font.size/Math.max(fact_x, fact_y))));
63606368
});
63616369
});

0 commit comments

Comments
 (0)