File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -443,6 +443,27 @@ export default class MapboxDirections {
443443 return this ;
444444 }
445445
446+ /**
447+ * Sets origin. _Note:_ calling this method requires the [map load event](https://www.mapbox.com/mapbox-gl-js/api/#Map.load)
448+ * to have run.
449+ * @param {Array<number>|String } query An array of coordinates [lng, lat] or location name as a string.
450+ * @returns {MapboxDirections } this
451+ */
452+ setProfile ( query ) {
453+ console . log ( query ) ;
454+ if ( typeof query === 'string' ) {
455+ if ( query === `mapbox/driving-traffic` ||
456+ query === `mapbox/driving` ||
457+ query === `mapbox/walking` ||
458+ query === `mapbox/cycling` ) {
459+ this . actions . setProfile ( query ) ;
460+ this . actions . eventEmit ( 'profile' , { query } ) ;
461+ }
462+ }
463+
464+ return this ;
465+ }
466+
446467 /**
447468 * Returns the destination of the current route.
448469 * @returns {Object } destination
You can’t perform that action at this time.
0 commit comments