Stop Globe rotation not working

49 views
Skip to first unread message

kulvin...@gmail.com

unread,
Apr 20, 2020, 2:46:33 PM4/20/20
to cesium-dev
1. A concise explanation of the problem you're experiencing.
Stop Globe rotation function not working


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;

function spinGlobe( dynamicRate ){
    var previousTime = Date.now();

    viewer.scene.postRender.addEventListener(function (scene, time){
        var spinRate = dynamicRate;
        var currentTime = Date.now();
        var delta = ( currentTime - previousTime ) / 1000;
        previousTime = currentTime;
        viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, spinRate * delta);
    });
}


function stopglobe() {
        //console.log('hjhggh');
     spinGlobe(0.0);
     viewer.scene.postRender.removeEventListener(spinGlobe);
    
}



Sandcastle.addToolbarMenu([
    
    {
   
    text : 'Select',
     
},
    
    
    {
   
    text : 'Spin Globe',
    onselect : function() {
        spinGlobe(0.08);
        
    }
}, {
    text : 'Stop GlobeRotation',
    onselect : function() {
        stopglobe(0.0);
     viewer.scene.postRender.removeEventListener(spinGlobe);

    }

}]);

Sandcastle.reset = function() {
    viewer.entities.removeAll();
};



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
Project requirement


4. The Cesium version you're using, your operating system and browser.
1.68


kulvin...@gmail.com

unread,
Apr 22, 2020, 4:07:33 PM4/22/20
to cesium-dev
Anybody?

kulvin...@gmail.com

unread,
Apr 24, 2020, 2:18:04 PM4/24/20
to cesium-dev
This has been fixed. Thanks for viewing the issue though!

Omar Shehata

unread,
May 4, 2020, 1:08:44 PM5/4/20
to cesium-dev
Glad to hear this has been fixed! Would you mind posting your solution on the new forum here: https://community.cesium.com/t/stop-globe-rotation-not-working/9393 ?

Note that the forum has transitioned over to Discourse and this Google Group will be put into read-only mode today. Details about the transition here.
Reply all
Reply to author
Forward
0 new messages