lint
This commit is contained in:
parent
aab714b277
commit
8435a4b363
|
@ -39,7 +39,7 @@ let scrollEl: HTMLElement | null = null;
|
||||||
let disabled = false;
|
let disabled = false;
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emits = defineEmits<{
|
||||||
(e: 'refresh'): void;
|
(ev: 'refresh'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const getScrollableParentElement = (node) => {
|
const getScrollableParentElement = (node) => {
|
||||||
|
@ -49,8 +49,7 @@ const getScrollableParentElement = (node) => {
|
||||||
|
|
||||||
if (node.scrollHeight > node.clientHeight) {
|
if (node.scrollHeight > node.clientHeight) {
|
||||||
return node;
|
return node;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return getScrollableParentElement(node.parentNode);
|
return getScrollableParentElement(node.parentNode);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -62,10 +61,10 @@ const getScreenY = (event) => {
|
||||||
return event.touches[0].screenY;
|
return event.touches[0].screenY;
|
||||||
};
|
};
|
||||||
|
|
||||||
const moveStart = (e) => {
|
const moveStart = (event) => {
|
||||||
if (!isPullStart && !isRefreshing && !disabled) {
|
if (!isPullStart && !isRefreshing && !disabled) {
|
||||||
isPullStart = true;
|
isPullStart = true;
|
||||||
startScreenY = getScreenY(e);
|
startScreenY = getScreenY(event);
|
||||||
currentHeight = 0;
|
currentHeight = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -111,14 +110,13 @@ const moveEnd = () => {
|
||||||
isPullEnd = false;
|
isPullEnd = false;
|
||||||
isRefreshing = true;
|
isRefreshing = true;
|
||||||
fixOverContent().then(() => emits('refresh'));
|
fixOverContent().then(() => emits('refresh'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
closeContent().then(() => isPullStart = false);
|
closeContent().then(() => isPullStart = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const moving = (e) => {
|
const moving = (event) => {
|
||||||
if (!isPullStart || isRefreshing || disabled) return;
|
if (!isPullStart || isRefreshing || disabled) return;
|
||||||
|
|
||||||
if (!scrollEl) {
|
if (!scrollEl) {
|
||||||
|
@ -132,18 +130,16 @@ const moving = (e) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startScreenY === null) {
|
if (startScreenY === null) {
|
||||||
startScreenY = getScreenY(e);
|
startScreenY = getScreenY(event);
|
||||||
}
|
}
|
||||||
const moveScreenY = getScreenY(e);
|
const moveScreenY = getScreenY(event);
|
||||||
|
|
||||||
const moveHeight = moveScreenY - startScreenY!;
|
const moveHeight = moveScreenY - startScreenY!;
|
||||||
if (moveHeight < 0) {
|
if (moveHeight < 0) {
|
||||||
currentHeight = 0;
|
currentHeight = 0;
|
||||||
}
|
} else if (moveHeight >= maxFrameSize) {
|
||||||
else if (moveHeight >= maxFrameSize) {
|
|
||||||
currentHeight = maxFrameSize;
|
currentHeight = maxFrameSize;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currentHeight = moveHeight;
|
currentHeight = moveHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,12 +153,11 @@ onMounted(() => {
|
||||||
rootEl.addEventListener('pointerdown', moveStart);
|
rootEl.addEventListener('pointerdown', moveStart);
|
||||||
// ポインターの場合、ポップアップ系の動作をするとdownだけ発火されてupが発火されないため
|
// ポインターの場合、ポップアップ系の動作をするとdownだけ発火されてupが発火されないため
|
||||||
window.addEventListener('pointerup', moveEnd);
|
window.addEventListener('pointerup', moveEnd);
|
||||||
rootEl.addEventListener('pointermove', moving, {passive: true});
|
rootEl.addEventListener('pointermove', moving, { passive: true });
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
rootEl.addEventListener('touchstart', moveStart);
|
rootEl.addEventListener('touchstart', moveStart);
|
||||||
rootEl.addEventListener('touchend', moveEnd);
|
rootEl.addEventListener('touchend', moveEnd);
|
||||||
rootEl.addEventListener('touchmove', moving, {passive: true});
|
rootEl.addEventListener('touchmove', moving, { passive: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ export function reloadStream() {
|
||||||
stream.stream.reconnect();
|
stream.stream.reconnect();
|
||||||
timeoutHeadBeat = window.setTimeout(heartbeat, 1000 * 60);
|
timeoutHeadBeat = window.setTimeout(heartbeat, 1000 * 60);
|
||||||
|
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue