control.Manager
Manager for map controls.
Constructor | Fields | Methods
Constructor
control.Manager(map[, controls[, options]])
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: Map Instance of the map. |
— |
Type: String[]|IControl[] The controls which should be initially placed on the map. |
|
— |
Type: Object Manager options. |
|
10 |
Type: Number Distance between adjacent controls and the indent from the edges of the map. Specified in pixels. |
|
— |
Type: IPane Container for controls. |
|
['small', 'medium', 'large'] |
Type: String[] The array of sizes, from smallest to largest. |
* Mandatory parameter/option.
Fields
Name |
Type |
Description |
Event manager. |
||
Manager options. |
||
Manager state. Names of fields that are available via the data.Manager.get method:
|
Methods
Name |
Returns |
Description |
Adds a control to the manager. |
||
Calls a handler function for all the controls. |
||
IControl|null |
Returns the control, or null if no item has been found. |
|
Returns the Promise object, which is confirmed by the HTML element that should hold the child element. |
||
HTMLElement |
Returns container where elements of the control will be added. |
|
getMap() |
Returns reference to the map. |
|
Integer |
Returns -1 if the control has not been found, or the index of the item in the manager. |
|
Removing a control from the manager. |
Fields details
events
{event.Manager} events
Event manager.
options
{option.Manager} options
Manager options.
state
{data.Manager} state
Manager state. Names of fields that are available via the data.Manager.get method:
- size - The state of the controls.
Methods details
add
{control.Manager} add(control[, options])
Adds a control to the manager.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IControl|String Controls that are set by instances of classes that implement the IControl interface, or by keys. Acceptable key values:
Also, you can specify one of the predefined sets of controls using special keys:
|
|
— |
Type: Object Control options. |
|
"right" |
Type: String The side to which you want to align the control. Can take three values: "left", "right" or "none". If set to "left" or "right", the controls are arranged one by one, starting from the left or right edge of the map, respectively. If set to "none", the controls are positioned according to the values of the left, right, bottom and top options, relative to the boundaries of the map. |
|
0 |
Type: Number The priority of the control positioning. The element with highest priority is positioned closer to the map boundary that is specified in the float property. Does not work with float = "none". |
|
— |
Type: Object Object describing the position of a control. If the position option is set, the float option value is automatically treated as "none". |
|
'auto' |
Type: Number|String Position relative to the bottom edge of the map. Only works with float = none. |
|
'auto' |
Type: Number|String Position relative to the left edge of the map. Only works with float = none. |
|
'auto' |
Type: Number|String Position relative to the right edge of the map. Only works with float = none. |
|
'auto' |
Type: Number|String Position relative to the top edge of the map. Only works with float = none. |
* Mandatory parameter/option.
Example:
map.controls
.add('zoomControl')
.add('typeSelector');
each
{control.Manager} each(callback, context)
Calls a handler function for all the controls.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Function Handler function. Receives a collection item as input. If the function returns the value "false," processing stops. |
|
— |
Type: Object Context of the invoked function. |
* Mandatory parameter/option.
get
{IControl|null} get(index)
Returns the control, or null if no item has been found.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number|String The index of the desired element or key. |
* Mandatory parameter/option.
getChildElement
{vow.Promise} getChildElement(control)
Returns the Promise object, which is confirmed by the HTML element that should hold the child element.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IControl Control. |
* Mandatory parameter/option.
getContainer
{HTMLElement} getContainer()
Returns container where elements of the control will be added.
getMap
{Map} getMap()
Returns reference to the map.
indexOf
{Integer} indexOf(childToFind)
Returns -1 if the control has not been found, or the index of the item in the manager.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: String |
Control or its key. |
* Mandatory parameter/option.
remove
{control.Manager} remove(control)
Removing a control from the manager.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IControl|String The deleted control or its key. |
* Mandatory parameter/option.
Mandatory parameter/option.