Mattertag
Types
EditableProperties
| Property | Type |
|---|---|
| description | string |
| label | string |
| media | { type: Mattertag.MediaType; src: string; } |
GlobalVariableMap
Map the globals we provide in your sandbox to other names.
| Property | Type |
|---|---|
| off? | string | undefined |
| on? | string | undefined |
| send? | string | undefined |
| tag? | string | undefined |
InjectionOptions
Options that can be specified when injection custom HTML into a Mattertag.
| Property | Type |
|---|---|
| globalVariableMap? | Mattertag.GlobalVariableMap | undefined A map for the global functions and variables we provide in your iframe sandbox. Only needs to be used if scripts you are importing also have a global send, on, off, or tag. |
| size? | Size | undefined The size of the frame to create |
| windowPath? | string | undefined |
MattertagData
| Property | Type |
|---|---|
| anchorNormal | Vector3 |
| anchorPosition | Vector3 The world space position of the mattertag anchor within the model |
| color | Color |
| description | string |
| enabled | boolean |
| floorId | number |
| floorIndex | number |
| floorInfo | { id: string; sequence: number; } |
| label | string |
| media | { type: Mattertag.MediaType; src: string; } |
| mediaSrc | string |
| mediaType | Mattertag.MediaType |
| parsedDescription | Mattertag.DescriptionChunk[] |
| sid | string |
| stemHeight | number |
| stemVector | Vector3 The world space (non-normal) direction of the mattertag's stem |
| stemVisible | boolean |
ObservableMattertagData
| Property | Type |
|---|---|
| anchorPosition | Vector3 The world space position of the mattertag anchor within the model |
| color | Color |
| description | string |
| enabled | boolean |
| floorIndex | number |
| floorInfo | { id: string; sequence: number; } |
| label | string |
| media | { type: Mattertag.MediaType; src: string; } |
| sid | string |
| stemVector | Vector3 The world space (non-normal) direction of the mattertag's stem |
| stemVisible | boolean |
Enumerations
DescriptionChunkType
| Member | Value |
|---|---|
| LINK | "tag.chunk.link" |
| NONE | "tag.chunk.none" |
| TEXT | "tag.chunk.text" |
LinkType
| Member | Value |
|---|---|
| EXT_LINK | "tag.link.ext" An external link |
| MODEL | "tag.link.model" A link to a different Matterport model |
| NAVIGATION | "tag.link.nav" A link to another position in the current model |
MediaType
| Member | Value |
|---|---|
| NONE | "mattertag.media.none" |
| PHOTO | "mattertag.media.photo" |
| RICH | "mattertag.media.rich" |
| VIDEO | "mattertag.media.video" |
TransitionType
Transition types for camera movements. This is the canonical transition type enum.
Used for Mode.moveTo, Sweep.moveTo, Mattertag.navigateToTag, and other camera movement methods.
Note: not all values are supported, refer to per-method documentation for details.
| Member | Value |
|---|---|
| FADEOUT | "transition.fade" Fade to black transition |
| FLY | "transition.fly" Fly transition |
| INSTANT | "transition.instant" Instant transition |
| MOVEFADE | "transition.movefade" experimental Move with fade transition |
| ORBIT | "transition.orbit" experimental Orbit transition |
Observables
data
Tag.data insteadAn observable collection of Mattertag data that can be subscribed to.
Methods
add
Tag.add insteadAdd one or more Mattertags to Showcase. Each input Mattertag supports setting the label, description, color, anchorPosition, and stemVector.
Two properties are required:
anchorPosition, the point where the tag connects to the modelstemVector, the direction, aka normal, and height that the Mattertag stem points
See Pointer.intersection for a way to retrive a new anchorPosition and stemVector.
Note: these changes are not persisted between refreshes of Showcase. They are only valid for the current browser session.
| Parameter | Type |
|---|---|
| newTagData | Mattertag.MattertagDescriptor | Mattertag.MattertagDescriptor[] A single or array of Mattertag templates to add. |
Returns: Promise<string[]>
A promise that resolves with the sids for the newly added Mattertags.
editBillboard
Edit the data in a Mattertag billboard.
Note: these changes are not persisted between refreshes of Showcase. They are only valid for the current browser session.
| Parameter | Type |
|---|---|
| tagSid | string the sid of the Mattertag to edit |
| properties | Partial<Mattertag.EditableProperties> A dictionary of properties to set |
Returns: Promise<void>
editColor
Tag.editColor insteadEdit the color of a Mattertag
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to edit |
| color | Color The new color to be applied to the Mattertag disc |
Returns: Promise<void>
editIcon
Tag.editIcon insteadChange the icon of the Mattertag disc
Note: these changes are not persisted between refreshes of Showcase. They are only valid for the current browser session.
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to edit |
| iconId | string The id of the icon to apply |
Returns: Promise<void>
Errors
Warns if the provided iconSrc is an .svg file which doesn't have a 'width' or 'height' attribute.
Defaults to a resolution of 128x128 if neither exist.
editOpacity
Tag.editOpacity insteadEdit the opacity of a Mattertag
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to edit |
| opacity | number The target opacity for the Mattertag in the range of [0, 1] |
Returns: Promise<void>
editPosition
Tag.editPosition insteadMove and reorient a Mattertag.
See Pointer.intersection for a way to retrieve a new anchorPosition and stemVector.
Note: these changes are not persisted between refreshes of Showcase. They are only valid for the current browser session.
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to reposition |
| moveOptions | Partial<Mattertag.PositionOptions> The new anchorPosition, stemVector and/or floorId. |
Returns: Promise<void>
editStem
Tag.editStem insteadEdit the stem of a Mattertag
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to edit |
| options | { stemHeight?: number; stemVisible?: boolean; } What to change about the Mattertag's stem - can include stemHeight and stemVisible |
Returns: Promise<void>
getData
Tag.data insteadThis function returns metadata on the collection of Mattertags.
Returns: Promise<Mattertag.MattertagData[]>
getDiscPosition
Tag.dataGet the disc's (3d) position of a Mattertag.
| Parameter | Type |
|---|---|
| tag | Mattertag.MattertagData | Mattertag.ObservableMattertagData |
| result? | Vector3 |
Returns: Vector3
injectHTML
Add a custom frame that can host custom HTML and JavaScript, and communicate bi-directionally with your page.
The frame that contains your custom code will have certain limitations due to being sandboxed by the sandbox='allow-scripts attribute.
Attempting to access properties of other windows will also be blocked by the browser.
(see the MDN pages about iframe sandbox)
Currently, the HTML CAN ONLY BE SET ONCE by a call to injectHTML. This includes removing or clearing the HTML.
| Parameter | Type |
|---|---|
| tagSid | string |
| html | string |
| options | Mattertag.InjectionOptions |
Returns: Promise<Mattertag.IMessenger>
navigateToTag
This function navigates to the Mattertag disc with the provided sid, opening the billboard on arrival.
mpSdk.Mattertag.navigateToTag(sid, mpSdk.Camera.Transition.FLY);
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to navigate to |
| transition | Mattertag.Transition The type of transition to navigate to a sweep where the Mattertag disc is visible |
| force? | boolean If navigating to the tag is disabled, passing force === true will force the transition to occur |
Returns: Promise<string>
preventAction
Tag.allowAction insteadPrevents the "default" Showcase action on a Mattertag from occurring: hover to open billboard, click to navigate to view.
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to remove actions from |
| actions | Partial<Mattertag.PreventableActions> The set of actions to prevent |
Returns: Promise<void>
registerIcon
Asset.registerTexture insteadRegister an icon to use with subsequent Mattertag.editIcon calls.
Note: It is recommended to host your own images to mitigate cross origin limitations.
| Parameter | Type |
|---|---|
| iconId | string A user specified string to use as a lookup of this icon |
| iconSrc | string The src of the icon, like the src of an <img> |
Returns: Promise<void>
remove
Tag.remove insteadRemoves one or more Mattertags from Showcase.
Note: these changes are not persisted between refreshes of Showcase. They are only valid for the current browser session.
| Parameter | Type |
|---|---|
| tagSids | string | string[] A single Mattertag sid or array of Mattertag sids to remove. |
Returns: Promise<string[]>
A promise with an array of Mattertag sids that were actually removed.
resetIcon
Tag.resetIcon insteadResets the icon of the Mattertag disc back to its original icon.
| Parameter | Type |
|---|---|
| tagSid | string The sid of the Mattertag to reset |
Returns: Promise<void>