@@ -74659,46 +74659,42 @@ class TooltipFor3D {
7465974659
7466074660 /** @summary Show tooltip */
7466174661 show(v /* , mouse_pos, status_func */) {
74662- if (!v)
74663- return this.hide();
74662+ let lines;
74663+ if (v && isObject(v) && (v.lines || v.line)) {
74664+ if (!v.only_status)
74665+ lines = v.line ? [v.line] : v.lines;
74666+ } else if (isStr(v))
74667+ lines = [v];
7466474668
74665- if (isObject(v) && (v.lines || v.line)) {
74666- if (v.only_status)
74667- return this.hide();
74669+ const doc = this.parent.ownerDocument;
7466874670
74669- if (v.line)
74670- v = v.line;
74671- else {
74672- let res = v.lines[0];
74673- for (let n = 1; n < v.lines.length; ++n)
74674- res += '<br/>' + v.lines[n];
74675- v = res;
74676- }
74677- }
74671+ if (!lines || !doc)
74672+ return this.hide();
7467874673
74679- if (this.tt === null) {
74680- const doc = getDocument();
74674+ if (!this.tt) {
7468174675 this.tt = doc.createElement('div');
74682- this.tt.setAttribute('style', 'opacity: 1; filter: alpha(opacity=1); position: absolute; display: block; overflow: hidden; z-index: 101;');
74676+ this.tt.setAttribute('style', 'opacity: 1; filter: alpha(opacity=1); position: absolute; display: block; width: auto; overflow: hidden; z-index: 101;');
7468374677 this.cont = doc.createElement('div');
7468474678 this.cont.setAttribute('style', 'display: block; padding: 5px; margin-left: 5px; font-size: 11px; line-height: 18px; background: #777; color: #fff;');
7468574679 this.tt.appendChild(this.cont);
7468674680 this.parent.appendChild(this.tt);
7468774681 }
7468874682
74689- if (this.lastlbl !== v) {
74690- this.cont.innerHTML = this.lastlbl = v;
74691- this.tt.style.width = 'auto'; // let it be automatically resizing...
74692- }
74683+ this.cont.innerText = '';
74684+ lines.forEach(lbl => {
74685+ const p = doc.createElement('p');
74686+ p.innerText = lbl;
74687+ p.setAttribute('style', 'padding: 0px; margin: 1px;');
74688+ this.cont.appendChild(p);
74689+ });
7469374690 }
7469474691
7469574692 /** @summary Hide tooltip */
7469674693 hide() {
7469774694 if (this.tt)
7469874695 this.parent.removeChild(this.tt);
7469974696
74700- this.tt = null;
74701- this.lastlbl = '';
74697+ this.tt = this.cont = null;
7470274698 }
7470374699
7470474700} // class TooltipFor3D
@@ -74956,20 +74952,21 @@ function createOrbitControl(painter, camera, scene, renderer, lookat) {
7495674952
7495774953 control.getInfoAtMousePosition = function(mouse_pos) {
7495874954 const intersects = this.getMouseIntersects(mouse_pos);
74959- let tip = null, _painter = null;
74955+ let tip = null, p = null;
7496074956
7496174957 for (let i = 0; i < intersects.length; ++i) {
74962- if (intersects[i].object.tooltip) {
74963- tip = intersects[i].object.tooltip(intersects[i]);
74964- _painter = intersects[i].object.painter;
74958+ const obj3d = intersects[i].object;
74959+ if (isFunc(obj3d?.tooltip)) {
74960+ tip = obj3d.tooltip(intersects[i]);
74961+ p = obj3d.tip_painter || obj3d.painter || tip?.$painter;
7496574962 break;
7496674963 }
7496774964 }
7496874965
74969- if (tip && _painter ) {
74966+ if (tip && p ) {
7497074967 return {
74971- obj: _painter .getObject(),
74972- name: _painter .getObject().fName,
74968+ obj: p .getObject(),
74969+ name: p .getObject().fName,
7497374970 bin: tip.bin, cont: tip.value,
7497474971 binx: tip.ix, biny: tip.iy, binz: tip.iz,
7497574972 grx: (tip.x1 + tip.x2) / 2, gry: (tip.y1 + tip.y2) / 2, grz: (tip.z1 + tip.z2) / 2
@@ -79007,7 +79004,7 @@ class JSRootMenu {
7900779004 title = name;
7900879005 if (title)
7900979006 title += `, code ${id}`;
79010- this.addchk((id === curr) || more, '<nobr>' + name + '</nobr>' , id, set_func, title || name);
79007+ this.addchk((id === curr) || more, name, id, set_func, title || name);
7901179008 };
7901279009
7901379010 this.sub('Palette', () => this.input('Enter palette code [1..113]', curr, 'int', 1, 113).then(set_func));
@@ -80142,10 +80139,7 @@ class StandaloneMenu extends JSRootMenu {
8014280139 }
8014380140
8014480141 const sub = doc.createElement('span');
80145- if (d.text.indexOf('<nobr>') === 0)
80146- sub.textContent = d.text.slice(6, d.text.length - 7);
80147- else
80148- sub.textContent = d.text;
80142+ sub.textContent = d.text;
8014980143 text.appendChild(sub);
8015080144 }
8015180145
@@ -87004,7 +86998,7 @@ class BrowserLayout {
8700486998 for (let n = 0; n < 4; ++n) {
8700586999 const lbl = this.status_layout.getGridFrame(n).querySelector('label');
8700687000 maxh = Math.max(maxh, lbl.clientHeight);
87007- lbl.innerHTML = msgs[n] || '';
87001+ lbl.innerText = msgs[n] || '';
8700887002 }
8700987003
8701087004 if (!this.status_layout.first_check) {
@@ -101700,7 +101694,7 @@ function _lineErrToolTip(intersect) {
101700101694 const pos = Math.floor(intersect.index / 6);
101701101695 if ((pos < 0) || (pos >= this.intersect_index.length))
101702101696 return null;
101703- const p = this.painter ,
101697+ const p = this.tip_painter ,
101704101698 histo = p.getHisto(),
101705101699 fp = p.getFramePainter(),
101706101700 tip = p.get3DToolTip(this.intersect_index[pos]),
@@ -101805,7 +101799,7 @@ function drawBinsError3D(painter, is_v7 = false) {
101805101799 material = new THREE.LineBasicMaterial(getMaterialArgs(lcolor, { linewidth: is_v7 ? painter.v7EvalAttr('line_width', 1) : histo.fLineWidth })),
101806101800 line = createLineSegments(lpos, material);
101807101801
101808- line.painter = painter;
101802+ line.tip_painter = painter;
101809101803 line.intersect_index = binindx;
101810101804 line.zmin = zmin;
101811101805 line.zmax = zmax;
@@ -104458,15 +104452,15 @@ class TH3Painter extends THistPainter {
104458104452 fp.add3DMesh(mesh);
104459104453
104460104454 mesh.bins = bins;
104461- mesh.painter = this;
104455+ mesh.tip_painter = this;
104462104456 mesh.tip_color = histo.fMarkerColor === 3 ? 0xFF0000 : 0x00FF00;
104463104457
104464104458 mesh.tooltip = function(intersect) {
104465104459 const indx = Math.floor(intersect.index / this.nvertex);
104466104460 if ((indx < 0) || (indx >= this.bins.length))
104467104461 return null;
104468104462
104469- const p = this.painter ,
104463+ const p = this.tip_painter ,
104470104464 thisto = p.getHisto(),
104471104465 tip = p.get3DToolTip(this.bins[indx]);
104472104466
@@ -104649,7 +104643,7 @@ class TH3Painter extends THistPainter {
104649104643 }
104650104644 }
104651104645
104652- function getBinTooltip (intersect) {
104646+ function _getBinTooltip (intersect) {
104653104647 let binid = this.binid;
104654104648
104655104649 if (binid === undefined) {
@@ -104658,7 +104652,7 @@ class TH3Painter extends THistPainter {
104658104652 binid = this.bins[intersect.instanceId];
104659104653 }
104660104654
104661- const p = this.painter ,
104655+ const p = this.tip_painter ,
104662104656 thisto = p.getHisto(),
104663104657 tip = p.get3DToolTip(binid),
104664104658 grx1 = fp.grx(thisto.fXaxis.GetBinCoord(tip.ix - 1)),
@@ -104691,12 +104685,12 @@ class TH3Painter extends THistPainter {
104691104685
104692104686 bin_mesh.applyMatrix4(bins_matrixes[n]);
104693104687
104694- bin_mesh.painter = this;
104688+ bin_mesh.tip_painter = this;
104695104689 bin_mesh.binid = bins_ids[n];
104696104690 bin_mesh.tipscale = tipscale;
104697104691 bin_mesh.tip_color = (histo.fFillColor === 3) ? 0xFF0000 : 0x00FF00;
104698104692 bin_mesh.get_weight = get_bin_weight;
104699- bin_mesh.tooltip = getBinTooltip ;
104693+ bin_mesh.tooltip = _getBinTooltip ;
104700104694
104701104695 fp.add3DMesh(bin_mesh);
104702104696 }
@@ -104714,12 +104708,12 @@ class TH3Painter extends THistPainter {
104714104708 all_bins_mesh.setColorAt(n, new THREE.Color(bins_colors[n]));
104715104709 }
104716104710
104717- all_bins_mesh.painter = this;
104711+ all_bins_mesh.tip_painter = this;
104718104712 all_bins_mesh.bins = bins_ids;
104719104713 all_bins_mesh.tipscale = tipscale;
104720104714 all_bins_mesh.tip_color = (histo.fFillColor === 3) ? 0xFF0000 : 0x00FF00;
104721104715 all_bins_mesh.get_weight = get_bin_weight;
104722- all_bins_mesh.tooltip = getBinTooltip ;
104716+ all_bins_mesh.tooltip = _getBinTooltip ;
104723104717
104724104718 fp.add3DMesh(all_bins_mesh);
104725104719 }
@@ -119123,7 +119117,7 @@ class TGeoPainter extends ObjectPainter {
119123119117 info.setAttribute('style', 'position: absolute; text-align: center; vertical-align: middle; top: 45%; left: 40%; color: red; font-size: 150%;');
119124119118 main.append(info);
119125119119 }
119126- info.innerHTML = `${msg}, ${spent.toFixed(1)}s`;
119120+ info.innerText = `${msg}, ${spent.toFixed(1)}s`;
119127119121 }
119128119122 }
119129119123
@@ -171465,7 +171459,7 @@ class TGraphDelaunay {
171465171459} // class TGraphDelaunay
171466171460
171467171461/** @summary Function handles tooltips in the mesh */
171468- function graph2DTooltip (intersect) {
171462+ function _graph2DTooltip (intersect) {
171469171463 let indx = Math.floor(intersect.index / this.nvertex);
171470171464 if ((indx < 0) || (indx >= this.index.length))
171471171465 return null;
@@ -171972,8 +171966,7 @@ class TGraph2DPainter extends ObjectPainter {
171972171966 linemesh.tip_color = (graph.fMarkerColor === 3) ? 0xFF0000 : 0x00FF00;
171973171967 linemesh.nvertex = 2;
171974171968 linemesh.check_next = true;
171975-
171976- linemesh.tooltip = graph2DTooltip;
171969+ linemesh.tooltip = _graph2DTooltip;
171977171970 }
171978171971
171979171972 if (err) {
@@ -171989,8 +171982,7 @@ class TGraph2DPainter extends ObjectPainter {
171989171982 errmesh.tip_name = this.getObjectHint();
171990171983 errmesh.tip_color = (graph.fMarkerColor === 3) ? 0xFF0000 : 0x00FF00;
171991171984 errmesh.nvertex = 6;
171992-
171993- errmesh.tooltip = graph2DTooltip;
171985+ errmesh.tooltip = _graph2DTooltip;
171994171986 }
171995171987
171996171988 if (pnts) {
@@ -172005,9 +171997,8 @@ class TGraph2DPainter extends ObjectPainter {
172005171997 mesh.tip_color = (graph.fMarkerColor === 3) ? 0xFF0000 : 0x00FF00;
172006171998 mesh.scale0 = 0.3 * scale;
172007171999 mesh.index = index;
172008-
172009172000 mesh.tip_name = this.getObjectHint();
172010- mesh.tooltip = graph2DTooltip ;
172001+ mesh.tooltip = _graph2DTooltip ;
172011172002 fp.add3DMesh(mesh, this);
172012172003 });
172013172004
0 commit comments