K
K
khodos_dmitry2019-04-26 12:39:33
JavaScript
khodos_dmitry, 2019-04-26 12:39:33

How can I make the routeButtonControl button automatically expand and route?

The route should be built according to this code:

ymaps.geolocation.get({
                    autoReverseGeocode: false,
                    mapStateAutoApply: true
                }).then(function(result) {
                    var control = myMap.controls.get('routeButtonControl');
                    var office_id = onMapMarks[a].getAttribute('office-id');
                    // Зададим состояние панели для построения машрутов.
                    control.routePanel.state.set({
                        // Тип маршрутизации.
                        type: 'masstransit',
                        // Выключим возможность задавать пункт отправления в поле ввода.
                        fromEnabled: true,
                        // Адрес или координаты пункта отправления.
                        from: result.geoObjects.position,
                        // Включим возможность задавать пункт назначения в поле ввода.
                        toEnabled: true,
                        // Адрес или координаты пункта назначения.
                        to: data['offices'][office_id]['coord'].map(Number)
                    });
                });

The route is built, but only when you click on the "Routes" button. How to make the button automatically open and route is built?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question