Arrows
Arrows Draw and edit arrows
Constructors
constructor
• new Arrows(ogma
, options?
): Arrows
Parameters
Name | Type |
---|---|
ogma | Ogma <any , any > |
options | Pick <Partial <ControllerOptions >, "arrowHandleSize" | "maxArrowHeight" | "minArrowHeight" > |
Returns
Properties
editor
• Protected
editor: Overlay
elements
• Protected
elements: Arrow
[]
hoveredId
• Protected
hoveredId: Id
= NONE
isDragging
• Protected
isDragging: boolean
layer
• Protected
layer: SVGLayer
ogma
• Protected
ogma: Ogma
<any
, any
>
ogmaOptions
• Protected
ogmaOptions: Options$a
selectedId
• Protected
selectedId: Id
= NONE
shouldDetect
• Protected
shouldDetect: boolean
showeditorOnHover
• Protected
showeditorOnHover: boolean
prefixed
▪ Static
prefixed: string
| boolean
Methods
add
▸ add(options
): Arrow
Parameters
Name | Type | Description |
---|---|---|
options | Arrow | Params for the annotation (merged with default) |
Returns
the added annotation
Method
add
addListener
▸ addListener<T
>(event
, fn
, context?
): this
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>]) => void |
context? | any |
Returns
this
cancelDrawing
▸ cancelDrawing(): void
Returns
void
destroy
▸ destroy(): void
Returns
void
detect
▸ detect(point
, margin?
): undefined
| Arrow
Parameters
Name | Type | Default value |
---|---|---|
point | Point | undefined |
margin | number | 0 |
Returns
undefined
| Arrow
disableDetection
▸ disableDetection(): void
Returns
void
Method
disableDetection Disables the hover behaviour, used by controller to avoid hovering arrows while dragging texts and vice versa
disableDragging
▸ disableDragging(): void
Returns
void
Method
disableDragging Prevents Ogma from dragging elements or moving the view while dragging an annotation
draw
▸ draw(svg
): void
Parameters
Name | Type |
---|---|
svg | SVGSVGElement |
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 Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
...args | ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>] |
Returns
boolean
enableDetection
▸ enableDetection(): void
Returns
void
eventNames
▸ eventNames(): keyof Events
<Arrow
>[]
Return an array listing the events for which the emitter has registered listeners.
Returns
getById
▸ getById(id
): Arrow
Parameters
Name | Type |
---|---|
id | Id |
Returns
getDefaultOptions
▸ getDefaultOptions(): Arrow
Returns
getElements
▸ getElements(): Arrow
[]
Returns
Arrow
[]
getSelectedFeature
▸ getSelectedFeature(): null
| Arrow
Returns
null
| Arrow
hover
▸ hover(id
): void
Parameters
Name | Type |
---|---|
id | Id |
Returns
void
listenerCount
▸ listenerCount(event
): number
Return the number of listeners listening to a given event.
Parameters
Name | Type |
---|---|
event | keyof Events <Arrow > |
Returns
number
listeners
▸ listeners<T
>(event
): (...args
: ArgumentMap
<Events
<Arrow
>>[Extract
<T
, keyof Events
<Arrow
>>]) => void
[]
Return the listeners registered for a given event.
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
Returns
(...args
: ArgumentMap
<Events
<Arrow
>>[Extract
<T
, keyof Events
<Arrow
>>]) => void
[]
off
▸ off<T
>(event
, fn?
, context?
, once?
): this
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>]) => 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 Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>]) => void |
context? | any |
Returns
this
onHandleMouseDown
▸ onHandleMouseDown(evt
): void
Parameters
Name | Type |
---|---|
evt | MouseEvent |
Returns
void
onMouseMove
▸ onMouseMove(evt
): void
Parameters
Name | Type |
---|---|
evt | MouseEvent |
Returns
void
onMouseUp
▸ onMouseUp(): void
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 Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>]) => void |
context? | any |
Returns
this
refreshDrawing
▸ refreshDrawing(): void
Returns
void
refreshEditor
▸ refreshEditor(): void
Returns
void
refreshLayer
▸ refreshLayer(): void
Returns
void
remove
▸ remove(id
): void
Parameters
Name | Type | Description |
---|---|---|
id | Id | Id of the annotation to remove Removes annotation with the given id |
Returns
void
Method
remove
removeAllListeners
▸ removeAllListeners(event?
): this
Remove all listeners, or those of the specified event.
Parameters
Name | Type |
---|---|
event? | keyof Events<Arrow> |
Returns
this
removeListener
▸ removeListener<T
>(event
, fn?
, context?
, once?
): this
Remove the listeners of a given event.
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Arrow > |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : ArgumentMap <Events <Arrow >>[Extract <T , keyof Events <Arrow >>]) => void |
context? | any |
once? | boolean |
Returns
this
restoreDragging
▸ restoreDragging(): void
Returns
void
Method
restoreDragging restore ogma options as they were before we start dragging an annotation
scale
▸ scale(annotation
, scale
, ox
, oy
): void
Parameters
Name | Type |
---|---|
annotation | Arrow |
scale | number |
ox | number |
oy | number |
Returns
void
select
▸ select(id
): void
Parameters
Name | Type | Description |
---|---|---|
id | Id | id of the element to select Select element, show editor, disable Ogma dragging and fire event |
Returns
void
Method
select
startDragging
▸ startDragging(arrow
, x
, y
): void
Parameters
Name | Type |
---|---|
arrow | Arrow |
x | number |
y | number |
Returns
void
startDrawing
▸ startDrawing(x
, y
, arrow?
): void
Start drawing a new arrow, it will also be added as a new annotation
Parameters
Name | Type |
---|---|
x | number |
y | number |
arrow | Arrow |
Returns
void
unhover
▸ unhover(): Arrows
Returns
unselect
▸ unselect(): Arrows
Returns
update
▸ update(id
, element
): void
Parameters
Name | Type | Description |
---|---|---|
id | Id | Id of the annotation to update |
element | Partial <Arrow > | params of the annotation |
Returns
void
Method
update Updates an annotation (position, color etc)
updateAnnotation
▸ updateAnnotation(target
, element
): void
Parameters
Name | Type |
---|---|
target | Arrow |
element | Partial <Arrow > |
Returns
void
updateGeometry
▸ updateGeometry(annotation
, geometry
): void
Parameters
Name | Type |
---|---|
annotation | Arrow |
geometry | Partial <LineString > |
Returns
void
updateStyle
▸ updateStyle(annotation
, style
): void
Parameters
Name | Type |
---|---|
annotation | Arrow |
style | Partial <undefined | ArrowStyles > |
Returns
void