diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts index 6d8dd9b1a..3a1d8f966 100644 --- a/app/src/mobile/index.ts +++ b/app/src/mobile/index.ts @@ -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; diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 3f77a9dc4..0ec40a44e 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -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) {