fix(frontend): MkHorizontalSwipeでメニューを閉じるのに2回クリックが必要になる問題を修正

#13055
This commit is contained in:
syuilo 2024-01-21 18:08:49 +09:00
parent b3cc17ea0d
commit 4c87e98e12

View file

@ -6,10 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div <div
ref="rootEl" ref="rootEl"
:class="[$style.transitionRoot, (defaultStore.state.animation && $style.enableAnimation)]" :class="[$style.transitionRoot]"
@touchstart="touchStart" @touchstart.passive="touchStart"
@touchmove="touchMove" @touchmove.passive="touchMove"
@touchend="touchEnd" @touchend.passive="touchEnd"
> >
<Transition <Transition
:class="[$style.transitionChildren, { [$style.swiping]: isSwipingForClass }]" :class="[$style.transitionChildren, { [$style.swiping]: isSwipingForClass }]"
@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</Transition> </Transition>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, nextTick, watch } from 'vue'; import { ref, shallowRef, computed, nextTick, watch } from 'vue';
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue'; import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
@ -154,7 +155,7 @@ function touchEnd(event: TouchEvent) {
pullDistance.value = 0; pullDistance.value = 0;
isSwiping.value = false; isSwiping.value = false;
setTimeout(() => { window.setTimeout(() => {
isSwipingForClass.value = false; isSwipingForClass.value = false;
}, 400); }, 400);
} }
@ -178,12 +179,13 @@ watch(tabModel, (newTab, oldTab) => {
</script> </script>
<style lang="scss" module> <style lang="scss" module>
.transitionRoot.enableAnimation { .transitionRoot {
display: grid; display: grid;
grid-template-columns: 100%; grid-template-columns: 100%;
overflow: clip; overflow: clip;
}
.transitionChildren { .transitionChildren {
grid-area: 1 / 1 / 2 / 2; grid-area: 1 / 1 / 2 / 2;
transform: translateX(var(--swipe)); transform: translateX(var(--swipe));
@ -201,7 +203,6 @@ watch(tabModel, (newTab, oldTab) => {
&.swipeAnimationLeft_leaveTo { &.swipeAnimationLeft_leaveTo {
transform: translateX(calc(-100% - 24px)); transform: translateX(calc(-100% - 24px));
} }
}
} }
.swiping { .swiping {