@@ -3219,41 +3219,65 @@ JSROOT.define(['d3', 'three', 'geobase', 'painter', 'base3d'], (d3, THREE, geo,
32193219 return this . drawCount ( uniquevis , spent ) ;
32203220 }
32213221
3222+ let promise = Promise . resolve ( true ) ;
3223+
32223224 if ( ! this . _scene ) {
32233225
32243226 // this is limit for the visible faces, number of volumes does not matter
32253227 this . ctrl . maxlimit = ( this . _webgl ? 200000 : 100000 ) * this . ctrl . more ;
32263228
32273229 this . _first_drawing = true ;
32283230
3229- // activate worker
3230- if ( this . ctrl . use_worker > 0 ) this . startWorker ( ) ;
3231+ this . _on_pad = ! ! this . getPadPainter ( ) ;
32313232
3232- jsrp . assign3DHandler ( this ) ;
3233+ if ( this . _on_pad ) {
3234+ promise = jsrp . ensureTCanvas ( this , "3d" ) . then ( ( ) => {
32333235
3234- let size = this . getSizeFor3d ( this . _webgl ? undefined : 3 ) ;
3236+ let fp = this . getFramePainter ( ) ,
3237+ render3d = jsrp . getRender3DKind ( ) ;
3238+ jsrp . assign3DHandler ( fp ) ;
32353239
3236- this . _fit_main_area = ( size . can3d === - 1 ) ;
3240+ let size = fp . getSizeFor3d ( undefined , render3d ) ;
32373241
3238- let dom = this . createScene ( size . width , size . height ) ;
3242+ this . _fit_main_area = ( size . can3d === - 1 ) ;
32393243
3240- this . add3dCanvas ( size , dom , this . _webgl ) ;
3244+ let dom = this . createScene ( size . width , size . height ) ;
32413245
3242- // set top painter only when first child exists
3243- this . setAsMainPainter ( ) ;
3246+ fp . add3dCanvas ( size , dom , render3d === JSROOT . constants . Render3D . WebGL ) ;
3247+ } ) ;
3248+
3249+ } else {
3250+ // activate worker
3251+ if ( this . ctrl . use_worker > 0 ) this . startWorker ( ) ;
3252+
3253+ jsrp . assign3DHandler ( this ) ;
3254+
3255+ let size = this . getSizeFor3d ( this . _webgl ? undefined : 3 ) ;
3256+
3257+ this . _fit_main_area = ( size . can3d === - 1 ) ;
3258+
3259+ let dom = this . createScene ( size . width , size . height ) ;
3260+
3261+ this . add3dCanvas ( size , dom , this . _webgl ) ;
3262+
3263+ // set top painter only when first child exists
3264+ this . setAsMainPainter ( ) ;
3265+ }
32443266 }
32453267
3246- this . createToolbar ( ) ;
3268+ return promise . then ( ( ) => {
3269+ this . createToolbar ( ) ;
32473270
3248- if ( this . _clones )
3249- return new Promise ( resolveFunc => {
3250- this . _resolveFunc = resolveFunc ;
3251- this . showDrawInfo ( "Drawing geometry" ) ;
3252- this . startDrawGeometry ( true ) ;
3253- } ) ;
3271+ if ( this . _clones )
3272+ return new Promise ( resolveFunc => {
3273+ this . _resolveFunc = resolveFunc ;
3274+ this . showDrawInfo ( "Drawing geometry" ) ;
3275+ this . startDrawGeometry ( true ) ;
3276+ } ) ;
32543277
3255- this . completeDraw ( ) ;
3256- return Promise . resolve ( this ) ;
3278+ this . completeDraw ( ) ;
3279+ return this ;
3280+ } ) ;
32573281 }
32583282
32593283 /** @summary methods show info when first geometry drawing is performed */
@@ -4021,7 +4045,7 @@ JSROOT.define(['d3', 'three', 'geobase', 'painter', 'base3d'], (d3, THREE, geo,
40214045
40224046 this . clearTopPainter ( ) ; // remove as pointer
40234047
4024- let can3d = this . clear3dCanvas ( ) ; // remove 3d canvas from main HTML element
4048+ let can3d = this . _on_pad ? 0 : this . clear3dCanvas ( ) ; // remove 3d canvas from main HTML element
40254049
40264050 if ( this . _toolbar ) this . _toolbar . cleanup ( ) ; // remove toolbar
40274051
0 commit comments