Protected_Protected Optional_Protected_ReadonlyactionsThe keys of the plugin, as actions (registered in viewer.actions, where a UI lists them): → and ← open the
next and the previous annotation while a card is open, before the arrow keys of the camera controls on the canvas
(capture); a held arrow goes on through them. With more viewers on the page, the viewer with the focus, or the one used last, takes the key. Escape
(close the card) stays a key of the card.
Camera animation time in ms for a large move (short moves are faster)
All annotations in tour order. Saved with the scene (in the .glb). Change them through the methods.
Any interaction with the canvas closes the open card: a click, a drag (orbit, pan with a finger, a pinch: as soon as the pointer moves 4px) and a wheel zoom. Primary button and touch only; not while placing or dragging a marker. Default false: only a click (no drag) on the canvas closes it, and the card stays while the camera orbits. Not saved with the scene, like editable.
Max rays per frame for the occlusion test (it also stops after ~2 ms)
After rendered frames, the occlusion test runs again at most this often (ms), for geometry that moves without a scene update (an animation). No frames: no test.
StaticInjectAdds the stylesheet of the anp- classes to the page when the first plugin is added. Off: the page styles them.
Static Optional ReadonlyOldStatic ReadonlyPluginThe next click on a surface places a new annotation (startAdding)
A compact card, for a viewer with a tour: the card shows the title and the text only (editable: Update view and Delete at its top, before the ✕), and the tour bar at the bottom centre has ‹ the title of the open annotation ›. The bar fades while the user moves the camera, see tourBar. Default false: the card has ‹ 1 / 3 › and the tools in its bottom row. Not saved with the scene, like editable.
Editable: only the open (selected) annotation can be dragged to another surface point. A press on another marker opens it with a click, and a drag from it moves the camera, as a drag on the canvas does. Off: a drag on any marker moves it. Default true: in an editor a drag that starts on a marker is often meant to orbit, and the markers are small; with it on, a marker moves only after it was opened, and that move is one undo step. Not saved with the scene, like editable.
Allow adding, editing, moving and deleting annotations. Off: visitors open the annotations only.
id of the open annotation, or null
A hook for the app: renders the content of the card (in place of the title and the text) when editable is off.
The ✕, the ‹ › of the card and the tour bar of compactCard stay; in editable mode the default editor card
shows. It runs when an annotation opens, when the annotations change, and when it is set: set it again to render
the open card again (for app state it reads). Returning undefined gives the default content, and so does an
error (logged). A string is set as HTML as is, so escape what comes from a file or a user (escapeHtml,
renderAnnotationText). Clicks and keys in the content do not reach the viewer, as in the default card.
Show the ✕ in the card. Off: the card closes with Esc, a click on the canvas or from code (close). Default true.
The state of the tour bar of compactCard:
'hidden': the option is off, no annotation is open, a new one is being placed, or the plugin is disabled'shown': an annotation is open (also during playTour)'faded': shown, but the user moves the camera (a drag past 4px or a wheel on the canvas); it shows again
400 ms after the pointer up or the last wheel eventThe tour of playTour runs
Protected_Protected_Optionalprefix: stringAdd an annotation on object at a point and normal in its local space. view defaults to the current camera view.
content.instanceId: an instance of an InstancedMesh, the point and the normal are then in that instance's space.
content.data: values of the app (Annotation.data). Undoable. Returns the new annotation.
Optionalview: AnnotationView | nullStop placing a new annotation (startAdding)
The current camera view, in world space
Remove all annotations. Undoable: the undo also opens the one that was open.
Close the card. In editable mode, one undo step (the undo opens it again), as a selection.
Optionalmeta: SerializationMetaTypeAn annotation by its place in the tour (a number) or its id
The object an annotation is on, or null when it is not in the scene. Found by uuid, or by the path of names on the first look up (after a load, where the uuids can be new). Once found, the annotation stays on that object: when it leaves the scene, the marker hides (an object with the same path, like an unnamed sibling, does not take it), and it shows again when the object, or one with its uuid, is back.
Open an annotation: the camera goes to its saved view and the card opens. In editable mode, opening another annotation is one undo step (the undo opens the one before, or closes the card), as a selection.
place in the tour or id
fly: false keeps the camera; focusTitle puts the cursor in the title (editable only)
Move an annotation to another place in the tour order. Undoable.
Open the next annotation (after the last: the first)
Go through the annotations one after another, like Sketchfab's autopilot. Any click or key stops it. The tour adds no undo steps.
Open the previous annotation (before the first: the last)
Remove an annotation. Undoable: the undo also opens it again when it was open.
OptionalsetEditable only: the next click on a surface places a new annotation there, with the current camera view. Esc or a right click cancels. Returns false when it did not start (not editable, not added, disabled, or already placing).
Optionalmeta: SerializationMetaTypeChange the title, text, view or data of an annotation. Undoable.
Save the current camera view in the annotation (default: the open one). Undoable.
Annotations Plugin
3D annotations ("hotspots"), like Sketchfab's: numbered markers on the model. Click one: the camera goes to the view saved with it and a card shows its title and text, with ‹ prev / next › (also ←/→, Esc closes).
viewer.exportScene({viewerConfig: true})(the .glb) hold it, and loading them restores it.annotationChangeandannotationSelectfor an outside list.The markers and the card are in a layer over the canvas, in the viewer container (which must be positioned, for example
position: relative). The UI folder (Annotations) has Editable, Drag only selected, Close on canvas interaction, Close button, Compact card, Add, Play tour and Remove all.