Привет.
Использую этот пример http://dimik.github.io/ymaps/examples/routes-menu/, само решение подходит полностью, но реализация сложноватая, примеры в песочнице, документация не помогли. Куда там влезть в код, чтобы изменить цвет маршрута и иконки маркеров, и цвет дополнительного маршрута.
Я добавил в код multiRoute: true
_getRoute: function (coords, callback) {
ymaps.route(coords, {
mapStateAutoApply: true,
multiRoute: true
}).then(callback);
}Все способы предпринимал в этом отрезке кода
//route-selector-map-view.js
function RouteSelectorMapView(map) {
this._map = map;
this._routes = new ListCollection();
this._activeItem = null;
}
RouteSelectorMapView.prototype = {
constructor: RouteSelectorMapView,
render: function (data) {
this._routes.properties.set('items', data);
this._map.geoObjects.add(this._routes);
return this;
},
clear: function () {
this._routes.removeAll();
this._map.geoObjects.remove(this._routes);
this._routes.properties.unset('items');
return this;
},
setActiveItem: function (index) {
var route = this._routes.get(index);
if(route) {
(this._activeItem = route)
.options.set('visible', true);
this._map.setBounds(route.properties.get('boundedBy'));
}
else {
var self = this,
coords = this._routes.properties.get('items')[index].path;
this._getRoute(coords, function (route) {
self._routes.add(
self._activeItem = route,
index
);
});
}
return this;
},
unsetActiveItem: function () {
if(this._activeItem) {
this._activeItem.options.set('visible', false);
this._activeItem = null;
}
return this;
},
_getRoute: function (coords, callback) {
ymaps.route(coords, {
mapStateAutoApply: true,
multiRoute: true
}).then(callback);
}
};Надеюсь на помощь. Спасибо.