WebScene Slides not applying

2360
11
07-04-2021 10:32 PM
JethroLeevers
Occasional Contributor

Hi All,

 

I have been having issues with the WebScene slides.

It seems to be an issue with the visibleLayers properties of the slides not being populated.

Sometimes they work fine, other times the visibleLayers property contains no items and hence the slide does not appear to work when using the applyTo function.

 

Regards,

Jethro

Tags (3)
0 Kudos
11 Replies
JethroLeevers
Occasional Contributor

Thanks Raluca and John,

Waiting for loadAll to do anything give me a long wait before anything happens on screen.

Is the following a way to avoid this:

const map = new WebScene({...});
const view = new SceneView({...}); // map not set
map.when( ()=>{
 view.map = map;
});
map.loadAll().then( ()=>{
 // Good to do change layer properties now? e.g. listMode, popupEnabled, outFields
 view.when( ()=> {
  // All good to do anything
 });
})

 Jethro

0 Kudos
JohnGrayson
Esri Regular Contributor

Instead of 'loadAll()' you can also target specific properties. Try 'load()' and and see if the internal Web Scene properties you want to access/change are available.  You can also try the various methods available via 'watchUtils' to discover when specific properties are defined or changed.  Also, if wanting to modify layer properties that are loaded asynchronously you can use the 'load()' method for only the layers  you need to modify.  Here is one of many approaches you could take depending on the application and web scene content.

const map = new WebScene({...});

// slides are part of the web scene [not tested] //
watchUtils.whenDefined(map, 'presentation', presentation =>{
  if(presentation && presentation.slides){
    // do something with slides now that they're available...
  }
});

const view = new SceneView({
  map: map
});
view.when(()=> {
  view.map.layers.forEach(layer => {
    if(listOfLayersToChange.includes(layer.title)){
      // only wait for load of specific layers you need to change
      layer.load().then(()=>{
        // change layer settings that were loaded asyncronously
      });
    }
  });
});

 

0 Kudos