globe.gl icon indicating copy to clipboard operation
globe.gl copied to clipboard

Callback function to invoke after all globe elements are initialized and visible on the scene?

Open ElviraKukhtaruk opened this issue 1 year ago • 0 comments

Sometimes when I need to access THREE object (example):

globe
         .labelsData(labelsData)
         .labelText(...)
         .labelAltitude(...)
         .labelSize(...)
         ...;

function get_bBox() {
    let three_obj = labelsData.__threeObj.children[0];
    let bBox = new THREE.Box3().setFromObject(three_obj);
    console.log(bBox); // max:  { x: 10, y: 77, z: 64 } min: { x: 9, y: 77, z: 64 }
}

get_bBox();

setTimeout(function(){
      get_bBox(); // max: { x: 12, y: 76, z: 66 } min: { x: 7, y: 75, z: 65 }
}, 1000);

I need to wait (~1s) until I get correct bounding box values. Is there a way to get correct values without waiting? Thank you in advance.

ElviraKukhtaruk avatar Jun 04 '24 14:06 ElviraKukhtaruk