Extends
Constructor
new ve.ce.SelectionManager(surface)
#
Hierarchy
Selection manager
Handles rendering of fake selections on the surface:
- The deactivated selection stands in the user's native selection when the native selection is moved elsewhere (e.g. an inspector, or a dropdown menu).
- In a multi-user environment, other users' selections from the surface synchronizer are rendered here.
- Other tools can manually render fake selections, e.g. the FindAndReplaceDialog can highlight matched text, by calling #drawSelections directly.
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ce.Surface |
- Mixes in:
- Source:
Selection manager
Handles rendering of fake selections on the surface:
- The deactivated selection stands in the user's native selection when the native selection is moved elsewhere (e.g.
Methods
destroy()
#
Destroy the selection manager
- Source:
drawSelections(name, selections, [options])
#
Draw selections.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Unique name for the selection being drawn |
|||||||||||||
selections |
Array.<ve.ce.Selection> | Selections to draw |
|||||||||||||
options |
Object |
optional |
Properties:
|
- Source:
getDrawnSelection(name, selection, [options]) → {jQuery}
#
Get an already drawn selection from the cache
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | Name of selection group |
|
selection |
ve.dm.Selection | Selection model |
|
options |
Object |
optional |
Selection options |
- Source:
Returns:
Drawn selection
- Type
- jQuery
getDrawnSelectionCacheKey(name, selection, [options]) → {string}
#
Get a cache key for a drawn selection
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | Name of selection group |
|
selection |
ve.dm.Selection | Selection model |
|
options |
Object |
optional |
Selection options |
- Source:
Returns:
Cache key
- Type
- string
getSurface() → {ve.ce.Surface}
#
hideDeactivatedSelection()
#
Hide the deactivated selection
- Source:
onSurfacePosition()
#
Respond to a position event on this surface
- Source:
onSynchronizerAuthorDisconnect(authorId)
#
Called when the synchronizer receives a remote author disconnect
Parameters:
Name | Type | Description |
---|---|---|
authorId |
number | The author ID |
- Source:
onSynchronizerAuthorUpdate(authorId)
#
Called when the synchronizer receives a remote author selection or name change
Parameters:
Name | Type | Description |
---|---|---|
authorId |
number | The author ID |
- Source:
paintAuthor(authorId)
#
Paint a remote author's current selection, as stored in the synchronizer
Parameters:
Name | Type | Description |
---|---|---|
authorId |
number | The author ID |
- Source:
redrawSelections()
#
Redraw selections
This is triggered by a surface 'position' event, which fires when the surface changes size, or when the document is modified. The drawnSelectionCache is cleared as these two things will cause any previously calculated rectangles to be incorrect.
- Source:
Redraw selections
This is triggered by a surface 'position' event, which fires when the surface changes size, or when the document is modified.
showDeactivatedSelection([showAsActivated])
#
Start showing the deactivated selection
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
showAsActivated |
boolean |
optional |
true | Selection should still show as activated |
- Source:
storeDrawnSelection($selection, name, selection, [options]) → {string}
#
Store an already drawn selection in the cache
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
$selection |
jQuery | Drawn selection |
|
name |
string | Name of selection group |
|
selection |
ve.dm.Selection | Selection model |
|
options |
Object |
optional |
Selection options |
- Source:
Returns:
Cache key
- Type
- string
Events
update(hasSelections)
#
Parameters:
Name | Type | Description |
---|---|---|
hasSelections |
boolean | The selection manager has some non-collapsed selections |
- Source: