Reference·JavaScript · @bimworks/viewercommonJavaScript

AnnotationLayerOptions

Interface in @bimworks/viewercommon.

API catalogue · @bimworks/viewercommon · Interface

TypeScript#
interface AnnotationLayerOptions<D>

Type parameters#

Name Constraint Description
D ``

Members#

Member Kind Description
align Property Which side of the anchor the compact box is drawn on, as Annotation.align; default the template's origin
anchor Property Where on the object: a point of its box in its model's axes as Annotation.anchor (default the template's, else "center"), or a function of its bounds in view…
clustering Property Whether overlapping annotations of the layer merge into one with a count; default true
dotBeyondMm Property Beyond this distance a row is a 10 px dot in its status colour with its label as the title, and the template is not called; hovered, it shows the template. I…
expand Property When an expandable template's card shows: "hover" (after 250 ms; a click, tap or Enter pins it), "click", or "none". Default: "none" for a layer shown only o…
filter Property
group Property Annotation group name; default "layer:" + template name + a counter
join Property With a query: "query" (default) shows only objects the query returned, "union" also application rows it did not
key Property What identifies a row: the object's qid (default), or its IFC GlobalId for data from outside. With a query the layer gets attribute.GlobalId and joins on it …
limit Property At most this many annotations of the layer show, the nearest (Annotation.groupLimit)
maxDistanceMm Property
occlusion Property As Annotation.occlusion; default "hide"
onAction Property A click on an element with data-action="" inside an annotation
onClick Property A click on an annotation, or Enter/Space on it; makes the annotations focusable buttons
query Property Data from BQL, fetched in one batch on the loaded models (and on models loaded later). A string is sent as it is and its data keeps the records' shape (d.att…
rows Property Data from the application, joined to the query's rows by key (the application's fields win)
scaleByDistance Property
template Property The template, or the name it is registered under
visibility Property "hover": shown only while its object is hovered, fading in after a moment and out quickly. Without onClick, onAction or a card (expand), the pointer goes thr…

align#

TypeScript#
align?: AnnotationAlign | null

Which side of the anchor the compact box is drawn on, as Annotation.align; default the template's origin

anchor#

TypeScript#
anchor?: string | (bounds: { max: (number)[]; min: (number)[] }, row: AnnotationRow<D>) => (number)[]

Where on the object: a point of its box in its model's axes as Annotation.anchor (default the template's, else "center"), or a function of its bounds in viewer coordinates

clustering#

TypeScript#
clustering?: boolean

Whether overlapping annotations of the layer merge into one with a count; default true

dotBeyondMm#

TypeScript#
dotBeyondMm?: number | null

Beyond this distance a row is a 10 px dot in its status colour with its label as the title, and the template is not called; hovered, it shows the template. It turns back nearer than 90 % of the distance. Default: never

expand#

TypeScript#
expand?: "none" | "click" | "hover"

When an expandable template's card shows: "hover" (after 250 ms; a click, tap or Enter pins it), "click", or "none". Default: "none" for a layer shown only on hover (visibility "hover"), else the template's default, else "hover"

filter#

TypeScript#
filter?: (row: AnnotationRow<D>) => boolean

group#

TypeScript#
group?: string

Annotation group name; default "layer:" + template name + a counter

join#

TypeScript#
join?: "query" | "union"

With a query: "query" (default) shows only objects the query returned, "union" also application rows it did not

key#

TypeScript#
key?: "qid" | "globalId"

What identifies a row: the object's qid (default), or its IFC GlobalId for data from outside. With a query the layer gets attribute.GlobalId and joins on it (a string query returns it as a globalId column); without one it finds the GlobalIds' objects in one query, and again for GlobalIds it has not seen and for models loaded later

limit#

TypeScript#
limit?: number | null

At most this many annotations of the layer show, the nearest (Annotation.groupLimit)

maxDistanceMm#

TypeScript#
maxDistanceMm?: number

occlusion#

TypeScript#
occlusion?: "none" | "hide" | "dim"

As Annotation.occlusion; default "hide"

onAction#

TypeScript#
onAction?: (action: string, row: AnnotationRow<D>, event: Event) => void

A click on an element with data-action="" inside an annotation

onClick#

TypeScript#
onClick?: (row: AnnotationRow<D>, event: Event) => void

A click on an annotation, or Enter/Space on it; makes the annotations focusable buttons

query#

TypeScript#
query?: string | { get?: Record<string, string>; models?: (string)[]; parameters?: Record<string, unknown>; where?: string }

Data from BQL, fetched in one batch on the loaded models (and on models loaded later). A string is sent as it is and its data keeps the records' shape (d.attribute.Name); {where, get} asks for the template's fields and get's as their keys: GET qid, type, AS …, … WHERE

rows#

TypeScript#
rows?: Iterable<AnnotationRow<Partial<D>>, any, any>

Data from the application, joined to the query's rows by key (the application's fields win)

scaleByDistance#

TypeScript#
scaleByDistance?: boolean | null

template#

TypeScript#
template: string | AnnotationTemplate<D>

The template, or the name it is registered under

visibility#

TypeScript#
visibility?: "always" | "hover"

"hover": shown only while its object is hovered, fading in after a moment and out quickly. Without onClick, onAction or a card (expand), the pointer goes through it to the objects below, and Viewer3D draws it beside its object's footprint on screen