fix: 🐛 fix scrolling bugs
This commit is contained in:
parent
1886193b8e
commit
a82149c05d
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.118.1-calc.11.6",
|
"version": "12.118.1-calc.12",
|
||||||
"codename": "aqua",
|
"codename": "aqua",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -248,9 +248,9 @@ if (isMobile.value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTouchMove(evt) {
|
function handleTouchMove(evt) {
|
||||||
if (!xDown || !yDown) {
|
if (!xDown || !yDown) return;
|
||||||
return;
|
|
||||||
}
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(evt.target.tagName) || evt.target.attributes['contenteditable']) return;
|
||||||
|
|
||||||
let xUp = evt.touches[0].clientX;
|
let xUp = evt.touches[0].clientX;
|
||||||
let yUp = evt.touches[0].clientY;
|
let yUp = evt.touches[0].clientY;
|
||||||
|
@ -274,7 +274,7 @@ if (isMobile.value) {
|
||||||
timelines.push('global');
|
timelines.push('global');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
if (Math.abs(xDiff) > Math.abs(yDiff) && Math.abs(xDiff) > 100) {
|
||||||
if (xDiff < 0) {
|
if (xDiff < 0) {
|
||||||
if (src === 'home') {
|
if (src === 'home') {
|
||||||
next = 'global';
|
next = 'global';
|
||||||
|
|
|
@ -140,9 +140,28 @@ onMounted(() => {
|
||||||
|
|
||||||
window.addEventListener('scroll', () => {
|
window.addEventListener('scroll', () => {
|
||||||
let windowY = window.scrollY;
|
let windowY = window.scrollY;
|
||||||
postButton.style.transform = `scale(${windowY < scrollPos ? '1' : '0'})`;
|
postButton.style.transform = `scale(${windowY < scrollPos ? '1' : '0.3'})`;
|
||||||
scrollPos = windowY;
|
scrollPos = windowY;
|
||||||
}, { passive: true });
|
}, { passive: true });
|
||||||
|
|
||||||
|
function createScrollStopListener(element: Window, callback: TimerHandler, timeout: number): () => void {
|
||||||
|
let handle = 0;
|
||||||
|
const onScroll = () => {
|
||||||
|
if (handle) {
|
||||||
|
clearTimeout(handle);
|
||||||
|
}
|
||||||
|
postButton.style.transform = 'scale(0.3)';
|
||||||
|
handle = setTimeout(callback, timeout || 200);
|
||||||
|
};
|
||||||
|
element.addEventListener('scroll', onScroll, { passive: true });
|
||||||
|
return () => {
|
||||||
|
element.removeEventListener('scroll', onScroll);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
createScrollStopListener(window, () => {
|
||||||
|
postButton.style.transform = 'scale(1)';
|
||||||
|
} , 200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue