Control 
Constructors 
constructor 
• new Control(ogma, options?): Control
Parameters 
| Name | Type | 
|---|---|
ogma | Ogma<any, any> | 
options | Partial<ControllerOptions> | 
Returns 
Properties 
prefixed 
▪ Static prefixed: string | boolean
Methods 
add 
▸ add(annotation): this
Add an annotation to the controller
Parameters 
| Name | Type | Description | 
|---|---|---|
annotation | Arrow | Text | AnnotationCollection | The annotation to add | 
Returns 
this
addListener 
▸ addListener<T>(event, fn, context?): this
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
fn | (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void | 
context? | any | 
Returns 
this
cancelDrawing 
▸ cancelDrawing(): void
Cancel drawing on the current frame
Returns 
void
destroy 
▸ destroy(): void
Destroy the controller and its elements
Returns 
void
emit 
▸ emit<T>(event, ...args): boolean
Calls each of the listeners registered for a given event.
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
...args | ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>] | 
Returns 
boolean
eventNames 
▸ eventNames(): keyof FeatureEvents[]
Return an array listing the events for which the emitter has registered listeners.
Returns 
keyof FeatureEvents[]
findMagnetPoint 
▸ findMagnetPoint(magnets, textToMagnet, point): undefined | MagnetPoint
Parameters 
| Name | Type | 
|---|---|
magnets | Point[] | 
textToMagnet | Text | 
point | Point | 
Returns 
undefined | MagnetPoint
getAnnotation 
▸ getAnnotation(id): undefined | Arrow | Text
Retrieve the annotation with the given id
Parameters 
| Name | Type | Description | 
|---|---|---|
id | Id | the id of the annotation to get | 
Returns 
The annotation with the given id
getAnnotations 
▸ getAnnotations(): AnnotationCollection
Returns 
the annotations in the controller
getSelected 
▸ getSelected(): null | Annotation
Returns 
null | Annotation
the currently selected annotation
listenerCount 
▸ listenerCount(event): number
Return the number of listeners listening to a given event.
Parameters 
| Name | Type | 
|---|---|
event | keyof FeatureEvents | 
Returns 
number
listeners 
▸ listeners<T>(event): (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void[]
Return the listeners registered for a given event.
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
Returns 
(...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void[]
loadLink 
▸ loadLink(arrow): void
Parameters 
| Name | Type | 
|---|---|
arrow | Arrow | 
Returns 
void
off 
▸ off<T>(event, fn?, context?, once?): this
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
fn? | (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void | 
context? | any | 
once? | boolean | 
Returns 
this
on 
▸ on<T>(event, fn, context?): this
Add a listener for a given event.
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
fn | (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void | 
context? | any | 
Returns 
this
onUpdate 
▸ onUpdate(annotation): void
Triggers the update event on the annotation
Parameters 
| Name | Type | Description | 
|---|---|---|
annotation | Annotation | The annotation updated | 
Returns 
void
once 
▸ once<T>(event, fn, context?): this
Add a one-time listener for a given event.
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
fn | (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void | 
context? | any | 
Returns 
this
refreshTextLinks 
▸ refreshTextLinks(): void
Returns 
void
remove 
▸ remove(annotation): this
Remove an annotation or an array of annotations from the controller
Parameters 
| Name | Type | Description | 
|---|---|---|
annotation | Arrow | Text | AnnotationCollection | The annotation(s) to remove | 
Returns 
this
removeAllListeners 
▸ removeAllListeners(event?): this
Remove all listeners, or those of the specified event.
Parameters 
| Name | Type | 
|---|---|
event? | keyof FeatureEvents | 
Returns 
this
removeListener 
▸ removeListener<T>(event, fn?, context?, once?): this
Remove the listeners of a given event.
Type parameters 
| Name | Type | 
|---|---|
T | extends keyof FeatureEvents | 
Parameters 
| Name | Type | 
|---|---|
event | T | 
fn? | (...args: ArgumentMap<FeatureEvents>[Extract<T, keyof FeatureEvents>]) => void | 
context? | any | 
once? | boolean | 
Returns 
this
select 
▸ select(id): this
Selects the annotation with the given id
Parameters 
| Name | Type | Description | 
|---|---|---|
id | Id | the id of the annotation to select | 
Returns 
this
setOptions 
▸ setOptions(options?): ControllerOptions
Set the options for the controller
Parameters 
| Name | Type | Description | 
|---|---|---|
options | Partial<ControllerOptions> | new Options | 
Returns 
the updated options
setScale 
▸ setScale(id, scale, ox, oy): Control
Parameters 
| Name | Type | 
|---|---|
id | Id | 
scale | number | 
ox | number | 
oy | number | 
Returns 
startArrow 
▸ startArrow(x, y, arrow?): void
Start adding an arrow (add it, and give control to the user)
Parameters 
| Name | Type | Description | 
|---|---|---|
x | number | coord of the first point | 
y | number | coord of the first point | 
arrow? | Arrow | The arrow to add | 
Returns 
void
startText 
▸ startText(x, y, text?): void
Start adding a text (add it, and give control to the user)
Parameters 
| Name | Type | Description | 
|---|---|---|
x | number | coord of the top left point | 
y | number | coord of the top left point | 
text? | Text | The text to add | 
Returns 
void
unselect 
▸ unselect(): this
Unselects the currently selected annotation
Returns 
this
updateStyle 
▸ updateStyle<A>(id, style): this
Update the style of the annotation with the given id
Type parameters 
| Name | Type | 
|---|---|
A | extends Annotation | 
Parameters 
| Name | Type | Description | 
|---|---|---|
id | Id | The id of the annotation to update | 
style | A["properties"]["style"] | The new style | 
Returns 
this