Abstract Class: TextAdapter
@ghentcdh/annotated-text / TextAdapter
Abstract Class: TextAdapter
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:35
Extends
BaseAdapter
Extended by
Constructors
Constructor
new TextAdapter():
TextAdapter
Returns
TextAdapter
Inherited from
BaseAdapter.constructor
Properties
annotationAdapter
protectedannotationAdapter:AnnotationAdapter<any>
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:51
Inherited from
BaseAdapter.annotationAdapter
annotationModule
protectedannotationModule:AnnotationModule
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:27
Inherited from
BaseAdapter.annotationModule
flatText
flatText:
boolean=false
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:37
limit
limit:
object=null
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:38
end
end:
number
The end position in the text up to which to consider lines. This is exclusive.
ignoreLines?
optionalignoreLines:boolean
If true, characters that are outside the range will be ignored. If false, lines that intersect with the range will be included. Defaults to false.
start
start:
number
The start position in the text from which to consider lines. This is inclusive.
lines
lines:
TextLine[] =[]
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:43
name
abstractname:string
Defined in: libs/core/src/lib/adapter/BaseAdapter.ts:7
Name of the adapter. Be unique 😃.
Inherited from
BaseAdapter.name
style
style:
object
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:40
lineHeight
lineHeight:
number=22
lineOffset
lineOffset:
number=2
padding
padding:
number=6
svgModel
protectedsvgModel:SvgModel
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:52
Inherited from
BaseAdapter.svgModel
textAdapter
protectedtextAdapter:TextAdapter
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:50
Inherited from
BaseAdapter.textAdapter
textDirection
textDirection:
TextDirection='ltr'
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:36
textLength
textLength:
number=0
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:41
textOffset
textOffset:
number=0
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:39
Methods
changeConfig()
changeConfig():
void
Defined in: libs/core/src/lib/adapter/BaseAdapter.ts:18
Returns
void
Inherited from
BaseAdapter.changeConfig
clear()
clear():
void
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:110
Returns
void
getLimit()
getLimit(
lines?):Pick<{end:number;ignoreLines?:boolean;start:number; },"start"|"end">
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:52
Parameters
lines?
TextLine[]
Returns
Pick<{ end: number; ignoreLines?: boolean; start: number; }, "start" | "end">
getLine()
getLine(
lineUid):TextLine
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:106
Parameters
lineUid
string
Returns
inject()
inject<
T>(token):T
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:46
Inject a dependency from the annotation module's container.
Type Parameters
T
T
Parameters
token
Token<T>
The token identifying the service to inject
Returns
T
The service instance
Inherited from
BaseAdapter.inject
parse()
abstractparse(text):TextLine[]
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:50
Parses the given text into an array of TextLine objects. The parser is also responsible for handling text limits.
Parameters
text
string
Returns
TextLine[]
setConfig()
setConfig<
KEY>(key,value):void
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:83
Change the configuration of the adapter, it will update the eventlistener if rerendering of the annotations is needed. f.e. if the text direction changes, the adapter will emit a change event to update the annotations.
Type Parameters
KEY
KEY extends keyof TextAdapter
Parameters
key
KEY
value
TEXT_CONFIG_VALUES<KEY>
Returns
void
setConfigListener()
setConfigListener(
callback):void
Defined in: libs/core/src/lib/adapter/BaseAdapter.ts:14
Set a listener for configuration changes.
Parameters
callback
() => void
Returns
void
Inherited from
BaseAdapter.setConfigListener
setLineHeight()
setLineHeight(
height):void
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:70
Parameters
height
number
Returns
void
setLines()
setLines(
lines):void
Defined in: libs/core/src/lib/adapter/text/TextAdapter.ts:65
Parameters
lines
TextLine[]
Returns
void
setModule()
setModule(
module):void
Defined in: libs/core/src/lib/di/BaseAnnotationDiFn.ts:33
Set the annotation module for dependency injection. This must be called before using inject().
Parameters
module
AnnotationModule
Returns
void
Inherited from
BaseAdapter.setModule