Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions demo/build3d.htm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@
let server = 'https://root.cern/js/files/',
filename = server + 'hsimple.root',
filename2 = server + 'graph2d.root',
filename3 = server + 'geom/simple_alice.json.gz';
filename3 = server + 'geom/simple_alice.json.gz',
filename4 = server + 'tutorials_fit.root';


let file = await openFile(filename);
let hist2 = await file.readObject('hpxpy');
Expand All @@ -126,9 +128,10 @@

await create3d(hist3, 'box3', -150, '#color[2]{TH3} #color[4]{box} plot');

let hist1 = await file.readObject('hpx');
let file4 = await openFile(filename4);
let canv = await file4.readObject('fit2a');

await create3d(hist1, 'lego2', 400, '#color[2]{TH1} #color[4]{lego} plot');
await create3d(canv, '', 400, '#color[2]{TCanvas} with #color[4]{TH2} and #color[4]{TF2}');

let geom = await httpRequest(filename3, 'object');
await create3d(geom, '', -400, '#color[2]{Geometry} build', 0.2);
Expand Down
5 changes: 5 additions & 0 deletions modules/draw/TTextPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class TTextPainter extends ObjectPainter {
pp = this.getPadPainter(),
fp = this.getFramePainter(),
is_url = text.fName.startsWith('http://') || text.fName.startsWith('https://');

// special handling of dummy frame painter
if (fp?.getDrawDom() === null)
return this;

let fact = 1, use_frame = false;

this.createAttText({ attr: text });
Expand Down
14 changes: 14 additions & 0 deletions modules/gpad/TCanvasPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,20 @@ class TCanvasPainter extends TPadPainter {
this.getWebsocket()?.resizeWindow(fullW, fullH);
}

/** @summary create three.js object for TCanvas */
static async build3d(can, opt, get_painter) {
const painter = new TCanvasPainter(null, can, opt, true);
painter.checkSpecialsInPrimitives(can, true);

const fp = new TFramePainter(null, null);
// return dummy frame painter as result
painter.getFramePainter = () => fp;

return painter.drawPrimitives().then(() => {
return get_painter ? painter : fp.create3DScene(-1, true);
});
}

/** @summary draw TCanvas */
static async draw(dom, can, opt) {
const nocanvas = !can;
Expand Down
5 changes: 5 additions & 0 deletions modules/hist/TPavePainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ class TPavePainter extends ObjectPainter {
opt = this.getPaveDrawOption().toUpperCase(),
fp = this.getFramePainter(), pp = this.getPadPainter(),
pad = pp.getRootPad(true);

// special handling of dummy frame painter
if (fp?.getDrawDom() === null)
return this;

let interactive_element, width, height;

if (pt.fInit === 0) {
Expand Down