From a0ecb93eeb1890292a2fa3ca49284c6228ae2578 Mon Sep 17 00:00:00 2001 From: mapsam Date: Tue, 6 Dec 2016 15:29:39 -0800 Subject: [PATCH 1/2] deep assign objects, hide instructions --- package.json | 1 + src/directions.js | 4 ++-- src/reducers/index.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3d1a7a5..6c260ec 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "webworkify-webpack": "1.1.7" }, "dependencies": { + "deep-assign": "^2.0.0", "lodash.debounce": "^4.0.6", "lodash.isequal": "^4.2.0", "lodash.template": "^4.2.5", diff --git a/src/directions.js b/src/directions.js index b0dd44e..44976bb 100644 --- a/src/directions.js +++ b/src/directions.js @@ -43,7 +43,7 @@ export default class MapboxDirections { new Inputs(inputEl, store, this.actions, this._map); const directionsEl = document.createElement('div'); - directionsEl.className = 'directions-control-directions-container'; + directionsEl.className = 'directions-control directions-control-instructions'; new Instructions(directionsEl, store, { hoverMarker: this.actions.hoverMarker, @@ -51,7 +51,7 @@ export default class MapboxDirections { }, this._map); if (controls.inputs) el.appendChild(inputEl); - el.appendChild(directionsEl); + if (controls.instructions) el.appendChild(directionsEl); this.subscribedActions(); if (this._map.loaded()) this.mapState() diff --git a/src/reducers/index.js b/src/reducers/index.js index b8ab057..36488cf 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,4 +1,5 @@ import * as types from '../constants/action_types.js'; +import deepAssign from 'deep-assign'; const initialState = { // Options set on initialization @@ -42,7 +43,7 @@ const initialState = { function data(state = initialState, action) { switch (action.type) { case types.SET_OPTIONS: - return Object.assign({}, state, action.options); + return deepAssign({}, state, action.options); case types.DIRECTIONS_PROFILE: return Object.assign({}, state, { From 4272fb43fcae54396524eab45f72ab3d9a985925 Mon Sep 17 00:00:00 2001 From: mapsam Date: Tue, 6 Dec 2016 15:36:47 -0800 Subject: [PATCH 2/2] update changelog [skip ci] --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f426397..6732148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.3 + +- [bug] re-enable hiding instructions panel [#101](https://github.com/mapbox/mapbox-gl-directions/issues/101) + ## 3.0.2 - [bug] Fixing a fix for `3.0.1`. Missed a single space.