Address comments

This commit is contained in:
eana 2024-04-01 15:08:01 +00:00
parent 0666a78dcf
commit a5cd3c8b70
2 changed files with 8 additions and 7 deletions

View File

@ -16,8 +16,7 @@
/>
<i
v-else
class="ti ti-arrow-bar-to-down"
:class="[$style.icon, { [$style.refresh]: pullEnded }]"
:class="[$style.icon, icon('ph-arrow-down'), { [$style.refresh]: pullEnded }]"
></i>
<div :class="$style.text">
<template v-if="pullEnded">{{
@ -39,12 +38,14 @@
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef } from "vue";
import { i18n } from "@/i18n";
import { defaultStore } from "@/store";
import { getScrollContainer } from "@/scripts/scroll";
import { isDuringHorizontalSwipe } from "@/scripts/touch";
import icon from "@/scripts/icon";
const SCROLL_STOP = 10;
const MAX_PULL_DISTANCE = Infinity;
const FIRE_THRESHOLD = 230;
const FIRE_THRESHOLD = defaultStore.state.pullToRefreshThreshold;
const RELEASE_TRANSITION_DURATION = 200;
const PULL_BRAKE_BASE = 1.5;
const PULL_BRAKE_FACTOR = 170;
@ -197,7 +198,7 @@ function onScrollContainerScroll() {
function registerEventListenersForReadyToPull() {
if (rootEl.value == null) return;
rootEl.value.addEventListener("touchstart", moveStart, { passive: true });
rootEl.value.addEventListener("touchmove", moving, { passive: false }); // passive: falsepreventDefault使
rootEl.value.addEventListener("touchmove", moving, { passive: false }); // setting passive to false to allow preventDefault
}
function unregisterEventListenersForReadyToPull() {

View File

@ -11,13 +11,13 @@ if (isTouchSupported && !isTouchUsing) {
window.addEventListener(
"touchstart",
() => {
// maxTouchPointsなどでの判定だけだと、「タッチ機能付きディスプレイを使っているがマウスでしか操作しない」場合にも
// タッチで使っていると判定されてしまうため、実際に一度でもタッチされたらtrueにする
// maxTuochPoints reflects the property of the display, but there are cases where the display has touch functionality but the user uses a mouse.
// Therefore, we need to check if the user actually uses touch functionality.
isTouchUsing = true;
},
{ passive: true },
);
}
/** (MkHorizontalSwipe) 横スワイプ中か? */
/** (MkHorizontalSwipe) is during horizontal swipe? */
export const isDuringHorizontalSwipe = ref(false);