Skip to content

@linkurious/ogma-annotations

Type Aliases

Annotation

Ƭ Annotation: Arrow | Text

AnnotationOptions

Ƭ AnnotationOptions: Object

Type declaration

NameType
handleSizenumber
placeholderstring

Arrow

Ƭ Arrow: AnnotationFeature<LineString, ArrowProperties>

ControllerOptions

Ƭ ControllerOptions: Object

Type declaration

NameTypeDescription
arrowHandleSizenumberSize of the arrow handle
detectMarginnumberThe margin in which the Texts are detected when looking for magnet points
magnetColorstringThe color of the magnet points
magnetHandleRadiusnumberDisplay size of the magnet point
magnetRadiusnumberThe radius in which arrows are attracted
maxArrowHeightnumberMaximum height of the arrow in units
minArrowHeightnumberMinimum height of the arrow in units
textHandleSizenumberSize of the text handle
textPlaceholderstringPlaceholder for the text input

Events

Ƭ Events<T>: Object

Type parameters

Name
T

Type declaration

NameType
add(evt: T) => void
dragend(evt: T) => void
dragging(evt: T, key: "line" | "start" | "end" | "text") => void
dragstart(evt: T) => void
hover(evt: T) => void
remove(evt: T) => void
select(evt: T) => void
unhover(evt: T) => void
unselect(evt: T) => void
update(evt: T) => void

Extremity

Ƭ Extremity: "none" | "arrow" | "arrow-plain"

FeatureEvents

Ƭ FeatureEvents: Object

Type declaration

NameTypeDescription
add(evt: Annotation) => void-
cancelDrawing() => void-
dragend(evt: Arrow | Text) => void-
dragging(evt: Arrow | Text, key: "line" | "start" | "end" | "text") => void-
dragstart(evt: Arrow | Text) => void-
link(evt: { arrow: Arrow ; link: Link }) => void-
remove(evt: Annotation) => void-
select(evt: Annotation) => void-
unselect(evt: Annotation) => void-
update(evt: Annotation) => void-

Id

Ƭ Id: string | number

Ƭ Link: Object

Type declaration

NameTypeDescription
arrowIdarrow attached to the text or node
connectionPointPointOn which point relative to topleft corner the arrow is tighten, in case of node, it can be deduced from the arrow itself
idIdid of the text the arrow is attached to
sideSideOn which end the arrow is tighten to the text
targetIdid of the text or node the arrow is attached to
targetTypeTargetTypeText or node

Point

Ƭ Point: Object

Type declaration

NameType
xnumber
ynumber

Side

Ƭ Side: "start" | "end"

Stroke

Ƭ Stroke: Object

Type declaration

NameType
colorstring
type"plain" | "dashed" | "none"
widthnumber

StrokeOptions

Ƭ StrokeOptions: Object

Type declaration

NameType
strokeColor?string
strokeType?"plain" | "dashed" | "none"
strokeWidth?number

StrokeStyle

Ƭ StrokeStyle: Stroke

TargetType

Ƭ TargetType: "text" | "node"

Text

Ƭ Text: AnnotationFeature<Polygon, TextProperties>

Vector

Ƭ Vector: Point

Variables

EVT_ADD

Const EVT_ADD: "add"

EVT_CANCEL_DRAWING

Const EVT_CANCEL_DRAWING: "cancelDrawing"

EVT_DRAG

Const EVT_DRAG: "dragging"

EVT_DRAG_END

Const EVT_DRAG_END: "dragend"

EVT_DRAG_START

Const EVT_DRAG_START: "dragstart"

EVT_HOVER

Const EVT_HOVER: "hover"

Const EVT_LINK: "link"

EVT_REMOVE

Const EVT_REMOVE: "remove"

EVT_SELECT

Const EVT_SELECT: "select"

EVT_UNHOVER

Const EVT_UNHOVER: "unhover"

EVT_UNSELECT

Const EVT_UNSELECT: "unselect"

EVT_UPDATE

Const EVT_UPDATE: "update"

NONE

Const NONE: -1

defaultArrowOptions

Const defaultArrowOptions: Arrow

defaultArrowStyle

Const defaultArrowStyle: ArrowStyles

defaultControllerOptions

Const defaultControllerOptions: AnnotationOptions

defaultTextOptions

