control.RouteButton
Extends IControl, ICustomizable.
The Route Button control: button with route panel in the popup. The key of the control in the storage control.storage — "routeButtonControl".
Constructor | Fields | Events | Methods
Constructor
control.RouteButton([parameters])
Parameters:
Parameter |
Default value |
Description |
— |
Type: Object Control parameters. |
|
true |
Type: Boolean If set to true, all modules needed to work with routes will be loaded lazily when the user opens the panel the first time. |
|
— |
Type: Object Control options. Use the 'routePanel' prefix to configure underlying IRoutePanel options. |
|
false |
Type: Boolean Whether the control registers its size in the map margins manager map.margin.Manager. |
|
true |
Type: Boolean Specifies whether route panel must automatically gain focus when popup opens. |
|
true |
Type: Boolean This flag enables to collapse the panel when the control loses focus. |
|
"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 in a line, 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. See also the description of the position option. |
|
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". |
|
true |
Type: Boolean This flag indicates whether popup expansion and collapse should be animated. |
|
'auto' |
Type: Boolean Specifies which button edge the popup should stick to. Takes the following values:
|
|
'210px' |
Type: String Specifies CSS width of popup. Width is restricted by 176px below and 400px above. |
|
— |
Type: Object Object describing the position of a control. |
|
'auto' |
Type: Number|String Position relative to the bottom edge of the map. |
|
10 |
Type: Number|String Position relative to the left edge of the map. |
|
'auto' |
Type: Number|String Position relative to the right edge of the map. |
|
108 |
Type: Number|String Position relative to the top edge of the map. |
|
'auto' |
Type: String Defines the appearance of the control. Takes the following values:
|
|
true |
Type: Boolean Indicates if the control is displayed. |
|
— |
Type: Object Object describing the state of a control. |
|
false |
Type: Boolean Indicates whether the popup with the panel is expanded. |
Examples:
1.
// Example 1.
// Creating a RouteButton control and adding it to the map.
var routeButton = new ymaps.control.RouteButton({
options: {
size: "small"
}
});
myMap.controls.add(routeButton);
2.
// Example 2.
// Add control to the left corner of the map and set default points of arrival and departure.
myMap.controls.add('routeButtonControl', {
size: "large",
float: "left",
floatIndex: 1000,
});
myMap.controls.get('routeButtonControl').routePanel.state.set({
fromEnabled: false,
from: "moscow",
to: "saint petersburg",
type: "auto"
});
Fields
Name |
Type |
Description |
Event manager. Inherited from IEventEmitter. |
||
Options manager. Inherited from IControl. |
||
Events
Name |
Description |
Change to the object options. Inherited from ICustomizable. |
|
The parent object reference changed. Data fields:
Inherited from IChild. |
Methods
Name |
Returns |
Description |
IControlParent|null |
Returns link to the parent object, or null if the parent element was not set. Inherited from IControl. |
|
Sets the parent object. If the null value is passed, the manager element will only be deleted from the current parent object. Inherited from IControl. |
Fields details
routePanel
{IRoutePanel} routePanel