Mattertag | Matterport SDK
Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

Index

Types

EditableProperties

EditableProperties: object

Type declaration

GlobalVariableMap

GlobalVariableMap: object

Map the globals we provide in your sandbox to other names.

Type declaration

  • Optional off?: undefined | string
  • Optional on?: undefined | string
  • Optional send?: undefined | string
  • Optional tag?: undefined | string

InjectionOptions

InjectionOptions: object

Options that can be specified when injection custom HTML into a Mattertag.

Type declaration

  • Optional globalVariableMap?: Mattertag.GlobalVariableMap

    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.

  • Optional size?: Size

    The size of the frame to create

  • Optional windowPath?: undefined | string

MattertagData

MattertagData: object

Type declaration

  • 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: object
    • id: string
    • sequence: number
  • label: string
  • media: object
  • 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

ObservableMattertagData: object

Type declaration

  • anchorPosition: Vector3

    The world space position of the mattertag anchor within the model

  • color: Color
  • description: string
  • enabled: boolean
  • floorIndex: number
  • floorInfo: object
    • id: string
    • sequence: number
  • label: string
  • media: object
  • sid: string
  • stemVector: Vector3

    The world space (non-normal) direction of the mattertag's stem

  • stemVisible: boolean

PreventableActions

PreventableActions: object

Type declaration

  • navigating: boolean
  • opening: boolean

Properties

data

deprecated

Use Tag.data instead

An observable collection of Mattertag data that can be subscribed to.

Methods

add

  • deprecated

    Use Tag.add instead

    Add 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 model
    • stemVector, 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.

    Parameters

    Returns Promise<string[]>

    A promise that resolves with the sids for the newly added Mattertags.

editBillboard

  • deprecated

    Use Tag.editBillboard or Tag.registerAttachment and/or Tag.attach to manage media

    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.

    Parameters

    Returns Promise<void>

editColor

  • editColor(tagSid: string, color: Color): Promise<void>
  • deprecated

    Use Tag.editColor instead

    Edit the color of a Mattertag

    Parameters

    • 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

  • editIcon(tagSid: string, iconId: string): Promise<void>
  • deprecated

    Use Tag.editIcon instead

    Change 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.

    Parameters

    • tagSid: string

      The sid of the Mattertag to edit

    • iconId: string

      The id of the icon to apply

      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.

    Returns Promise<void>

editOpacity

  • editOpacity(tagSid: string, opacity: number): Promise<void>
  • deprecated

    Use Tag.editOpacity instead

    Edit the opacity of a Mattertag

    Parameters

    • 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

  • deprecated

    Use Tag.editPosition instead

    Move 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.

    Parameters

    • tagSid: string

      The sid of the Mattertag to reposition

    • moveOptions: Partial<Mattertag.PositionOptions>

      The new anchorPosition, stemVector and/or floorId.

    Returns Promise<void>

editStem

  • editStem(tagSid: string, options: object): Promise<void>
  • deprecated

    Use Tag.editStem instead

    Introduced 3.1.70.10-0-ge9cb83b28c

    Edit the stem of a Mattertag

    Parameters

    • tagSid: string

      The sid of the Mattertag to edit

    • options: object
      • Optional stemHeight?: undefined | number
      • Optional stemVisible?: undefined | false | true

    Returns Promise<void>

getData

getDiscPosition

injectHTML

  • deprecated

    Use Tag.registerSandbox and Tag.attach instead

    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.

    Parameters

    Returns Promise<Mattertag.IMessenger>

navigateToTag

  • navigateToTag(tagSid: string, transition: Mattertag.Transition, force?: undefined | false | true): Promise<string>
  • This function navigates to the Mattertag disc with the provided sid, opening the billboard on arrival.

    mpSdk.Mattertag.navigateToTag(sid, mpSdk.Mattertag.Transition.FLY);
    

    Parameters

    • 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

    • Optional force: undefined | false | true

      If navigating to the tag is disabled, passing force === true will force the transition to occur

    Returns Promise<string>

preventAction

  • deprecated

    Use Tag.allowAction instead

    Prevents the "default" Showcase action on a Mattertag from occurring: hover to open billboard, click to navigate to view.

    Parameters

    • 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

  • registerIcon(iconId: string, iconSrc: string): Promise<void>
  • deprecated

    Use Asset.registerTexture instead

    Register an icon to use with subsequent Mattertag.editIcon calls.

    Note: It is recommended to host your own images to mitigate cross origin limitations.

    Parameters

    • 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

  • remove(tagSids: string | string[]): Promise<string[]>
  • deprecated

    Use Tag.remove instead

    Removes 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.

    Parameters

    • 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

  • resetIcon(tagSid: string): Promise<void>
  • deprecated

    Use Tag.resetIcon instead

    Resets the icon of the Mattertag disc back to its original icon.

    Parameters

    • tagSid: string

      The sid of the Mattertag to reset

    Returns Promise<void>