Wikitude SDK API Reference

API Docs for: 8.2.0
Show:

ScreenSnapper Class

Module: AR

Internal class used by AR.ObjectTrackable, AR.InstantTrackable, AR.ImageTrackable and AR.Positionable. Do not instantiate this class directly.

Properties

snapToScreen.enabled

Boolean

If set to true, all cam drawables will be rendered in a div, specified by the snapToScreen.snapContainer element. The Trackable2DObject has to be in the onEnterFieldOfVision state at this point in time. If not, enabled = true has no effect. Setting enabled to false while not in the onEnterFieldOfVision state instead will work. So a Trackable2DObject can only be set to screen when the target is recognized, but can be set back to normal at any time if it's currently snapped.

Default: false

snapToScreen.enableDelayed

Number

The time that should pass by from when the onEnterFieldOfVision function was called and the attached drawables should snap to screen. Setting a negati ve value will disable the functionality. When the target is lost during the delay, the onDelayedSnapInterruption function will be called if set.

Default: -1

snapToScreen.enableOnExitFieldOfVision

Boolean

If set to true, the associated cam drawables will snap to the screen when the onExitFieldOfVision trigger fires. Using this property the drawables can snap to the screen when the target is lost which would not be possible with the enabled property. To disable snap to screen set the enabled property to false at any time (e.g. in the onEnterFieldOfVision trigger).

Default: false

snapToScreen.snapContainer

DOM Element

the DOM element that contains all cam drawables, associated with this Trackable2DObject if snap to screen is enabled. Note that all drawables might need to be adapted by there scale so that they fit into the element. Also Make sure that the aspect ratio of the DOM element.

Default: null

Events

snapToScreen.onDelayedSnapInterruption

Function

A function that should be called when a delayed snap to screen was interrupted because of the onExitFieldOfVision event.

Event Payload:

  • interruptionTimestamp Number

    the milliseconds that passed by between the activation through the enabledDelayed property and the interruption through the onExitFieldOfVision event.

snapToScreen.onSnappedToScreen

Function

A function that should be called when the underlaying ARObject snapped to the screen.

Event Payload:

  • element DOM Element

    The DOM Element to which the cam drawables snapped.