Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.
Index
Enumerations
Interfaces
Properties
Methods
Properties
current
layers
All layers associated with the current space.
Layers in inactive Views may not populate right away. Activating a View will trigger the Layers to populate.
mpSdk.View.layers.subscribe({
onAdded(index, layer, collection) {
console.log('a layer with id', layer.id, 'named', layer.name);
},
onCollectionUpdated(collection) {
console.log('all layers', collection);
},
});
views
All views associated with the current space.
mpSdk.View.views.subscribe({
onAdded(index, view, collection) {
console.log('a view with id', view.id, 'named', view.name);
},
onCollectionUpdated(collection) {
console.log('all views', collection);
},
});
Methods
createLayer
-
Create a layer that can be later added to a View or Views
// create a standard Layer to be added to a View const layer = await mpSdk.View.createLayer('my layer'); // create a common Layer that is in all Views const layer = await mpSdk.View.createLayer('my layer', { common: true });
Parameters
-
name: string
-
Optional options: undefined | object
Returns Promise<View.Layer>
-
deleteLayer
-
Introduced 25.3.4
Delete a layer. The Layer will be removed from all views that it is in.
const layer = await mpSdk.View.createLayer('my layer'); await mpSdk.View.deleteLayer(layer);
Parameters
-
layer: View.Layer
Returns Promise<void>
-
The currently active view
mpSdk.View.current.subscribe((currentView) => { console.log('the currently active view is', currentView.name); });