Skip to content

Commit eb29a94

Browse files
committed
Preserve title lower/upper case
1 parent 3775d43 commit eb29a94

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

modules/base/BasePainter.mjs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,12 @@ function floatToString(value, fmt, ret_fmt) {
182182
class DrawOptions {
183183

184184
constructor(opt) {
185-
this.opt = isStr(opt) ? opt.toUpperCase().trim() : '';
186-
this.part = '';
185+
if (isStr(opt)) {
186+
this.origin = opt.trim();
187+
this.opt = this.origin.toUpperCase();
188+
} else
189+
this.opt = this.origin = '';
190+
this.part = this.partO = '';
187191
}
188192

189193
/** @summary Returns true if remaining options are empty or contain only separators symbols. */
@@ -192,12 +196,18 @@ class DrawOptions {
192196
/** @summary Returns remaining part of the draw options. */
193197
remain() { return this.opt; }
194198

199+
/** @summary Remove [pos, pos2) part from the string */
200+
#cut(pos, pos2) {
201+
this.opt = this.opt.slice(0, pos) + this.opt.slice(pos2);
202+
this.origin = this.origin.slice(0, pos) + this.origin.slice(pos2);
203+
}
204+
195205
/** @summary Checks if given option exists */
196206
check(name, postpart) {
197207
const pos = this.opt.indexOf(name);
198208
if (pos < 0)
199209
return false;
200-
this.opt = this.opt.slice(0, pos) + this.opt.slice(pos + name.length);
210+
this.#cut(pos, pos + name.length);
201211
this.part = '';
202212
if (!postpart)
203213
return true;
@@ -217,7 +227,8 @@ class DrawOptions {
217227
}
218228
if (pos2 > pos) {
219229
this.part = this.opt.slice(pos, pos2);
220-
this.opt = this.opt.slice(0, pos) + this.opt.slice(pos2);
230+
this.partO = this.origin.slice(pos, pos2);
231+
this.#cut(pos, pos2);
221232
}
222233

223234
if (is_array) {
@@ -249,6 +260,9 @@ class DrawOptions {
249260
return false;
250261
}
251262

263+
/** @summary Returns (original) part after found options. */
264+
getPart(origin) { return origin ? this.partO : this.part; }
265+
252266
/** @summary Returns remaining part of found option as integer. */
253267
partAsInt(offset, dflt) {
254268
let mult = 1;

modules/hist2d/THistPainter.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ class THistDrawOptions {
151151

152152
// let configure histogram titles - only for debug purposes
153153
if (d.check('HTITLE:', true))
154-
histo.fTitle = decodeURIComponent(d.part.toLowerCase());
154+
histo.fTitle = decodeURIComponent(d.getPart(true));
155155
if (d.check('XTITLE:', true))
156-
histo.fXaxis.fTitle = decodeURIComponent(d.part.toLowerCase());
156+
histo.fXaxis.fTitle = decodeURIComponent(d.getPart(true));
157157
if (d.check('YTITLE:', true))
158-
histo.fYaxis.fTitle = decodeURIComponent(d.part.toLowerCase());
158+
histo.fYaxis.fTitle = decodeURIComponent(d.getPart(true));
159159
if (d.check('ZTITLE:', true))
160-
histo.fZaxis.fTitle = decodeURIComponent(d.part.toLowerCase());
160+
histo.fZaxis.fTitle = decodeURIComponent(d.getPart(true));
161161
if (d.check('POISSON2'))
162162
this.Poisson = kPoisson2;
163163
if (d.check('POISSON'))

0 commit comments

Comments
 (0)