mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-07 16:04:19 +01:00
This commit is contained in:
parent
48cacbc5dc
commit
3ed6dec0af
2 changed files with 44 additions and 40 deletions
|
|
@ -121,12 +121,12 @@ class App {
|
|||
window.siyuan.mobile.size.landscape = {
|
||||
height1: window.innerHeight,
|
||||
height2: window.innerHeight,
|
||||
}
|
||||
};
|
||||
} else {
|
||||
window.siyuan.mobile.size.portrait = {
|
||||
height1: window.innerHeight,
|
||||
height2: window.innerHeight,
|
||||
}
|
||||
};
|
||||
}
|
||||
window.addEventListener("resize", () => {
|
||||
// 获取键盘高度
|
||||
|
|
@ -136,7 +136,7 @@ class App {
|
|||
window.siyuan.mobile.size.landscape = {
|
||||
height1: window.innerHeight,
|
||||
height2: window.innerHeight,
|
||||
}
|
||||
};
|
||||
}
|
||||
if (window.innerHeight < window.siyuan.mobile.size.landscape.height1) {
|
||||
window.siyuan.mobile.size.landscape.height2 = window.innerHeight;
|
||||
|
|
@ -149,7 +149,7 @@ class App {
|
|||
window.siyuan.mobile.size.portrait = {
|
||||
height1: window.innerHeight,
|
||||
height2: window.innerHeight,
|
||||
}
|
||||
};
|
||||
}
|
||||
if (window.innerHeight < window.siyuan.mobile.size.portrait.height1) {
|
||||
window.siyuan.mobile.size.portrait.height2 = window.innerHeight;
|
||||
|
|
|
|||
|
|
@ -232,48 +232,52 @@ export const handleTouchMove = (event: TouchEvent) => {
|
|||
if (hasClosestByAttribute(target, "id", "model", true)) {
|
||||
return;
|
||||
}
|
||||
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeAttributeView") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeMathBlock") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeTable") ||
|
||||
hasTopClosestByClassName(target, "list") ||
|
||||
hasTopClosestByClassName(target, "protyle-breadcrumb__bar--nowrap");
|
||||
if (scrollElement) {
|
||||
if (scrollElement.classList.contains("table")) {
|
||||
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
||||
} else if (scrollElement.classList.contains("code-block")) {
|
||||
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
||||
} else if (scrollElement.classList.contains("av")) {
|
||||
scrollElement = hasClosestByClassName(target, "layout-tab-bar") || hasClosestByClassName(target, "av__scroll") ||
|
||||
hasClosestByClassName(target, "av__kanban");
|
||||
} else if (scrollElement.dataset.type === "NodeMathBlock") {
|
||||
scrollElement = target;
|
||||
while (scrollElement && scrollElement.dataset.type !== "NodeMathBlock") {
|
||||
if (scrollElement.nodeType === 1 && scrollElement.scrollLeft > 0) {
|
||||
break;
|
||||
if (sideMaskElement.classList.contains("fn__none")) {
|
||||
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeAttributeView") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeMathBlock") ||
|
||||
hasClosestByAttribute(target, "data-type", "NodeTable") ||
|
||||
hasTopClosestByClassName(target, "list") ||
|
||||
hasTopClosestByClassName(target, "protyle-breadcrumb__bar--nowrap");
|
||||
if (scrollElement) {
|
||||
if (scrollElement.classList.contains("table")) {
|
||||
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
||||
} else if (scrollElement.classList.contains("code-block")) {
|
||||
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
||||
} else if (scrollElement.classList.contains("av")) {
|
||||
scrollElement = hasClosestByClassName(target, "layout-tab-bar") || hasClosestByClassName(target, "av__scroll") ||
|
||||
hasClosestByClassName(target, "av__kanban");
|
||||
} else if (scrollElement.dataset.type === "NodeMathBlock") {
|
||||
scrollElement = target;
|
||||
while (scrollElement && scrollElement.dataset.type !== "NodeMathBlock") {
|
||||
if (scrollElement.nodeType === 1 && scrollElement.scrollWidth > scrollElement.clientWidth) {
|
||||
if (scrollElement.parentElement.scrollWidth === scrollElement.parentElement.clientWidth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
scrollElement = scrollElement.parentElement;
|
||||
}
|
||||
scrollElement = scrollElement.parentElement;
|
||||
}
|
||||
}
|
||||
let noScroll = false;
|
||||
if (scrollElement && scrollElement.scrollLeft === 0) {
|
||||
scrollElement.scrollLeft = 1;
|
||||
if (scrollElement.scrollLeft === 0) {
|
||||
noScroll = true;
|
||||
let noScroll = false;
|
||||
if (scrollElement && scrollElement.scrollLeft === 0) {
|
||||
scrollElement.scrollLeft = 1;
|
||||
if (scrollElement.scrollLeft === 0) {
|
||||
noScroll = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!noScroll) {
|
||||
if (scrollElement && (
|
||||
(xDiff < 0 && scrollElement.scrollLeft > 0) ||
|
||||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)
|
||||
)) {
|
||||
scrollBlock = true;
|
||||
if (!noScroll) {
|
||||
if (scrollElement && (
|
||||
(xDiff < 0 && scrollElement.scrollLeft > 1) ||
|
||||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)
|
||||
)) {
|
||||
scrollBlock = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (scrollBlock || event.touches.length > 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (scrollBlock) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFirstMove) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue