Skip to content

Commit 91c191b

Browse files
committed
[jsroot] dev 24/07/2024
Fix - corrupted page layout in SWAN after calling %rootbrowse JSROOT was changing layout of top HTML and body elements. Older jupyter notebooks was corrupted afterwards.
1 parent 8e1f282 commit 91c191b

6 files changed

Lines changed: 58 additions & 37 deletions

File tree

js/build/jsroot.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const version_id = 'dev',
1414

1515
/** @summary version date
1616
* @desc Release date in format day/month/year like '14/04/2022' */
17-
version_date = '23/07/2026',
17+
version_date = '24/07/2026',
1818

1919
/** @summary version id and date
2020
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -88981,19 +88981,19 @@ class BrowserLayout {
8898188981
text_color = settings.DarkMode ? '#ddd' : 'inherit',
8898288982
input_style = settings.DarkMode ? `background-color: #222; color: ${text_color}` : '';
8898388983

88984-
injectStyle(
88985-
'.jsroot_browser { pointer-events: none; position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 0px; border: 0px; overflow: hidden; }' +
88986-
`.jsroot_draw_area { background-color: ${bkgr_color}; overflow: hidden; margin: 0px; border: 0px; }` +
88987-
`.jsroot_browser_area { color: ${text_color}; background-color: ${bkgr_color}; font-size: 12px; font-family: Verdana; pointer-events: all; box-sizing: initial; }` +
88988-
`.jsroot_browser_area input { ${input_style} }` +
88989-
`.jsroot_browser_area select { ${input_style} }` +
88990-
`.jsroot_browser_title { font-family: Verdana; font-size: 20px; color: ${title_color}; }` +
88991-
'.jsroot_browser_btns { pointer-events: all; display: flex; flex-direction: column; }' +
88992-
'.jsroot_browser_area p { margin-top: 5px; margin-bottom: 5px; white-space: nowrap; }' +
88993-
'.jsroot_browser_hierarchy { flex: 1; margin-top: 2px; }' +
88994-
`.jsroot_status_area { background-color: ${bkgr_color}; overflow: hidden; font-size: 12px; font-family: Verdana; pointer-events: all; }` +
88995-
'.jsroot_browser_resize { position: absolute; right: 3px; bottom: 3px; margin-bottom: 0px; margin-right: 0px; opacity: 0.5; cursor: se-resize; z-index: 1; }',
88996-
this.main().node(), 'browser_layout_style');
88984+
injectStyle(`
88985+
.jsroot_browser { pointer-events: none; position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 0px; border: 0px; overflow: hidden; }
88986+
.jsroot_draw_area { background-color: ${bkgr_color}; overflow: hidden; margin: 0px; border: 0px; }
88987+
.jsroot_browser_area { color: ${text_color}; background-color: ${bkgr_color}; font-size: 12px; font-family: Verdana; pointer-events: all; box-sizing: initial; }
88988+
.jsroot_browser_area input { ${input_style} }
88989+
.jsroot_browser_area select { ${input_style} }
88990+
.jsroot_browser_title { font-family: Verdana; font-size: 20px; color: ${title_color}; }
88991+
.jsroot_browser_btns { pointer-events: all; display: flex; flex-direction: column; }
88992+
.jsroot_browser_area p { margin-top: 5px; margin-bottom: 5px; white-space: nowrap; }
88993+
.jsroot_browser_hierarchy { flex: 1; margin-top: 2px; }
88994+
.jsroot_status_area { background-color: ${bkgr_color}; overflow: hidden; font-size: 12px; font-family: Verdana; pointer-events: all; }
88995+
.jsroot_browser_resize { position: absolute; right: 3px; bottom: 3px; margin-bottom: 0px; margin-right: 0px; opacity: 0.5; cursor: se-resize; z-index: 1; }
88996+
`, this.main().node(), 'browser_layout_style');
8899788997
}
8899888998

8899988999
/** @summary method used to create basic elements
@@ -97279,6 +97279,12 @@ class THistPainter extends ObjectPainter {
9727997279

9728097280
if (!histo.fFunctions)
9728197281
histo.fFunctions = create$1(clTList);
97282+
else if (histo.fFunctions._typename !== clTList) {
97283+
// Fix - seen once in jupyter notebook that typename was TList*
97284+
console.error(`Fixing wrong typename ${histo.fFunctions._typename} for histogram list of functions`);
97285+
histo.fFunctions._typename = clTList;
97286+
exports.addMethods(histo.fFunctions, clTList);
97287+
}
9728297288

9728397289
if (asfirst)
9728497290
histo.fFunctions.AddFirst(obj);
@@ -171026,9 +171032,11 @@ async function buildGUI(gui_element, gui_kind = '') {
171026171032
if (divsize)
171027171033
myDiv.style('position', 'relative').style('width', divsize[0] + 'px').style('height', divsize[1] + 'px');
171028171034
else if (!isBatchMode()) {
171029-
select('html').style('height', '100%');
171030-
select('body').style('min-height', '100%').style('margin', 0).style('overflow', 'hidden');
171031-
myDiv.style('position', 'absolute').style('left', 0).style('top', 0).style('bottom', 0).style('right', 0).style('padding', '1px');
171035+
if (!nb) {
171036+
select('html').style('height', '100%');
171037+
select('body').style('min-height', '100%').style('margin', 0).style('overflow', 'hidden');
171038+
}
171039+
myDiv.style('position', 'absolute').style('inset', '0px').style('padding', '1px');
171032171040
}
171033171041
if (canvsize) {
171034171042
settings.CanvasWidth = canvsize[0];
@@ -171063,7 +171071,9 @@ async function buildGUI(gui_element, gui_kind = '') {
171063171071
if (d.has('websocket'))
171064171072
opt += ';websocket';
171065171073
return hpainter.display('', opt);
171066-
}).then(() => hpainter);
171074+
}).then(() => {
171075+
return hpainter;
171076+
});
171067171077
}
171068171078

171069171079
/** @summary Draw TEllipse

js/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1. Fix - prevent very long header in context menu
1111
1. Fix - draw 3d contours in "surf3" twice https://root-forum.cern.ch/t/64910
1212
1. Fix - check evaluated value of TF1
13+
1. Fix - corrupted page layout in SWAN after calling %rootbrowse
1314

1415

1516
## Changes in 7.11.0

js/modules/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const version_id = 'dev',
66

77
/** @summary version date
88
* @desc Release date in format day/month/year like '14/04/2022' */
9-
version_date = '23/07/2026',
9+
version_date = '24/07/2026',
1010

