Skip to content

Commit

Permalink
added swipe handler
Browse files Browse the repository at this point in the history
  • Loading branch information
alensiljak committed Nov 7, 2024
1 parent fac9c60 commit 04311f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/layouts/Qlayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@
<QSidebar ref="sidebar" />

<q-page-container>
<router-view />
<div v-touch-swipe.mouse.right="onSwipe">
<router-view />
</div>
</q-page-container>
</q-layout>
</template>

<script lang="ts">
import { useMainStore } from '../store/mainStore'
import QSidebar from '../components/QSidebar.vue'
import Toolbar from '../components/CashierToolbar.vue'
const mainStore = useMainStore()
export default {
name: 'LayoutDefault',
components: {
QSidebar,
Toolbar,
},
methods: {
onSwipe(evt: any): void {
// console.log('open drawer', evt.direction, evt.duration, evt.distance)
// apply min. swipe distance before toggling the drawer.
if (evt.distance > 30) {
mainStore.toggleDrawer()
}
}
}
}
</script>

Expand Down
8 changes: 7 additions & 1 deletion src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ onMounted(async () => {
dataCreationDialogVisible.value = true
}
visibleCards.value = await settings.get(SettingKeys.visibleCards)
// show only selected cards.
var visibleCardsSetting = await settings.get(SettingKeys.visibleCards)
if (visibleCardsSetting == null) {
visibleCards.value = Object.values(CardNames)
} else {
visibleCards.value = visibleCardsSetting
}
})
function menuClicked() {
Expand Down

0 comments on commit 04311f8

Please sign in to comment.