Skip to content

Commit

Permalink
feat: do not show sidebar automatically in mobile if directions start…
Browse files Browse the repository at this point in the history
…ed via a pointerTriggeredAction
  • Loading branch information
amoncaldas committed Aug 4, 2021
1 parent 89433cb commit 751805c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/fragments/forms/map-form/components/map-form-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ export default {
*/
setSidebarIsOpen(open) {
if (typeof open !== 'boolean' && !this.$store.getters.embed) {
open = this.$store.getters.leftSideBarPinned || this.$mdAndUpResolution || (this.$store.getters.mode === constants.modes.directions && Place.getFilledPlaces(this.places).length === 1)
let filledPlaces = Place.getFilledPlaces(this.places).length
let startDirections = this.$store.getters.mode === constants.modes.directions && filledPlaces === 1 && !this.$store.getters.pointerTriggeredAction
open = this.$store.getters.leftSideBarPinned || this.$mdAndUpResolution || startDirections
}
this.$store.commit('pointerTriggeredAction', null)
this.$store.commit('setLeftSideBarIsOpen', open)
},
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,19 @@ export default {

// When the user click on the map and select a point as the route start
this.eventBus.$on('directionsFromPoint', (data) => {
this.$store.commit('pointerTriggeredAction', true)
context.directionsFromPoint(data)
})

// When the user click on the map and select a point as the route end
this.eventBus.$on('directionsToPoint', (data) => {
this.$store.commit('pointerTriggeredAction', true)
context.directionsToPoint(data)
})

// When the user click on the map and select to add this point to the route
this.eventBus.$on('addRouteStop', (data) => {
this.$store.commit('pointerTriggeredAction', true)
context.addRouteStop(data)
})

Expand Down
11 changes: 9 additions & 2 deletions src/store/modules/app-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const state = {
footerMiniHeight: 140,
sidebarFullWidth: 400,
sidebarShrunkWidth: 290,
sidebarHeaderHeight: 175
sidebarHeaderHeight: 175,
pointerTriggeredAction: false
}

const getters = {
Expand Down Expand Up @@ -50,7 +51,10 @@ const getters = {
},
pickPlaceId: state => {
return state.pickPlaceId
}
},
pointerTriggeredAction: state => {
return state.pointerTriggeredAction
}
}

const mutations = {
Expand All @@ -76,6 +80,9 @@ const mutations = {
},
mainMenu: (state, items) => {
state.mainMenu = items
},
pointerTriggeredAction: (state, value) => {
return state.pointerTriggeredAction = value
}
}

Expand Down

0 comments on commit 751805c

Please sign in to comment.