1111
/** @summary version id and date
1212
* @desc Produced by concatenation of {@link version_id} and {@link version_date}

js/modules/gui.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,11 @@ async function buildGUI(gui_element, gui_kind = '') {
297297
if (divsize)
298298
myDiv.style('position', 'relative').style('width', divsize[0] + 'px').style('height', divsize[1] + 'px');
299299
else if (!isBatchMode()) {
300-
d3_select('html').style('height', '100%');
301-
d3_select('body').style('min-height', '100%').style('margin', 0).style('overflow', 'hidden');
302-
myDiv.style('position', 'absolute').style('left', 0).style('top', 0).style('bottom', 0).style('right', 0).style('padding', '1px');
300+
if (!nb) {
301+
d3_select('html').style('height', '100%');
302+
d3_select('body').style('min-height', '100%').style('margin', 0).style('overflow', 'hidden');
303+
}
304+
myDiv.style('position', 'absolute').style('inset', '0px').style('padding', '1px');
303305
}
304306
if (canvsize) {
305307
settings.CanvasWidth = canvsize[0];
@@ -334,7 +336,9 @@ async function buildGUI(gui_element, gui_kind = '') {
334336
if (d.has('websocket'))
335337
opt += ';websocket';
336338
return hpainter.display('', opt);
337-
}).then(() => hpainter);
339+
}).then(() => {
340+
return hpainter;
341+
});
338342
}
339343

340344
export { buildGUI, internals, readStyleFromURL, HierarchyPainter, createMenu, closeMenu };

js/modules/gui/display.mjs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,19 +1373,19 @@ class BrowserLayout {
13731373
text_color = settings.DarkMode ? '#ddd' : 'inherit',
13741374
input_style = settings.DarkMode ? `background-color: #222; color: ${text_color}` : '';
13751375

1376-
injectStyle(
1377-
'.jsroot_browser { pointer-events: none; position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 0px; border: 0px; overflow: hidden; }' +
1378-
`.jsroot_draw_area { background-color: ${bkgr_color}; overflow: hidden; margin: 0px; border: 0px; }` +
1379-
`.jsroot_browser_area { color: ${text_color}; background-color: ${bkgr_color}; font-size: 12px; font-family: Verdana; pointer-events: all; box-sizing: initial; }` +
1380-
`.jsroot_browser_area input { ${input_style} }` +
1381-
`.jsroot_browser_area select { ${input_style} }` +
1382-
`.jsroot_browser_title { font-family: Verdana; font-size: 20px; color: ${title_color}; }` +
1383-
'.jsroot_browser_btns { pointer-events: all; display: flex; flex-direction: column; }' +
1384-
'.jsroot_browser_area p { margin-top: 5px; margin-bottom: 5px; white-space: nowrap; }' +
1385-
'.jsroot_browser_hierarchy { flex: 1; margin-top: 2px; }' +
1386-
`.jsroot_status_area { background-color: ${bkgr_color}; overflow: hidden; font-size: 12px; font-family: Verdana; pointer-events: all; }` +
1387-
'.jsroot_browser_resize { position: absolute; right: 3px; bottom: 3px; margin-bottom: 0px; margin-right: 0px; opacity: 0.5; cursor: se-resize; z-index: 1; }',
1388-
this.main().node(), 'browser_layout_style');
1376+
injectStyle(`
1377+
.jsroot_browser { pointer-events: none; position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 0px; border: 0px; overflow: hidden; }
1378+
.jsroot_draw_area { background-color: ${bkgr_color}; overflow: hidden; margin: 0px; border: 0px; }
1379+
.jsroot_browser_area { color: ${text_color}; background-color: ${bkgr_color}; font-size: 12px; font-family: Verdana; pointer-events: all; box-sizing: initial; }
1380+
.jsroot_browser_area input { ${input_style} }
1381+
.jsroot_browser_area select { ${input_style} }
1382+
.jsroot_browser_title { font-family: Verdana; font-size: 20px; color: ${title_color}; }
1383+
.jsroot_browser_btns { pointer-events: all; display: flex; flex-direction: column; }
1384+
.jsroot_browser_area p { margin-top: 5px; margin-bottom: 5px; white-space: nowrap; }
1385+
.jsroot_browser_hierarchy { flex: 1; margin-top: 2px; }
1386+
.jsroot_status_area { background-color: ${bkgr_color}; overflow: hidden; font-size: 12px; font-family: Verdana; pointer-events: all; }
1387+
.jsroot_browser_resize { position: absolute; right: 3px; bottom: 3px; margin-bottom: 0px; margin-right: 0px; opacity: 0.5; cursor: se-resize; z-index: 1; }
1388+
`, this.main().node(), 'browser_layout_style');
13891389
}
13901390

13911391
/** @summary method used to create basic elements

js/modules/hist2d/THistPainter.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { gStyle, BIT, settings, constants, create, isObject, isFunc, isStr, getPromise,
22
clTList, clTPaveStats, clTPaletteAxis, clTProfile, clTProfile2D, clTProfile3D, clTPad,
3-
clTAxis, clTF1, clTF2, kNoZoom, clTCutG, kNoStats, kTitle, setHistogramTitle } from '../core.mjs';
3+
clTAxis, clTF1, clTF2, kNoZoom, clTCutG, kNoStats, kTitle, setHistogramTitle, addMethods } from '../core.mjs';
44
import { getColorPalette } from '../base/colors.mjs';
55
import { DrawOptions } from '../base/BasePainter.mjs';
66
import { ObjectPainter, EAxisBits, kAxisTime, kAxisLabels } from '../base/ObjectPainter.mjs';
@@ -1852,6 +1852,12 @@ class THistPainter extends ObjectPainter {
18521852

18531853
if (!histo.fFunctions)
18541854
histo.fFunctions = create(clTList);
1855+
else if (histo.fFunctions._typename !== clTList) {
1856+
// Fix - seen once in jupyter notebook that typename was TList*
1857+
console.error(`Fixing wrong typename ${histo.fFunctions._typename} for histogram list of functions`);
1858+
histo.fFunctions._typename = clTList;
1859+
addMethods(histo.fFunctions, clTList);
1860+
}
18551861

18561862
if (asfirst)
18571863
histo.fFunctions.AddFirst(obj);

0 commit comments

Comments
 (0)