Skip to content

Commit

Permalink
[jsroot] 7.5.pre 28/09/2023 with TPaletteAxis fixes
Browse files Browse the repository at this point in the history
1. Properly redirect context menu commands to histogram Z axis
2. When moving palette - send updates back to the server
3. Improve HierarchyPainter Draw/Expand/Unexpand context menu commands
  • Loading branch information
linev committed Sep 28, 2023
1 parent 6e556ce commit ef2ff08
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 223 deletions.
272 changes: 161 additions & 111 deletions js/build/jsroot.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions js/modules/base/ObjectPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,26 @@ class ObjectPainter extends BasePainter {
return c;
}

/** @summary Assign unique identifier for the painter
* @private */
getUniqueId() {
if (this._unique_painter_id === undefined)
this._unique_painter_id = internals.id_counter++; // assign unique identifier
return this._unique_painter_id;
}

/** @summary Assign secondary id
* @private */
setSecondaryId(main) {
this._main_painter_id = main.getUniqueId();
}

/** @summary Check if this is secondary painter
* @private */
isSecondaryPainter(main) {
return this._main_painter_id === main.getUniqueId();
}

/** @summary Provides identifier on server for requested sublement */
getSnapId(subelem) {
if (!this.snapid)
Expand Down
2 changes: 1 addition & 1 deletion js/modules/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const version_id = '7.5.pre',

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
version_date = '27/09/2023',
version_date = '28/09/2023',

/** @summary version id and date
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
Expand Down
17 changes: 9 additions & 8 deletions js/modules/draw.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ async function import_geo() {

const clTGraph2D = 'TGraph2D', clTH2Poly = 'TH2Poly', clTEllipse = 'TEllipse',
clTSpline3 = 'TSpline3', clTTree = 'TTree', clTCanvasWebSnapshot = 'TCanvasWebSnapshot',
fPrimitives = 'fPrimitives', fFunctions = 'fFunctions',

/** @summary list of registered draw functions
* @private */
drawFuncs = { lst: [
{ name: clTCanvas, icon: 'img_canvas', class: () => import_canvas().then(h => h.TCanvasPainter), opt: ';grid;gridx;gridy;tick;tickx;ticky;log;logx;logy;logz', expand_item: 'fPrimitives', noappend: true },
{ name: clTPad, icon: 'img_canvas', func: TPadPainter.draw, opt: ';grid;gridx;gridy;tick;tickx;ticky;log;logx;logy;logz', expand_item: 'fPrimitives', noappend: true },
{ name: clTCanvas, icon: 'img_canvas', class: () => import_canvas().then(h => h.TCanvasPainter), opt: ';grid;gridx;gridy;tick;tickx;ticky;log;logx;logy;logz', expand_item: fPrimitives, noappend: true },
{ name: clTPad, icon: 'img_canvas', func: TPadPainter.draw, opt: ';grid;gridx;gridy;tick;tickx;ticky;log;logx;logy;logz', expand_item: fPrimitives, noappend: true },
{ name: 'TSlider', icon: 'img_canvas', func: TPadPainter.draw },
{ name: clTButton, icon: 'img_canvas', func: TPadPainter.draw },
{ name: 'TFrame', icon: 'img_frame', draw: () => import_canvas().then(h => h.drawTFrame) },
Expand All @@ -54,14 +55,14 @@ drawFuncs = { lst: [
{ name: clTMathText, sameas: clTLatex },
{ name: clTText, sameas: clTLatex },
{ name: clTAnnotation, sameas: clTLatex },
{ name: /^TH1/, icon: 'img_histo1d', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';hist;P;P0;E;E1;E2;E3;E4;E1X0;L;LF2;C;B;B1;A;TEXT;LEGO;same', ctrl: 'l' },
{ name: clTProfile, icon: 'img_profile', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';E0;E1;E2;p;AH;hist' },
{ name: /^TH1/, icon: 'img_histo1d', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';hist;P;P0;E;E1;E2;E3;E4;E1X0;L;LF2;C;B;B1;A;TEXT;LEGO;same', ctrl: 'l', expand_item: fFunctions },
{ name: clTProfile, icon: 'img_profile', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';E0;E1;E2;p;AH;hist', expand_item: fFunctions },
{ name: clTH2Poly, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').then(h => h.TH2Painter), opt: ';COL;COL0;COLZ;LCOL;LCOL0;LCOLZ;LEGO;TEXT;same', expand_item: 'fBins', theonly: true },
{ name: 'TProfile2Poly', sameas: clTH2Poly },
{ name: 'TH2PolyBin', icon: 'img_histo2d', draw_field: 'fPoly', draw_field_opt: 'L' },
{ name: /^TH2/, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').then(h => h.TH2Painter), dflt: 'col', opt: ';COL;COLZ;COL0;COL1;COL0Z;COL1Z;COLA;BOX;BOX1;PROJ;PROJX1;PROJX2;PROJX3;PROJY1;PROJY2;PROJY3;SCAT;TEXT;TEXTE;TEXTE0;CANDLE;CANDLE1;CANDLE2;CANDLE3;CANDLE4;CANDLE5;CANDLE6;CANDLEY1;CANDLEY2;CANDLEY3;CANDLEY4;CANDLEY5;CANDLEY6;VIOLIN;VIOLIN1;VIOLIN2;VIOLINY1;VIOLINY2;CONT;CONT1;CONT2;CONT3;CONT4;ARR;SURF;SURF1;SURF2;SURF4;SURF6;E;A;LEGO;LEGO0;LEGO1;LEGO2;LEGO3;LEGO4;same', ctrl: 'lego' },
{ name: /^TH2/, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').then(h => h.TH2Painter), dflt: 'col', opt: ';COL;COLZ;COL0;COL1;COL0Z;COL1Z;COLA;BOX;BOX1;PROJ;PROJX1;PROJX2;PROJX3;PROJY1;PROJY2;PROJY3;SCAT;TEXT;TEXTE;TEXTE0;CANDLE;CANDLE1;CANDLE2;CANDLE3;CANDLE4;CANDLE5;CANDLE6;CANDLEY1;CANDLEY2;CANDLEY3;CANDLEY4;CANDLEY5;CANDLEY6;VIOLIN;VIOLIN1;VIOLIN2;VIOLINY1;VIOLINY2;CONT;CONT1;CONT2;CONT3;CONT4;ARR;SURF;SURF1;SURF2;SURF4;SURF6;E;A;LEGO;LEGO0;LEGO1;LEGO2;LEGO3;LEGO4;same', ctrl: 'lego', expand_item: fFunctions },
{ name: clTProfile2D, sameas: clTH2 },
{ name: /^TH3/, icon: 'img_histo3d', class: () => import('./hist/TH3Painter.mjs').then(h => h.TH3Painter), opt: ';SCAT;BOX;BOX2;BOX3;GLBOX1;GLBOX2;GLCOL' },
{ name: /^TH3/, icon: 'img_histo3d', class: () => import('./hist/TH3Painter.mjs').then(h => h.TH3Painter), opt: ';SCAT;BOX;BOX2;BOX3;GLBOX1;GLBOX2;GLCOL', expand_item: fFunctions },
{ name: clTProfile3D, sameas: clTH3 },
{ name: clTHStack, icon: 'img_histo1d', class: () => import('./hist/THStackPainter.mjs').then(h => h.THStackPainter), expand_item: 'fHists', opt: 'NOSTACK;HIST;E;PFC;PLC' },
{ name: clTPolyMarker3D, icon: 'img_histo3d', draw: () => import('./draw/draw3d.mjs').then(h => h.drawPolyMarker3D), direct: true, frame: '3d' },
Expand Down Expand Up @@ -144,8 +145,8 @@ drawFuncs = { lst: [
{ name: 'Session', icon: 'img_globe' },
{ name: 'kind:TopFolder', icon: 'img_base' },
{ name: 'kind:Folder', icon: 'img_folder', icon2: 'img_folderopen', noinspect: true },
{ name: nsREX+'RCanvas', icon: 'img_canvas', class: () => init_v7().then(h => h.RCanvasPainter), opt: '', expand_item: 'fPrimitives' },
{ name: nsREX+'RCanvasDisplayItem', icon: 'img_canvas', draw: () => init_v7().then(h => h.drawRPadSnapshot), opt: '', expand_item: 'fPrimitives' },
{ name: nsREX+'RCanvas', icon: 'img_canvas', class: () => init_v7().then(h => h.RCanvasPainter), opt: '', expand_item: fPrimitives },
{ name: nsREX+'RCanvasDisplayItem', icon: 'img_canvas', draw: () => init_v7().then(h => h.drawRPadSnapshot), opt: '', expand_item: fPrimitives },
{ name: nsREX+'RHist1Drawable', icon: 'img_histo1d', class: () => init_v7('rh1').then(h => h.RH1Painter), opt: '' },
{ name: nsREX+'RHist2Drawable', icon: 'img_histo2d', class: () => init_v7('rh2').then(h => h.RH2Painter), opt: '' },
{ name: nsREX+'RHist3Drawable', icon: 'img_histo3d', class: () => init_v7('rh3').then(h => h.RH3Painter), opt: '' },
Expand Down
2 changes: 1 addition & 1 deletion js/modules/draw/TGaxisPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TGaxisPainter extends TAxisPainter {
gaxis.fY1 = gaxis.fY2 = fy;
}

this.submitAxisExec(`SetX1(${gaxis.fX1});;SetX2(${gaxis.fX2});;SetY1(${gaxis.fY1});;SetY2(${gaxis.fY2})`);
this.submitAxisExec(`SetX1(${gaxis.fX1});;SetX2(${gaxis.fX2});;SetY1(${gaxis.fY1});;SetY2(${gaxis.fY2})`, true);
}

/** @summary Redraw axis, used in standalone mode for TGaxis */
Expand Down
1 change: 0 additions & 1 deletion js/modules/gpad/RAxisPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ class RAxisPainter extends RObjectPainter {
else
this.titlePos = 'right';


this.changeAxisAttr(0, 'title_position', this.titlePos, 'title_offset', this.titleOffset / this.scalingSize);

drag_rect.remove();
Expand Down
6 changes: 1 addition & 5 deletions js/modules/gpad/RPadPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ class RPadPainter extends RObjectPainter {
} else
svg.style('display', null);


if (this._fixed_size) {
svg.attr('x', 0)
.attr('y', 0)
Expand All @@ -394,10 +393,7 @@ class RPadPainter extends RObjectPainter {
.style('width', '100%')
.style('height', '100%')
.style('position', 'absolute')
.style('left', 0)
.style('top', 0)
.style('right', 0)
.style('bottom', 0);
.style('inset', '0px');
}

svg.style('filter', settings.DarkMode ? 'invert(100%)' : null);
Expand Down
19 changes: 11 additions & 8 deletions js/modules/gpad/TAxisPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -836,10 +836,15 @@ class TAxisPainter extends ObjectPainter {
.property('shift_y', new_y);

const axis = this.getObject(), abits = EAxisBits,
set_bit = (bit, on) => { if (axis.TestBit(bit) !== on) axis.InvertBit(bit); };
axis2 = this.source_axis,
set_bit = (bit, on) => {
if (axis.TestBit(bit) !== on) axis.InvertBit(bit);
if (axis2 && axis2.TestBit(bit) !== on) axis2.InvertBit(bit);
};

this.titleOffset = (vertical ? new_x : new_y) / offset_k;
axis.fTitleOffset = this.titleOffset / this.offsetScaling / this.titleSize;
if (axis2) axis2.fTitleOffset = axis.fTitleOffset;

if (curr_indx === 1) {
set_bit(abits.kCenterTitle, true); this.titleCenter = true;
Expand Down Expand Up @@ -870,14 +875,12 @@ class TAxisPainter extends ObjectPainter {

/** @summary Submit exec for the axis - if possible
* @private */
submitAxisExec(exec) {
if (this.is_gaxis)
submitAxisExec(exec, only_gaxis) {
const snapid = this.hist_painter?.snapid;
if (snapid && this.hist_axis && !only_gaxis)
this.submitCanvExec(exec, `${snapid}#${this.hist_axis}`);
else if (this.is_gaxis)
this.submitCanvExec(exec);
else {
const snapid = this.hist_painter?.snapid;
if (snapid && this.hist_axis)
this.submitCanvExec(exec, `${snapid}#${this.hist_axis}`);
}
}

/** @summary Produce svg path for axis ticks */
Expand Down
2 changes: 1 addition & 1 deletion js/modules/gpad/TCanvasPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class TCanvasPainter extends TPadPainter {
if (this._readonly || !painter) return;

if (!snapid) snapid = painter.snapid;
if (snapid && isStr(snapid))
if (snapid && isStr(snapid) && exec)
return this.sendWebsocket(`OBJEXEC:${snapid}:${exec}`);
}

Expand Down
Loading

0 comments on commit ef2ff08

Please sign in to comment.