@linkurious/ogma-annotations
Classes
| Class | Description |
|---|---|
| Control | Main controller class for managing annotations. It manages rendering and editing of annotations. |
Interfaces
| Interface | Description |
|---|---|
| AnnotationCollection | Collection of Annotations, GeoJSON FeatureCollection |
| AnnotationFeature | Base interface for all annotation features. |
| AnnotationProps | Base properties for all annotations. |
| Arrow | Arrow annotation feature. Represents a directed line between two points, can connect a textbox to a shape. |
| ArrowProperties | Base properties for all annotations. |
| ArrowStyles | Styles specific to arrow annotations. |
| Box | Box annotation feature |
| BoxProperties | Properties specific to box annotations. |
| BoxStyle | Styles specific to box annotations. |
| Comment | Comment annotation type Geometry: Point (center position of comment box/icon) |
| CommentProps | Properties for Comment annotations |
| CommentStyle | Style configuration for Comment annotations |
| FeatureEvent | Event related to a single annotation feature |
| FeaturesEvent | Event related to multiple annotation features |
| HistoryEvent | History stack change event |
| Link | Link between an arrow and a text or node |
| Polygon | Polygon placed on the graph, use it to highlight areas |
| PolygonProperties | Base properties for all annotations. |
| PolygonStyle | Styles specific to box annotations. |
| Text | Text annotation feature, represents a text box at a specific position |
| TextProperties | - |
| TextStyle | Styles specific to box annotations. |
Type Aliases
| Type Alias | Description |
|---|---|
| Annotation | Union type of all Annotation features |
| AnnotationGetter | Function type to get an Annotation by its id |
| AnnotationOptions | - |
| AnnotationType | Types of annotations supported |
| Bounds | Bounding box object, with the following properties: - [0]: min x - [1]: min y - [2]: max x - [3]: max y |
| ClientMouseEvent | - |
| Color | Any valid color format |
| ControllerOptions | Options for the annotations control |
| DeepPartial | - |
| ExportedLink | - |
| Extremity | Extremity types for arrow annotations. |
| FeatureEvents | - |
| HexColor | Hex color string in format #RGB or #RRGGBB |
| Id | Unique identifier type for annotations |
| Point | 2D coordinate |
| RgbaColor | RGBA color string in format rgba(r, g, b, a) |
| RgbColor | RGB color string in format rgb(r, g, b) |
| Side | - |
| Stroke | Stroke style for arrow annotations |
| StrokeOptions | Stroke style options for annotations |
| StrokeStyle | - |
| StrokeType | Stroke types available for annotations |
| TargetType | - |
Variables
| Variable | Description |
|---|---|
| COMMENT_MODE_COLLAPSED | - |
| COMMENT_MODE_EXPANDED | - |
| DATA_ATTR | - |
| DEFAULT_SEND_ICON | Default send button icon (paper plane) |
| defaultArrowOptions | Default options for creating new Arrow annotations. Contains the default arrow structure with defaultArrowStyle. |
| defaultArrowStyle | Default style configuration for arrow annotations. |
| defaultBoxOptions | Default options for creating new Box annotations. Contains the default box structure with defaultBoxStyle. |
| defaultBoxStyle | Default style configuration for box annotations. |
| defaultCommentOptions | Default options for creating new Comments. Contains the default comment configuration with defaultCommentStyle. |
| defaultCommentStyle | Default style for Comment annotations |
| defaultPolygonProperties | Default polygon properties for creating new Polygon annotations. Contains the default polygon configuration with defaultPolygonStyle. |
| defaultPolygonStyle | Default style configuration for polygon annotations. |
| defaultTextOptions | Default options for creating new Text annotations. Contains the default text structure with defaultTextStyle. |
| defaultTextStyle | Default 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
| Function | Description |
|---|---|
| adjustColorBrightness | Automatically lightens or darkens a color (hex or rgba) for highlight purposes. |
| asColor | Safely cast a string to a Color type with runtime validation |
| asHexColor | Safely cast a string to a HexColor type with runtime validation |
| asRgbaColor | Safely cast a string to an RgbaColor type with runtime validation |
| asRgbColor | Safely cast a string to an RgbColor type with runtime validation |
| brighten | Brighten a color for highlight purposes. |
| calculateCommentZoomThreshold | Calculate optimal zoom threshold for auto-collapse based on comment dimensions |
| canDetachArrowEnd | Check if arrow endpoint can be detached from its target |
| canDetachArrowStart | Check if arrow start point can be detached from its source |
| clientToContainerPosition | - |
| colorToRgba | - |
| createArrow | - |
| createBox | - |
| createComment | Create a new Comment annotation |
| createCommentWithArrow | Create a comment with an arrow pointing to a target location |
| createPolygon | Create a polygon annotation |
| createText | - |
| darken | Darken a color for highlight purposes. |
| getAnnotationsBounds | Calculate the bounds of a collection of annotations |
| getArrowEnd | - |
| getArrowEndPoints | - |
| getArrowSide | - |
| getArrowStart | - |
| getAttachmentPointOnNode | - |
| getBbox | - |
| getBoxCenter | - |
| getBoxPosition | - |
| getBoxSize | - |
| getCommentPosition | Get the position (center) of a comment |
| getCommentSize | Get the dimensions of a comment based on its mode |
| getCommentZoomThreshold | Get the effective zoom threshold for a comment Uses explicit threshold if set, otherwise calculates from dimensions |
| getCoordinates | - |
| getHandleId | - |
| getPolygonBounds | Get bounding box of a polygon |
| getPolygonCenter | Get centroid (geometric center) of a polygon |
| hexShortToLong | - |
| hexToRgba | Adds alpha channel to a hex color |
| isAnnotationCollection | Helper to check if a feature collection is an annotation collection |
| isArrow | - |
| isBox | - |
| isColor | Type guard to check if a string is a valid color |
| isComment | Type guard to check if an annotation is a Comment |
| isCommentArrow | Check if an arrow is connected to a comment |
| isHexColor | Type guard to check if a string is a valid hex color |
| isPolygon | - |
| isRgbaColor | Type guard to check if a string is a valid RGBA color |
| isRgbColor | Type guard to check if a string is a valid RGB color |
| isText | - |
| parseColor | - |
| rgbToRgba | Adds alpha channel to an rgb color |
| scaleGeometry | - |
| scalePolygon | Scale polygon around an origin point |
| setArrowEnd | - |
| setArrowEndPoint | - |
| setArrowStart | - |
| setBbox | - |
| simplifyPolygon | Polyline simplification using a combination of the Radial Distance and the Douglas-Peucker algorithms See https://github.com/mourner/simplify-js for more details |
| toggleCommentMode | Toggle comment mode between collapsed and expanded |
| translatePolygon | Translate (move) a polygon by dx, dy |
| updateBbox | - |
| updatePolygonBbox | Update 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