Texts
Texts Draw, update, edit texts
Constructors
constructor
• new Texts(ogma
, options?
): Texts
Parameters
Name | Type |
---|---|
ogma | Ogma <any , any > |
options | Pick <Partial <ControllerOptions >, "textPlaceholder" | "textHandleSize" > |
Returns
Properties
editor
• Protected
editor: Overlay
elements
• Protected
elements: Text
[]
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
): Text
Parameters
Name | Type | Description |
---|---|---|
options | Text | 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 <Text > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>]) => void |
context? | any |
Returns
this
cancelDrawing
▸ cancelDrawing(): void
Returns
void
destroy
▸ destroy(): void
Returns
void
detect
▸ detect(«destructured»
, margin?
): undefined
| Text
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Point | undefined |
margin | number | 0 |
Returns
undefined
| Text
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 <Text > |
Parameters
Name | Type |
---|---|
event | T |
...args | ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>] |
Returns
boolean
enableDetection
▸ enableDetection(): void
Returns
void
eventNames
▸ eventNames(): keyof Events
<Text
>[]
Return an array listing the events for which the emitter has registered listeners.
Returns
getById
▸ getById(id
): Text
Parameters
Name | Type |
---|---|
id | Id |
Returns
getDefaultOptions
▸ getDefaultOptions(): Text
Returns
getElements
▸ getElements(): Text
[]
Returns
Text
[]
getSelectedFeature
▸ getSelectedFeature(): null
| Text
Returns
null
| Text
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 <Text > |
Returns
number
listeners
▸ listeners<T
>(event
): (...args
: ArgumentMap
<Events
<Text
>>[Extract
<T
, keyof Events
<Text
>>]) => void
[]
Return the listeners registered for a given event.
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Text > |
Parameters
Name | Type |
---|---|
event | T |
Returns
(...args
: ArgumentMap
<Events
<Text
>>[Extract
<T
, keyof Events
<Text
>>]) => void
[]
off
▸ off<T
>(event
, fn?
, context?
, once?
): this
Type parameters
Name | Type |
---|---|
T | extends keyof Events <Text > |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>]) => 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 <Text > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>]) => 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
onViewChanged
▸ onViewChanged(): 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 <Text > |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>]) => 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<Text> |
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 <Text > |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : ArgumentMap <Events <Text >>[Extract <T , keyof Events <Text >>]) => 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 | Text |
scale | number |
ox | number |
oy | number |
Returns
void
select
▸ select(id
): void
Parameters
Name | Type |
---|---|
id | Id |
Returns
void
startDragging
▸ startDragging(text
, clientX
, clientY
): void
Parameters
Name | Type |
---|---|
text | Text |
clientX | number |
clientY | number |
Returns
void
startDrawing
▸ startDrawing(x
, y
, text?
): void
Parameters
Name | Type |
---|---|
x | number |
y | number |
text | Text |
Returns
void
unhover
▸ unhover(): Texts
Returns
unselect
▸ unselect(): Texts
Returns
update
▸ update(id
, element
): void
Parameters
Name | Type | Description |
---|---|---|
id | Id | Id of the annotation to update |
element | Partial <Text > | params of the annotation |
Returns
void
Method
update Updates an annotation (position, color etc)
updateAnnotation
▸ updateAnnotation(target
, element
): void
Parameters
Name | Type |
---|---|
target | Text |
element | Partial <Text > |
Returns
void
updateGeometry
▸ updateGeometry(annotation
, geometry
): void
Parameters
Name | Type |
---|---|
annotation | Text |
geometry | Partial <Polygon > |
Returns
void
updateStyle
▸ updateStyle(annotation
, style
): void
Parameters
Name | Type |
---|---|
annotation | Text |
style | Partial <undefined | TextStyle > |
Returns
void