Browse Source

fix: check for more keys

pull/8990/head
DarkPhoenix2704 4 months ago
parent
commit
a08d960181
No known key found for this signature in database
GPG Key ID: 3F76B10622A07849
  1. 8
      packages/nc-gui/components/nc/Carousel/index.vue

8
packages/nc-gui/components/nc/Carousel/index.vue

@ -19,16 +19,16 @@ onUnmounted(() => {
}) })
function onKeyDown(event: KeyboardEvent) { function onKeyDown(event: KeyboardEvent) {
const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft' const prevKey = props.orientation === 'vertical' ? ['ArrowUp', 'Up', 'w', 'W'] : ['ArrowLeft', 'Left', 'a', 'A']
const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight' const nextKey = props.orientation === 'vertical' ? ['ArrowDown', 'Down', 's', 'S'] : ['ArrowRight', 'Right', 'd', 'D']
if (event.key === prevKey) { if (prevKey.includes(event.key)) {
event.preventDefault() event.preventDefault()
carouselArgs.scrollPrev() carouselArgs.scrollPrev()
return return
} }
if (event.key === nextKey) { if (nextKey.includes(event.key)) {
event.preventDefault() event.preventDefault()
carouselArgs.scrollNext() carouselArgs.scrollNext()
} }

Loading…
Cancel
Save