Annotation
Class in @bimworks/viewercommon.
API catalogue · @bimworks/viewercommon · Class
class AnnotationAbstract super class for all annotations, there are currently SvgAnnotation, ImageAnnotation and TextAnnotation
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | |
| qid | Property | The object the annotation is linked to: hovering either highlights the other |
| align | Method | |
| align | Method | Which side of its anchor the annotation is drawn on, on screen; null (the default) draws text and icons centred on it and an image of no size with its corner… |
| anchor | Method | |
| anchor | Method | Where on its object (qid) the 3D viewer puts an annotation without a position: a point of the object's box in its model's own axes, "center" (the default) or… |
| click | Method | |
| click | Method | Attach a click listener, only one click listener can be attached, previous one will be overwritten |
| group | Method | |
| group | Method | The group the annotation belongs to; groups can be shown, hidden and limited together |
| groupLimit | Method | |
| groupLimit | Method | At most how many annotations of this annotation's group the 3D viewer shows, those nearest to the camera: a positive whole number, or null (the default) for … |
| maxDistanceMm | Method | |
| maxDistanceMm | Method | Set the maximum distance from the annotation to the camera at which it will still be displayed. The default value of this is 0, which means that at any dista… |
| occlusion | Method | |
| occlusion | Method | What the 3D viewer does while the annotation's point or object is hidden behind other geometry: "hide" (the default), "dim" or "none" |
| position | Method | |
| position | Method | Where the annotation points, in viewer coordinates (the frame of @bimworks/viewer3d!Viewer3d.pick) |
| scaleByDistance | Method | |
| scaleByDistance | Method | Whether the 3D viewer draws the annotation smaller the further it is from the camera: its normal size up to 10 m, shrinking beyond that to no less than 40 %,… |
constructor#
constructor()qid#
The object the annotation is linked to: hovering either highlights the other
align#
align(): AnnotationAlign | nullalign#
align(align: AnnotationAlign | null): voidWhich side of its anchor the annotation is drawn on, on screen; null (the default) draws text and icons centred on it and an image of no size with its corner there
Parameters#
| Name | Type | Description |
|---|---|---|
align |
AnnotationAlign | null |
anchor#
anchor(): AnnotationAnchoranchor#
anchor(anchor: string | null): voidWhere on its object (qid) the 3D viewer puts an annotation without a position: a point of the object's box in its model's own axes, "center" (the default) or up to three words as AnnotationAnchor lists them. Setting takes the words separated by spaces too; reading gives the "-" form. Read when the viewer adds the annotation
Parameters#
| Name | Type | Description |
|---|---|---|
anchor |
string | null |
click#
click(): FunctionReturns#
The currently set click listener
click#
click(fn: Function): voidAttach a click listener, only one click listener can be attached, previous one will be overwritten
Parameters#
| Name | Type | Description |
|---|---|---|
fn |
Function |
The method to call whenever this annotation is clicked |
group#
group(): stringgroup#
group(group: string): voidThe group the annotation belongs to; groups can be shown, hidden and limited together
Parameters#
| Name | Type | Description |
|---|---|---|
group |
string |
groupLimit#
groupLimit(): number | nullReturns#
The limit on the annotations shown of this annotation's group, null for none
groupLimit#
groupLimit(groupLimit: number | null): voidAt most how many annotations of this annotation's group the 3D viewer shows, those nearest to the camera: a positive whole number, or null (the default) for no limit. Annotations hidden behind other geometry take no place, and hovering an annotation's object still shows it.
Parameters#
| Name | Type | Description |
|---|---|---|
groupLimit |
number | null |
maxDistanceMm#
maxDistanceMm(): numberReturns#
The currently set max distance in mm
maxDistanceMm#
maxDistanceMm(distance: number): voidSet the maximum distance from the annotation to the camera at which it will still be displayed. The default value of this is 0, which means that at any distance the annotation will be displayed
Parameters#
| Name | Type | Description |
|---|---|---|
distance |
number |
The max distance in mm |
occlusion#
occlusion(): "none" | "hide" | "dim"occlusion#
occlusion(occlusion: "none" | "hide" | "dim"): voidWhat the 3D viewer does while the annotation's point or object is hidden behind other geometry: "hide" (the default), "dim" or "none"
Parameters#
| Name | Type | Description |
|---|---|---|
occlusion |
"none" | "hide" | "dim" |
position#
position#
Where the annotation points, in viewer coordinates (the frame of @bimworks/viewer3d!Viewer3d.pick)
Parameters#
| Name | Type | Description |
|---|---|---|
position |
vec3 |
scaleByDistance#
scaleByDistance(): boolean | nullReturns#
true or false when set on this annotation, null when it follows the viewer's setting
scaleByDistance#
scaleByDistance(scaleByDistance: boolean | null): voidWhether the 3D viewer draws the annotation smaller the further it is from the camera: its normal size up to 10 m, shrinking beyond that to no less than 40 %, and its normal size again while it or its object is hovered. null (the default) follows the viewer's annotationScaleByDistance setting.
Parameters#
| Name | Type | Description |
|---|---|---|
scaleByDistance |
boolean | null |