Skip to content

Commit 77a38cd

Browse files
committed
Introduce build3d for TCanvas
1 parent 5164976 commit 77a38cd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

modules/gpad/TCanvasPainter.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,20 @@ class TCanvasPainter extends TPadPainter {
936936
this.getWebsocket()?.resizeWindow(fullW, fullH);
937937
}
938938

939+
/** @summary create three.js object for TCanvas */
940+
static async build3d(can, opt, get_painter) {
941+
const painter = new TCanvasPainter(null, can, opt, true);
942+
painter.checkSpecialsInPrimitives(can, true);
943+
944+
const fp = new TFramePainter(null, null);
945+
// return dummy frame painter as result
946+
painter.getFramePainter = () => fp;
947+
948+
return painter.drawPrimitives().then(() => {
949+
return get_painter ? painter : fp.create3DScene(-1, true);
950+
});
951+
}
952+
939953
/** @summary draw TCanvas */
940954
static async draw(dom, can, opt) {
941955
const nocanvas = !can;

0 commit comments

Comments
 (0)