TransWikia.com

Using “Show” property in Cesium to turn on and off visibility has a strange delay

Geographic Information Systems Asked by chatzich on October 3, 2021

I am loading some geometries through a datasource load promise like above:

Cesium.when(Cesium.CzmlDataSource.load(environment.apiBaseURL + `/geometry/all`), result => {
    this.dataSources = result;
    this.viewer.dataSources.add(this.dataSources);
});

and I am trying to switch their visibility with this callback above:

this.visibilitySubscription = this.store.visibility.subscribe(visibility=>{
        this.dataSources.show = visibility;
    });

but unfortunately the show/hide of the objects has a weird delay and I must scroll the mouse in order to see them hide or show

One Answer

I managed to solve this by adding the:

this.viewer.scene.requestRender();

right after

this.dataSources.show = visibility;

so the final solution is:

this.visibilitySubscription = this.store.visibility.subscribe(visibility=>{
        this.dataSources.show = visibility;
        this.viewer.scene.requestRender();
    });

Answered by chatzich on October 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP