Reference·JavaScript · @bimworks/viewercommonJavaScript

SvgAnnotation

Class in @bimworks/viewercommon.

API catalogue · @bimworks/viewercommon · Class

TypeScript#
class SvgAnnotation

SVG based Annotation

Inheritance and interfaces#

Members#

Member Kind Description
constructor Method overwrites: Annotation.constructor
allowClustering Property false: the 3D viewer never merges this annotation into a cluster with nearby ones
qid Property The object the annotation is linked to: hovering either highlights the other inheritedFrom: Annotation.qid
align Method inheritedFrom: Annotation.align
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 inheritedFrom: Annotation.anchor
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…
backgroundColor Method Get the background color
backgroundColor Method Set the background color
backgroundHoverColor Method Get the background hover color
backgroundHoverColor Method Set the background hover color
borderColor Method Get the border color
borderColor Method Set the border color
borderHoverColor Method Get the border hover color
borderHoverColor Method Set the border hover color
click Method inheritedFrom: Annotation.click
click Method Attach a click listener, only one click listener can be attached, previous one will be overwritten inheritedFrom: Annotation.click
color Method
color Method Set the foreground (fill) color for the SVG
group Method inheritedFrom: Annotation.group
group Method The group the annotation belongs to; groups can be shown, hidden and limited together inheritedFrom: Annotation.group
groupLimit Method inheritedFrom: Annotation.groupLimit
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 …
hoverColor Method Get the foreground (fill) color for the SVG on hover
hoverColor Method Set the foreground (fill) color for the SVG on hover
image Method
image Method Set the URL of the SVG. This can be a local URL or a full remote URL
label Method
label Method A text label shown next to the icon
mainColor Method
mainColor Method One colour for the icon: sets the foreground, background and border colours together
maxDistanceMm Method inheritedFrom: Annotation.maxDistanceMm
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 inheritedFrom: Annotation.occlusion
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" inheritedFrom: Annotati…
position Method inheritedFrom: Annotation.position
position Method Where the annotation points, in viewer coordinates (the frame of @bimworks/viewer3d!Viewer3d.pick) inheritedFrom: Annotation.position
scaleByDistance Method inheritedFrom: Annotation.scaleByDistance
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#

TypeScript#
constructor()

overwrites: Annotation.constructor

allowClustering#

TypeScript#
allowClustering?: boolean

false: the 3D viewer never merges this annotation into a cluster with nearby ones

qid#

TypeScript#
qid?: string | Qid

The object the annotation is linked to: hovering either highlights the other

inheritedFrom: Annotation.qid

align#

TypeScript#
align(): AnnotationAlign | null

inheritedFrom: Annotation.align

align#

TypeScript#
align(align: AnnotationAlign | null): void

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 there

inheritedFrom: Annotation.align

Parameters#

Name Type Description
align AnnotationAlign | null

anchor#

TypeScript#
anchor(): AnnotationAnchor

inheritedFrom: Annotation.anchor

anchor#

TypeScript#
anchor(anchor: string | null): void

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

inheritedFrom: Annotation.anchor

Parameters#

Name Type Description
anchor string | null

backgroundColor#

TypeScript#
backgroundColor(): TinyColor

Get the background color

backgroundColor#

TypeScript#
backgroundColor(color: TinyColor): void

Set the background color

Parameters#

Name Type Description
color TinyColor

backgroundHoverColor#

TypeScript#
backgroundHoverColor(): TinyColor

Get the background hover color

backgroundHoverColor#

TypeScript#
backgroundHoverColor(color: TinyColor): void

Set the background hover color

Parameters#

Name Type Description
color TinyColor

borderColor#

TypeScript#
borderColor(): TinyColor

Get the border color

borderColor#

TypeScript#
borderColor(color: TinyColor): void

Set the border color

Parameters#

Name Type Description
color TinyColor

borderHoverColor#

TypeScript#
borderHoverColor(): TinyColor

Get the border hover color

borderHoverColor#

TypeScript#
borderHoverColor(color: TinyColor): void

Set the border hover color

Parameters#

Name Type Description
color TinyColor

click#

TypeScript#
click(): Function

inheritedFrom: Annotation.click

Returns#

The currently set click listener

click#

TypeScript#
click(fn: Function): void

Attach a click listener, only one click listener can be attached, previous one will be overwritten

inheritedFrom: Annotation.click

Parameters#

Name Type Description
fn Function The method to call whenever this annotation is clicked

color#

TypeScript#
color(): TinyColor

Returns#

Get the foreground (fill) color for the SVG

color#

TypeScript#
color(color: TinyColor): void

Set the foreground (fill) color for the SVG

Parameters#

Name Type Description
color TinyColor

group#

TypeScript#
group(): string

inheritedFrom: Annotation.group

group#

TypeScript#
group(group: string): void

The group the annotation belongs to; groups can be shown, hidden and limited together

inheritedFrom: Annotation.group

Parameters#

Name Type Description
group string

groupLimit#

TypeScript#
groupLimit(): number | null

inheritedFrom: Annotation.groupLimit

Returns#

The limit on the annotations shown of this annotation's group, null for none

groupLimit#

TypeScript#
groupLimit(groupLimit: number | null): void

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 no limit. Annotations hidden behind other geometry take no place, and hovering an annotation's object still shows it.

inheritedFrom: Annotation.groupLimit

Parameters#

Name Type Description
groupLimit number | null

hoverColor#

TypeScript#
hoverColor(): TinyColor

Get the foreground (fill) color for the SVG on hover

hoverColor#

TypeScript#
hoverColor(color: TinyColor): void

Set the foreground (fill) color for the SVG on hover

Parameters#

Name Type Description
color TinyColor

image#

TypeScript#
image(): string

Returns#

The currently set URL for the SVG

image#

TypeScript#
image(image: string): void

Set the URL of the SVG. This can be a local URL or a full remote URL

Parameters#

Name Type Description
image string

label#

TypeScript#
label(): string | null

label#

TypeScript#
label(label: string | null): void

A text label shown next to the icon

Parameters#

Name Type Description
label string | null

mainColor#

TypeScript#
mainColor(): TinyColor

mainColor#

TypeScript#
mainColor(color: Color): void

One colour for the icon: sets the foreground, background and border colours together

Parameters#

Name Type Description
color Color

maxDistanceMm#

TypeScript#
maxDistanceMm(): number

inheritedFrom: Annotation.maxDistanceMm

Returns#

The currently set max distance in mm

maxDistanceMm#

TypeScript#
maxDistanceMm(distance: number): void

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 distance the annotation will be displayed

inheritedFrom: Annotation.maxDistanceMm

Parameters#

Name Type Description
distance number The max distance in mm

occlusion#

TypeScript#
occlusion(): "none" | "hide" | "dim"

inheritedFrom: Annotation.occlusion

occlusion#

TypeScript#
occlusion(occlusion: "none" | "hide" | "dim"): void

What the 3D viewer does while the annotation's point or object is hidden behind other geometry: "hide" (the default), "dim" or "none"

inheritedFrom: Annotation.occlusion

Parameters#

Name Type Description
occlusion "none" | "hide" | "dim"

position#

TypeScript#
position(): vec3

inheritedFrom: Annotation.position

position#

TypeScript#
position(position: vec3): void

Where the annotation points, in viewer coordinates (the frame of @bimworks/viewer3d!Viewer3d.pick)

inheritedFrom: Annotation.position

Parameters#

Name Type Description
position vec3

scaleByDistance#

TypeScript#
scaleByDistance(): boolean | null

inheritedFrom: Annotation.scaleByDistance

Returns#

true or false when set on this annotation, null when it follows the viewer's setting

scaleByDistance#

TypeScript#
scaleByDistance(scaleByDistance: boolean | null): void

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 %, and its normal size again while it or its object is hovered. null (the default) follows the viewer's annotationScaleByDistance setting.

inheritedFrom: Annotation.scaleByDistance

Parameters#

Name Type Description
scaleByDistance boolean | null