1- // https://root.cern/js/ v7.6.99
1+ // https://root.cern/js/ v7.7.0
22(function (global, factory) {
33typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
44typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -7,7 +7,7 @@ typeof define === 'function' && define.amd ? define(['exports'], factory) :
77
88/** @summary version id
99 * @desc For the JSROOT release the string in format 'major.minor.patch' like '7.0.0' */
10- const version_id = 'dev ',
10+ const version_id = '7.7.0 ',
1111
1212/** @summary version date
1313 * @desc Release date in format day/month/year like '14/04/2022' */
@@ -113103,6 +113103,27 @@ function produceTAxisLogScale(axis, num, min, max) {
113103113103 axis.fXmax = Math.exp(lmax);
113104113104}
113105113105
113106+ function scanTF1Options(opt) {
113107+ if (!isStr(opt)) opt = '';
113108+ let p = opt.indexOf(';webcanv_hist'), webcanv_hist = false, use_saved = 0;
113109+ if (p >= 0) {
113110+ webcanv_hist = true;
113111+ opt = opt.slice(0, p);
113112+ }
113113+ p = opt.indexOf(';force_saved');
113114+ if (p >= 0) {
113115+ use_saved = 2;
113116+ opt = opt.slice(0, p);
113117+ }
113118+ p = opt.indexOf(';prefer_saved');
113119+ if (p >= 0) {
113120+ use_saved = 1;
113121+ opt = opt.slice(0, p);
113122+ }
113123+ return { opt, webcanv_hist, use_saved };
113124+ }
113125+
113126+
113106113127/**
113107113128 * @summary Painter for TF1 object
113108113129 *
@@ -113165,7 +113186,7 @@ class TF1Painter extends TH1Painter$2 {
113165113186 xmax = Math.max(xmax, gr.zoom_xmax);
113166113187 }
113167113188
113168- this._use_saved_points = (tf1.fSave.length > 3) && (settings.PreferSavedPoints || this.force_saved );
113189+ this._use_saved_points = (tf1.fSave.length > 3) && (settings.PreferSavedPoints || ( this.use_saved > 1) );
113169113190
113170113191 const ensureBins = num => {
113171113192 if (hist.fNcells !== num + 2) {
@@ -113292,12 +113313,13 @@ class TF1Painter extends TH1Painter$2 {
113292113313
113293113314 /** @summary Checks if it makes sense to zoom inside specified axis range */
113294113315 canZoomInside(axis, min, max) {
113295- if ((this.$func?.fSave.length > 0) && this._use_saved_points && (axis === 'x')) {
113316+ const nsave = this.$func?.fSave.length ?? 0;
113317+ if ((nsave > 3) && this._use_saved_points && (axis === 'x')) {
113296113318 // in the case where the points have been saved, useful for example
113297113319 // if we don't have the user's function
113298- const nb_points = this.$func.fNpx ,
113299- xmin = this.$func.fSave[nb_points + 1 ],
113300- xmax = this.$func.fSave[nb_points + 2 ];
113320+ const nb_points = nsave - 2 ,
113321+ xmin = this.$func.fSave[nsave - 2 ],
113322+ xmax = this.$func.fSave[nsave - 1 ];
113301113323
113302113324 return Math.abs(xmax - xmin) / nb_points < Math.abs(max - min);
113303113325 }
@@ -113373,29 +113395,20 @@ class TF1Painter extends TH1Painter$2 {
113373113395 }
113374113396
113375113397 /** @summary fill information for TWebCanvas
113398+ * @desc Used to inform webcanvas when evaluation failed
113376113399 * @private */
113377113400 fillWebObjectOptions(opt) {
113378- // mark that saved points are used or evaluation failed
113379- opt.fcust = this._fail_eval ? 'func_fail' : '';
113401+ opt.fcust = this._fail_eval && !this.use_saved ? 'func_fail' : '';
113380113402 }
113381113403
113382113404 /** @summary draw TF1 object */
113383113405 static async draw(dom, tf1, opt) {
113384- if (!isStr(opt)) opt = '';
113385- let p = opt.indexOf(';webcanv_hist'), webcanv_hist = false, force_saved = false;
113386- if (p >= 0) {
113387- webcanv_hist = true;
113388- opt = opt.slice(0, p);
113389- }
113390- p = opt.indexOf(';force_saved');
113391- if (p >= 0) {
113392- force_saved = true;
113393- opt = opt.slice(0, p);
113394- }
113395-
113406+ const web = scanTF1Options(opt);
113407+ opt = web.opt;
113408+ delete web.opt;
113396113409 let hist;
113397113410
113398- if (webcanv_hist) {
113411+ if (web. webcanv_hist) {
113399113412 const dummy = new ObjectPainter(dom);
113400113413 hist = dummy.getPadPainter()?.findInPrimitives('Func', clTH1D);
113401113414 }
@@ -113411,8 +113424,7 @@ class TF1Painter extends TH1Painter$2 {
113411113424 const painter = new TF1Painter(dom, hist);
113412113425
113413113426 painter.$func = tf1;
113414- painter.webcanv_hist = webcanv_hist;
113415- painter.force_saved = force_saved;
113427+ Object.assign(painter, web);
113416113428
113417113429 painter.createTF1Histogram(tf1, hist);
113418113430
@@ -113424,7 +113436,8 @@ class TF1Painter extends TH1Painter$2 {
113424113436var TF1Painter$1 = /*#__PURE__*/Object.freeze({
113425113437__proto__: null,
113426113438TF1Painter: TF1Painter,
113427- produceTAxisLogScale: produceTAxisLogScale
113439+ produceTAxisLogScale: produceTAxisLogScale,
113440+ scanTF1Options: scanTF1Options
113428113441});
113429113442
113430113443const kIsBayesian = BIT(14), // Bayesian statistics are used
@@ -114656,7 +114669,7 @@ class TF2Painter extends TH2Painter {
114656114669 if ((nsave > 0) && (nsave !== (func.fSave[nsave+4]+1) * (func.fSave[nsave+5]+1)))
114657114670 nsave = 0;
114658114671
114659- this._use_saved_points = (nsave > 0) && (settings.PreferSavedPoints || this.force_saved );
114672+ this._use_saved_points = (nsave > 0) && (settings.PreferSavedPoints || ( this.use_saved > 1) );
114660114673
114661114674 const fp = this.getFramePainter(),
114662114675 pad = this.getPadPainter()?.getRootPad(true),
@@ -114875,25 +114888,17 @@ class TF2Painter extends TH2Painter {
114875114888 }
114876114889
114877114890 /** @summary fill information for TWebCanvas
114891+ * @desc Used to inform webcanvas when evaluation failed
114878114892 * @private */
114879114893 fillWebObjectOptions(opt) {
114880- // mark that saved points are used or evaluation failed
114881- opt.fcust = this._fail_eval ? 'func_fail' : '';
114894+ opt.fcust = this._fail_eval && !this.use_saved ? 'func_fail' : '';
114882114895 }
114883114896
114884114897 /** @summary draw TF2 object */
114885114898 static async draw(dom, tf2, opt) {
114886- if (!isStr(opt)) opt = '';
114887- let p = opt.indexOf(';webcanv_hist'), webcanv_hist = false, force_saved = false;
114888- if (p >= 0) {
114889- webcanv_hist = true;
114890- opt = opt.slice(0, p);
114891- }
114892- p = opt.indexOf(';force_saved');
114893- if (p >= 0) {
114894- force_saved = true;
114895- opt = opt.slice(0, p);
114896- }
114899+ const web = scanTF1Options(opt);
114900+ opt = web.opt;
114901+ delete web.opt;
114897114902
114898114903 const d = new DrawOptions(opt);
114899114904 if (d.empty())
@@ -114913,7 +114918,7 @@ class TF2Painter extends TH2Painter {
114913114918
114914114919 let hist;
114915114920
114916- if (webcanv_hist) {
114921+ if (web. webcanv_hist) {
114917114922 const dummy = new ObjectPainter(dom);
114918114923 hist = dummy.getPadPainter()?.findInPrimitives('Func', clTH2F);
114919114924 }
@@ -114926,8 +114931,7 @@ class TF2Painter extends TH2Painter {
114926114931 const painter = new TF2Painter(dom, hist);
114927114932
114928114933 painter.$func = tf2;
114929- painter.webcanv_hist = webcanv_hist;
114930- painter.force_saved = force_saved;
114934+ Object.assign(painter, web);
114931114935 painter.createTF2Histogram(tf2, hist);
114932114936 return THistPainter._drawHist(painter, opt);
114933114937 }
@@ -115006,7 +115010,7 @@ class TF3Painter extends TH2Painter {
115006115010 createTF3Histogram(func, hist) {
115007115011 const nsave = func.fSave.length - 9;
115008115012
115009- this._use_saved_points = (nsave > 0) && (settings.PreferSavedPoints || this.force_saved );
115013+ this._use_saved_points = (nsave > 0) && (settings.PreferSavedPoints || ( this.use_saved > 1) );
115010115014
115011115015 const fp = this.getFramePainter(),
115012115016 pad = this.getPadPainter()?.getRootPad(true),
@@ -115170,25 +115174,17 @@ class TF3Painter extends TH2Painter {
115170115174 }
115171115175
115172115176 /** @summary fill information for TWebCanvas
115177+ * @desc Used to inform webcanvas when evaluation failed
115173115178 * @private */
115174115179 fillWebObjectOptions(opt) {
115175- // mark that saved points are used or evaluation failed
115176- opt.fcust = this._fail_eval ? 'func_fail' : '';
115180+ opt.fcust = this._fail_eval && !this.prefer_saved ? 'func_fail' : '';
115177115181 }
115178115182
115179115183 /** @summary draw TF3 object */
115180115184 static async draw(dom, tf3, opt) {
115181- if (!isStr(opt)) opt = '';
115182- let p = opt.indexOf(';webcanv_hist'), webcanv_hist = false, force_saved = false;
115183- if (p >= 0) {
115184- webcanv_hist = true;
115185- opt = opt.slice(0, p);
115186- }
115187- p = opt.indexOf(';force_saved');
115188- if (p >= 0) {
115189- force_saved = true;
115190- opt = opt.slice(0, p);
115191- }
115185+ const web = scanTF1Options(opt);
115186+ opt = web.opt;
115187+ delete web.opt;
115192115188
115193115189 const d = new DrawOptions(opt);
115194115190 if (d.empty() || (opt === 'gl'))
@@ -115203,7 +115199,7 @@ class TF3Painter extends TH2Painter {
115203115199
115204115200 let hist;
115205115201
115206- if (webcanv_hist) {
115202+ if (web. webcanv_hist) {
115207115203 const dummy = new ObjectPainter(dom);
115208115204 hist = dummy.getPadPainter()?.findInPrimitives('Func', clTH2F);
115209115205 }
@@ -115216,8 +115212,7 @@ class TF3Painter extends TH2Painter {
115216115212 const painter = new TF3Painter(dom, hist);
115217115213
115218115214 painter.$func = tf3;
115219- painter.webcanv_hist = webcanv_hist;
115220- painter.force_saved = force_saved;
115215+ Object.assign(painter, web);
115221115216 painter.createTF3Histogram(tf3, hist);
115222115217 return THistPainter._drawHist(painter, opt);
115223115218 }
0 commit comments