import Slide from "@arcgis/core/webscene/Slide.js";const Slide = await $arcgis.import("@arcgis/core/webscene/Slide.js");- Inheritance:
- Slide→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.0
A slide stores a snapshot of several pre-set properties of the WebScene and SceneView, such as the basemap, viewpoint and visible layers. The visible layers may contain references (by Layer.id) to both operational layers from the scene as well as elevation layers from the Ground.layers, which affect the surface elevation.
Slides contain additional metadata such as a title, description and thumbnail which may be used to present the slide to the user in a user interface. Slides can be created, updated and applied to a SceneView. Additionally, slides can be stored as part of the WebScene.presentation.
Example
// Create a slide from a view and apply it at a later timeSlide.createFrom(view).then(function(slide) { // Add slide to the scene presentation scene.presentation.slides.add(slide);});
// At a later timelet firstSlide = scene.presentation.slides.at(0);
firstSlide.applyTo(view).then(function() { // Slide has been successfully applied to the view});Constructors
Constructor
Create a new slide instance. Usually createFrom() is used instead to create a new slide which stores a snapshot of the view.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
declaredClass readonly inherited | ||
| | ||
| | ||
Collection<string> | null | undefined | | |
| | ||
SlideGround | null | undefined | | |
| | ||
| | ||
| | ||
| | ||
TimeExtent | null | undefined | | |
| | ||
| | ||
| |
elements
- Type
- SlideElements
- Since
- ArcGIS Maps SDK for JavaScript 4.32
The elements object contains configurations for components set in a slide.
enabledFocusAreas
- Type
- Collection<string> | null | undefined
The enabled focus areas of the scene.
This is a collection of strings, storing references (by ID) to the focus areas that are enabled when the slide is applied to a SceneView.
Example
// Update the slide to only enable the first focus area in the map.slide.enabledFocusAreas = [ view.map.focusAreas.areas.at(0).id ]; environment
- Type
- SlideEnvironment
Represents settings that affect the environment in which the WebScene is displayed (such as lighting).
hidden
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.28
The visibility of a slide in a presentation. A hidden slide should not show up when an application goes into presentation mode.
- Default value
- false
layout
- Type
- SlideLayout
- Since
- ArcGIS Maps SDK for JavaScript 4.31
Layout of the slide.
- Default value
- "caption"
timeExtent
- Type
- TimeExtent | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.30
The time extent of the scene.
visibleLayers
- Type
- Collection<SlideVisibleLayer>
The visible layers of the scene.
This is a collection of objects that stores references (by ID) to the
scene layers and ground layers that are set
as visible when a slide is applied to a SceneView.
When assigning visible layers, the following types of values will be automatically casted:
- Array (or Collection) of Layer instances:
[layerInstance, layerInstance] - Array (or Collection) of Layer IDs:
["layer-1", "layer-2"]
The specification for each object in the collection is outlined in the table below.
Example
// Update the visible layers to the second layer in the scene, and the// first elevation layer in the ground.slide.visibleLayers = [ { id: scene.layers.at(1).id } { id: scene.ground.layers.at(0).id }];
// Equivalent using convenience autocastingslide.visibleLayers = [scene.layers.at(0), scene.ground.layers.at(0)];Methods
| Method | Signature | Class |
|---|---|---|
createFrom static | createFrom(view: SceneView, options?: SlideCreateFromOptions): Promise<Slide> | |
fromJSON inherited static | fromJSON(json: any): any | |
applyTo(view: SceneView, options?: GoToOptions3D): Promise<Slide> | | |
clone(): this | | |
emit inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
hasEventListener inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
on inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle | |
toJSON inherited | toJSON(): any | |
updateFrom(view: SceneView, options?: SlideUpdateFromOptions): Promise<Slide> | |
createFrom
- Signature
-
createFrom (view: SceneView, options?: SlideCreateFromOptions): Promise<Slide>
Creates a slide from a SceneView, which may be added to the Presentation.slides in the WebScene's WebScene.presentation. Updating the slide is asynchronous and a snapshot of the view is only complete once the returned promise has resolved.
Default screenshot settings are { quality: 80, width: 120, height: 75, format: "png" }
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| view | The SceneView from which the slide should be created. | | |
| options | Creation options. See properties below for object specifications. | |
Examples
// Creates a slide from the view and// adds it to the websceneSlide.createFrom(view).then(function(slide){ webscene.presentation.slides.add(slide);});// Create multiple slides from multiple viewpoints.view.goTo({ heading: 0 }, { animate: false }) .then(function() { // Create first slide at heading 0 (looking north) return Slide.createFrom(view); }) .then(function(slide){ // Slide has been captured, add to presentation webscene.presentation.slides.add(slide);
// Change viewpoint to look east return view.goTo({ heading: 90 }, { animate: false }); }) .then(function() { // Capture second slide return Slide.createFrom(view); }) .then(function(slide) { // Add second slide to presentation webscene.presentation.slides.add(slide); }); fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
applyTo
- Signature
-
applyTo (view: SceneView, options?: GoToOptions3D): Promise<Slide>
Applies a slide's settings to a SceneView.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| view | The SceneView the slide should be applied to. | | |
| options | Animation options. See properties below for object specifications. | |
Examples
// Applies the slide's settings to the view, but does// not use animation when updating the viewpointslide.applyTo(view, { animate: false});// Applies the slide's settings to the view, animates with a maximum// duration of 2 seconds.slide.applyTo(view, { maxDuration: 2000});slide.applyTo(view, { maxDuration: 2000}).then(function(){ //do something after applying the slide's settings to the view}); emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
- Since
- ArcGIS Maps SDK for JavaScript 4.5
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint);}); toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.
updateFrom
- Signature
-
updateFrom (view: SceneView, options?: SlideUpdateFromOptions): Promise<Slide>
Updates a slide from a WebScene's slides. Updating the slide is asynchronous and a snapshot of the view is only complete once the returned promise has resolved.
Default screenshot settings are { quality: 80, width: 120, height: 75, format: "png" }
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| view | The SceneView from which the slide should update. | | |
| options | Update options. See properties below for object specifications. | |
Events
apply-slide-cancel
apply-slide-cancel: CustomEvent<void> - Since
- ArcGIS Maps SDK for JavaScript 5.0
Emitted just after applying the slide was interrupted. In this case the apply-slide-complete event is not emitted.
- See also
apply-slide-complete
apply-slide-complete: CustomEvent<void> - Since
- ArcGIS Maps SDK for JavaScript 5.0
Emitted just after applying the slide has successfully completed. If applying the slide is interrupted then the apply-slide-cancel event is emitted instead.
- See also
apply-slide-start
apply-slide-start: CustomEvent<void> - Since
- ArcGIS Maps SDK for JavaScript 5.0
Emitted just before starting to apply the slide to the view.
- See also