Skip to content

@linkurious/ogma-annotations

Classes

ClassDescription
ControlMain controller class for managing annotations. It manages rendering and editing of annotations.

Interfaces

InterfaceDescription
AnnotationCollectionCollection of Annotations, GeoJSON FeatureCollection
AnnotationFeatureBase interface for all annotation features.
AnnotationPropsBase properties for all annotations.
ArrowArrow annotation feature. Represents a directed line between two points, can connect a textbox to a shape.
ArrowPropertiesBase properties for all annotations.
ArrowStylesStyles specific to arrow annotations.
BoxBox annotation feature
BoxPropertiesProperties specific to box annotations.
BoxStyleStyles specific to box annotations.
CommentComment annotation type Geometry: Point (center position of comment box/icon)
CommentPropsProperties for Comment annotations
CommentStyleStyle configuration for Comment annotations
FeatureEventEvent related to a single annotation feature
FeaturesEventEvent related to multiple annotation features
HistoryEventHistory stack change event
LinkLink between an arrow and a text or node
PolygonPolygon placed on the graph, use it to highlight areas
PolygonPropertiesBase properties for all annotations.
PolygonStyleStyles specific to box annotations.
TextText annotation feature, represents a text box at a specific position
TextProperties-
TextStyleStyles specific to box annotations.

Type Aliases

Type AliasDescription
AnnotationUnion type of all Annotation features
AnnotationGetterFunction type to get an Annotation by its id
AnnotationOptions-
AnnotationTypeTypes of annotations supported
BoundsBounding box object, with the following properties: - [0]: min x - [1]: min y - [2]: max x - [3]: max y
ClientMouseEvent-
ColorAny valid color format
ControllerOptionsOptions for the annotations control
DeepPartial-
ExportedLink-
ExtremityExtremity types for arrow annotations.
FeatureEvents-
HexColorHex color string in format #RGB or #RRGGBB
IdUnique identifier type for annotations
Point2D coordinate
RgbaColorRGBA color string in format rgba(r, g, b, a)
RgbColorRGB color string in format rgb(r, g, b)
Side-
StrokeStroke style for arrow annotations
StrokeOptionsStroke style options for annotations
StrokeStyle-
StrokeTypeStroke types available for annotations
TargetType-

Variables

VariableDescription
COMMENT_MODE_COLLAPSED-
COMMENT_MODE_EXPANDED-
DATA_ATTR-
DEFAULT_SEND_ICONDefault send button icon (paper plane)
defaultArrowOptionsDefault options for creating new Arrow annotations. Contains the default arrow structure with defaultArrowStyle.
defaultArrowStyleDefault style configuration for arrow annotations.
defaultBoxOptionsDefault options for creating new Box annotations. Contains the default box structure with defaultBoxStyle.
defaultBoxStyleDefault style configuration for box annotations.
defaultCommentOptionsDefault options for creating new Comments. Contains the default comment configuration with defaultCommentStyle.
defaultCommentStyleDefault style for Comment annotations
defaultPolygonPropertiesDefault polygon properties for creating new Polygon annotations. Contains the default polygon configuration with defaultPolygonStyle.
defaultPolygonStyleDefault style configuration for polygon annotations.
defaultTextOptionsDefault options for creating new Text annotations. Contains the default text structure with defaultTextStyle.
defaultTextStyleDefault style configuration for text annotations.
EVT_ADD-
EVT_CANCEL_DRAWING-
EVT_CLICK-
EVT_COMPLETE_DRAWING-
EVT_DRAG-
EVT_DRAG_END-
EVT_DRAG_START-
EVT_HISTORY-
EVT_HOVER-
EVT_LINK-
EVT_REMOVE-
EVT_SELECT-
EVT_UNHOVER-
EVT_UNSELECT-
EVT_UPDATE-
handleDetectionThreshold-
handleRadius-
HL_BRIGHTEN-
NONE-
SIDE_END-
SIDE_START-
TEXT_LINE_HEIGHT-

Functions

FunctionDescription
adjustColorBrightnessAutomatically lightens or darkens a color (hex or rgba) for highlight purposes.
asColorSafely cast a string to a Color type with runtime validation
asHexColorSafely cast a string to a HexColor type with runtime validation
asRgbaColorSafely cast a string to an RgbaColor type with runtime validation
asRgbColorSafely cast a string to an RgbColor type with runtime validation
brightenBrighten a color for highlight purposes.
calculateCommentZoomThresholdCalculate optimal zoom threshold for auto-collapse based on comment dimensions
canDetachArrowEndCheck if arrow endpoint can be detached from its target
canDetachArrowStartCheck if arrow start point can be detached from its source
clientToContainerPosition-
colorToRgba-
createArrow-
createBox-
createCommentCreate a new Comment annotation
createCommentWithArrowCreate a comment with an arrow pointing to a target location
createPolygonCreate a polygon annotation
createText-
darkenDarken a color for highlight purposes.
getAnnotationsBoundsCalculate the bounds of a collection of annotations
getArrowEnd-
getArrowEndPoints-
getArrowSide-
getArrowStart-
getAttachmentPointOnNode-
getBbox-
getBoxCenter-
getBoxPosition-
getBoxSize-
getCommentPositionGet the position (center) of a comment
getCommentSizeGet the dimensions of a comment based on its mode
getCommentZoomThresholdGet the effective zoom threshold for a comment Uses explicit threshold if set, otherwise calculates from dimensions
getCoordinates-
getHandleId-
getPolygonBoundsGet bounding box of a polygon
getPolygonCenterGet centroid (geometric center) of a polygon
hexShortToLong-
hexToRgbaAdds alpha channel to a hex color
isAnnotationCollectionHelper to check if a feature collection is an annotation collection
isArrow-
isBox-
isColorType guard to check if a string is a valid color
isCommentType guard to check if an annotation is a Comment
isCommentArrowCheck if an arrow is connected to a comment
isHexColorType guard to check if a string is a valid hex color
isPolygon-
isRgbaColorType guard to check if a string is a valid RGBA color
isRgbColorType guard to check if a string is a valid RGB color
isText-
parseColor-
rgbToRgbaAdds alpha channel to an rgb color
scaleGeometry-
scalePolygonScale polygon around an origin point
setArrowEnd-
setArrowEndPoint-
setArrowStart-
setBbox-
simplifyPolygonPolyline simplification using a combination of the Radial Distance and the Douglas-Peucker algorithms See https://github.com/mourner/simplify-js for more details
toggleCommentModeToggle comment mode between collapsed and expanded
translatePolygonTranslate (move) a polygon by dx, dy
updateBbox-
updatePolygonBboxUpdate bbox for a polygon

References

getTextBbox

Renames and re-exports getBbox


getTextPosition

Renames and re-exports getBoxPosition


getTextSize

Renames and re-exports getBoxSize


setTextBbox

Renames and re-exports setBbox


updateTextBbox

Renames and re-exports updateBbox