Const defaultTextOptions: Text

defaultTextStyle

Const defaultTextStyle: TextStyle

Functions

clientToContainerPosition

clientToContainerPosition(evt, container?): Object

Parameters

NameType
evtObject
evt.clientXnumber
evt.clientYnumber
container?null | HTMLElement

Returns

Object

NameType
xnumber
ynumber

createArrow

createArrow(x0?, y0?, x1?, y1?, styles?): Arrow

Parameters

NameTypeDefault value
x0number0
y0number0
x1number0
y1number0
stylesObjectundefined
styles.head?Extremityundefined
styles.strokeColor?stringundefined
styles.strokeType?"none" | "plain" | "dashed"undefined
styles.strokeWidth?numberundefined
styles.tail?Extremityundefined

Returns

Arrow

createSVGElement

createSVGElement<T>(tag): T

Type parameters

NameType
Textends SVGElement

Parameters

NameType
tagstring

Returns

T

createText

createText(x?, y?, width?, height?, content?, styles?): Text

Parameters

NameTypeDefault value
xnumber0
ynumber0
widthnumber100
heightnumber50
contentstring''
stylesPartial<TextStyle>undefined

Returns

Text

getAnnotationsBounds

getAnnotationsBounds(annotations): Bounds

Parameters

NameType
annotationsAnnotationCollection

Returns

Bounds

getArrowEnd

getArrowEnd(a): Object

Parameters

NameType
aArrow

Returns

Object

NameType
xnumber
ynumber

getArrowEndPoints

getArrowEndPoints(a): Object

Parameters

NameType
aArrow

Returns

Object

NameType
end{ x: number ; y: number }
end.xnumber
end.ynumber
start{ x: number ; y: number }
start.xnumber
start.ynumber

getArrowSide

getArrowSide(a, side): Object

Parameters

NameType
aArrow
side"start" | "end"

Returns

Object

NameType
xnumber
ynumber

getArrowStart

getArrowStart(a): Object

Parameters

NameType
aArrow

Returns

Object

NameType
xnumber
ynumber

getAttachmentPointOnNode

getAttachmentPointOnNode(start, nodeCenter, nodeRadius): Object

Parameters

NameType
startPoint
nodeCenterPoint
nodeRadiusnumber

Returns

Object

NameType
xnumber
ynumber

getHandleId

getHandleId(handle): number

Parameters

NameType
handleHTMLDivElement

Returns

number

getTextBbox

getTextBbox(t): BBox

Parameters

NameType
tText

Returns

BBox

getTextPosition

getTextPosition(t): Object

Parameters

NameType
tText

Returns

Object

NameType
xnumber
ynumber

getTextSize

getTextSize(t): Object

Parameters

NameType
tText

Returns

Object

NameType
heightnumber
widthnumber

isAnnotationCollection

isAnnotationCollection(a): a is AnnotationCollection

Parameters

NameType
aAnnotationFeature<Geometry, AnnotationProps> | FeatureCollection<Geometry, GeoJsonProperties>

Returns

a is AnnotationCollection

isArrow

isArrow(a): a is Arrow

Parameters

NameType
aAnnotationFeature<Geometry, AnnotationProps>

Returns

a is Arrow

isText

isText(a): a is Text

Parameters

NameType
aAnnotationFeature<Geometry, AnnotationProps>

Returns

a is Text

scaleGeometry

scaleGeometry(geometry, scale, ox, oy): LineString | Polygon

Parameters

NameType
geometryLineString | Polygon
scalenumber
oxnumber
oynumber

Returns

LineString | Polygon

setArrowEnd

setArrowEnd(a, x, y): void

Parameters

NameType
aArrow
xnumber
ynumber

Returns

void

setArrowEndPoint

setArrowEndPoint(a, side, x, y): void

Parameters

NameType
aArrow
side"start" | "end"
xnumber
ynumber

Returns

void

setArrowStart

setArrowStart(a, x, y): void

Parameters

NameType
aArrow
xnumber
ynumber

Returns

void

setTextBbox

setTextBbox(t, x, y, width, height): void

Parameters

NameType
tText
xnumber
ynumber
widthnumber
heightnumber

Returns

void

updateTextBbox

updateTextBbox(t): void

Parameters

NameType
tText

Returns

void