Skip to main content

AnnotationManager

class AnnotationManager

Manager class for Annotation

constructor

new AnnotationManager(view3D)
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
view3DView3D

Properties

list

readonly

List of annotations

Type: Array<Annotation>

wrapper

readonly

Wrapper element for annotations

Type: HTMLElement

Methods

init

Init AnnotationManager

destroy

Destroy all annotations & event handlers

resize

Resize annotations

collect

Collect annotations inside the wrapper element

load

Load annotation JSON from URL

Returns: Promise<Annotation[]>

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
urlstringURL to annotations json

parse

Parse an array of annotation data

Returns: Annotation[]

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
dataArray<object>An array of annotation data

render

Render annotations

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
cameraTHREE.PerspectiveCamera✔️
sizeTHREE.Vector2✔️

add

Add new annotation to the scene

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
annotationsAnnotationAnnotations to add

remove

Remove annotation at the given index

Returns: Annotation | null

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
indexnumberIndex of the annotation to remove

reset

Remove all annotations

toJSON

Save annotations as JSON