new Highlight(graph, props) → {Highlight}
Properties:
Name | Type | Description |
---|---|---|
guid |
string | Unique GUID for highlight. |
graph |
Graph | Main Graph Object. |
type |
string | Stores the type of highlight as string, default type will be |
items |
array | Stores items of the highlight with which the it is associated with, e-g |
layers |
array | Stores layers of the highlight with ranges of the selection in that layer associated with highlight e-g: { layer: HighlightLayer, ranges: [HighlighterRange]} |
attrs |
array | Stores any custom attributes to be added for nodes of the Highlight { name: NAME OF ATTRIBUTE, value: VALUE OF ATTRIBUTE} |
Main Highlight Class, it will be used to create highlights for DCR
Parameters:
Name | Type | Description |
---|---|---|
graph |
Graph | A graph object of the current application is passed so it can be used to update the garph easily. |
props |
object | An object is passed with basic or updates to basic properties of the highlight object. |
Returns:
Returns Highlight Object.
- Type
- Highlight
Methods
(static) addItem(item) → {Highlight}
Add an item to Highlight
Parameters:
Name | Type | Description |
---|---|---|
item |
object | An object either of Class |
Returns:
Returns an object of Highlight
Class.
- Type
- Highlight
(static) addRange(layer, range) → {Highlight}
Add a range to Highlight
Parameters:
Name | Type | Description |
---|---|---|
layer |
HighlightLayer | A |
range |
object | An object containing range details e-g: {start = null; end = null; text = null} |
Returns:
Returns an object of Highlight
Class.
- Type
- Highlight
(static) getItemId(item) → {string}
Get the Id of the items in Highlight
Parameters:
Name | Type | Description |
---|---|---|
item |
object | An object either of Class |
Returns:
Returns id of the item or undefined.
- Type
- string
(static) remove(removeItems) → {bool}
Remove Highlight from graph Highlights
Parameters:
Name | Type | Description |
---|---|---|
removeItems |
bool | TODO: If we want to remove associated items as well, we have pass removeItems= true. |
Returns:
Always returns true.
- Type
- bool
(static) removeItem(item) → {Highlight}
Removes an item from Highlight, if there is no item then the Highlight is removed from Graph Highlights.
Parameters:
Name | Type | Description |
---|---|---|
item |
object | An object either of Class |
Returns:
Returns an object of Highlight
Class.
- Type
- Highlight
(static) removeRange(layer, range) → {Highlight}
Remove a range from Highlight
Parameters:
Name | Type | Description |
---|---|---|
layer |
HighlightLayer | A |
range |
object | An object containing range details e-g: {start = null; end = null; text = null} |
Returns:
Returns an object of Highlight
Class.
- Type
- Highlight