Jsroot custom html projection setting

Hi ,
I am creating custom a custom event display in which I would like to have three views : in addition to a perspective also top and side view. Unfortunately, I cannot set the view. Part of my code is below.

Cheers, Rok

     gDivList= ["viewxyz","viewx","viewy"]
     let geom_file = "belle2_geom.json";
     async function draw_geometry_and_tracks( divlist ) {
        let obj    = await JSROOT.httpRequest(geom_file, "object");
        let tracks = await getTracks(0);
        divlist.forEach(function( view, index) {
          console.log(view)
          JSROOT.draw(view, obj).then( (painter)=>{
            switch ( view ) {
              case 'viewxyz' :  painter.ctrl.highlight=0;             break;
              case 'viewx'   :  painter.setCameraPosition(0,0,0)     ;break;
              case 'viewy'   :  painter.ctrl.ortho_camera=true;       break;
            }
            console.log(painter)
            painter.drawExtras(tracks, "tracks");
          });
        });
     }

     draw_geometry_and_tracks(gDivList);

eventDisplay


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi Rok,

To specify camera position or change highlight setting, one should use draw option - third parameter
in JSROOT.draw function. Please see available draw options in JSROOT examples. Like this one:

https://root.cern/js/latest/examples.htm#tgeo_proj

Different kind of projections are drawn using draw options like “projz” or “projx”.
There is also possibility to specify camera direction using URL parameters:

https://root.cern/js/latest/examples.htm#tgeo_camera

Such parameters you can get via context menu command “Get camera position”

Some available draw options for geometry can be seen in documentation

Regards,
Sergey

P.S. I edit post to reformat links

Thanks.
It works now.
Regards, Rok

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.