Skip to content

Commit 5e182b7

Browse files
committed
Nest profile switch option under controls.
1 parent 2ac2d23 commit 5e182b7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/controls/inputs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ let tmpl = template(fs.readFileSync(__dirname + '/../templates/inputs.html', 'ut
1717
*/
1818
export default class Inputs {
1919
constructor(el, store, actions, map) {
20-
const { originQuery, destinationQuery, profile, profileSwitcher } = store.getState();
20+
const { originQuery, destinationQuery, profile, controls } = store.getState();
2121

2222
el.innerHTML = tmpl({
2323
originQuery,
2424
destinationQuery,
2525
profile,
26-
profileSwitcher
26+
controls
2727
});
2828

2929
this.container = el;

src/directions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import Instructions from './controls/instructions';
2424
* @param {String} [options.accessToken=null] Required unless `mapboxgl.accessToken` is set globally
2525
* @param {Boolean} [options.interactive=true] Enable/Disable mouse or touch interactivity from the plugin
2626
* @param {String} [options.profile="mapbox/driving-traffic"] Routing profile to use. Options: `mapbox/driving-traffic`, `mapbox/driving`, `mapbox/walking`, `mapbox/cycling`
27-
* @param {Boolean} [options.profileSwitcher=true] Whether to show the default profile switch with options for traffic, driving, walking and cycling.
2827
* @param {Boolean} [options.alternatives=true] Whether to enable alternatives.
2928
* @param {String} [options.unit="imperial"] Measurement system to be used in navigation instructions. Options: `imperial`, `metric`
3029
* @param {Function} [options.compile=null] Provide a custom function for generating instruction, compatible with osrm-text-instructions.
3130
* @param {Object} [options.geocoder] Pass options available to mapbox-gl-geocoder as [documented here](https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#mapboxglgeocoder).
3231
* @param {Object} [options.controls]
3332
* @param {Boolean} [options.controls.inputs=true] Hide or display the inputs control.
3433
* @param {Boolean} [options.controls.instructions=true] Hide or display the instructions control.
34+
* @param {Boolean} [options.controls.profileSwitcher=true] Hide or display the default profile switch with options for traffic, driving, walking and cycling.
3535
* @example
3636
* var MapboxDirections = require('../src/index');
3737
* var directions = new MapboxDirections({

src/reducers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const initialState = {
55
// Options set on initialization
66
api: 'https://api.mapbox.com/directions/v5/',
77
profile: 'mapbox/driving-traffic',
8-
profileSwitcher: true,
98
alternatives: false,
109
unit: 'imperial',
1110
compile: null,
@@ -14,6 +13,7 @@ const initialState = {
1413

1514
// UI controls
1615
controls: {
16+
profileSwitcher: true,
1717
inputs: true,
1818
instructions: true
1919
},

src/templates/inputs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
</div>
2222

23-
<% if (profileSwitcher) { %>
23+
<% if (controls.profileSwitcher) { %>
2424
<div class='mapbox-directions-profile mapbox-directions-component-keyline mapbox-directions-clearfix'><input
2525
id='mapbox-directions-profile-driving-traffic'
2626
type='radio'

0 commit comments

Comments
 (0)