Skip to content

Commit

Permalink
feat: create setting to disable touch gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Nov 15, 2021
1 parent 4cae959 commit e21135b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions components/layout/navigation/sidenav/TouchHandlerMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { mapActions, mapGetters } from 'vuex'
export default {
computed: {
...mapGetters('navigation', ['isSideNavActive', 'isSearchActive']),
...mapGetters('user', ['getUserSettings']),
},

methods: {
Expand All @@ -12,6 +13,11 @@ export default {
]),

touchHandler(direction, event) {
if (!this.getUserSettings.touchGestures.value) {
console.debug('`touchGestures` setting is disabled, skipping...')
return
}

const touchThreshold = screen.availWidth * 0.25
// console.debug(touchThreshold, event)

Expand Down
7 changes: 0 additions & 7 deletions pages/usage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
/>

<ContentContainer
title="Touch navigation"
text="Devices with touch support can swipe `left-to-right` to open the navigation menu, and `right-to-left` to open the search menu."
/>

<ContentContainer
title="Keyboard page controls"
text="Keyboard's `right` and `left` arrows will navigate pages similar to clicking the page controls buttons."
img="/img/usage_examples/keyboard-controls"
text="Keyboard's `right` and `left` arrows will navigate pages similar to clicking the page controls buttons."
title="Keyboard page controls"
Expand Down
8 changes: 8 additions & 0 deletions store/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ export const state = () => ({
},

settings: {
touchGestures: {
name: 'Touch gestures',
description:
'Swiping `left-to-right` will open the navigation menu, and `right-to-left` will open the search menu.',
value: true,
defaultValue: true,
},

hoverControls: {
name: 'Hover controls',
description: 'Page controls will be fixed over the content.',
Expand Down

0 comments on commit e21135b

Please sign in to comment.