mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +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 = {
|
window.siyuan.mobile.size.landscape = {
|
||||||
height1: window.innerHeight,
|
height1: window.innerHeight,
|
||||||
height2: window.innerHeight,
|
height2: window.innerHeight,
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
window.siyuan.mobile.size.portrait = {
|
window.siyuan.mobile.size.portrait = {
|
||||||
height1: window.innerHeight,
|
height1: window.innerHeight,
|
||||||
height2: window.innerHeight,
|
height2: window.innerHeight,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
// 获取键盘高度
|
// 获取键盘高度
|
||||||
|
|
@ -136,7 +136,7 @@ class App {
|
||||||
window.siyuan.mobile.size.landscape = {
|
window.siyuan.mobile.size.landscape = {
|
||||||
height1: window.innerHeight,
|
height1: window.innerHeight,
|
||||||
height2: window.innerHeight,
|
height2: window.innerHeight,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
if (window.innerHeight < window.siyuan.mobile.size.landscape.height1) {
|
if (window.innerHeight < window.siyuan.mobile.size.landscape.height1) {
|
||||||
window.siyuan.mobile.size.landscape.height2 = window.innerHeight;
|
window.siyuan.mobile.size.landscape.height2 = window.innerHeight;
|
||||||
|
|
@ -149,7 +149,7 @@ class App {
|
||||||
window.siyuan.mobile.size.portrait = {
|
window.siyuan.mobile.size.portrait = {
|
||||||
height1: window.innerHeight,
|
height1: window.innerHeight,
|
||||||
height2: window.innerHeight,
|
height2: window.innerHeight,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
if (window.innerHeight < window.siyuan.mobile.size.portrait.height1) {
|
if (window.innerHeight < window.siyuan.mobile.size.portrait.height1) {
|
||||||
window.siyuan.mobile.size.portrait.height2 = window.innerHeight;
|
window.siyuan.mobile.size.portrait.height2 = window.innerHeight;
|
||||||
|
|
|
||||||
|
|
@ -232,48 +232,52 @@ export const handleTouchMove = (event: TouchEvent) => {
|
||||||
if (hasClosestByAttribute(target, "id", "model", true)) {
|
if (hasClosestByAttribute(target, "id", "model", true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") ||
|
if (sideMaskElement.classList.contains("fn__none")) {
|
||||||
hasClosestByAttribute(target, "data-type", "NodeAttributeView") ||
|
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") ||
|
||||||
hasClosestByAttribute(target, "data-type", "NodeMathBlock") ||
|
hasClosestByAttribute(target, "data-type", "NodeAttributeView") ||
|
||||||
hasClosestByAttribute(target, "data-type", "NodeTable") ||
|
hasClosestByAttribute(target, "data-type", "NodeMathBlock") ||
|
||||||
hasTopClosestByClassName(target, "list") ||
|
hasClosestByAttribute(target, "data-type", "NodeTable") ||
|
||||||
hasTopClosestByClassName(target, "protyle-breadcrumb__bar--nowrap");
|
hasTopClosestByClassName(target, "list") ||
|
||||||
if (scrollElement) {
|
hasTopClosestByClassName(target, "protyle-breadcrumb__bar--nowrap");
|
||||||
if (scrollElement.classList.contains("table")) {
|
if (scrollElement) {
|
||||||
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
if (scrollElement.classList.contains("table")) {
|
||||||
} else if (scrollElement.classList.contains("code-block")) {
|
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
||||||
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
} else if (scrollElement.classList.contains("code-block")) {
|
||||||
} else if (scrollElement.classList.contains("av")) {
|
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
||||||
scrollElement = hasClosestByClassName(target, "layout-tab-bar") || hasClosestByClassName(target, "av__scroll") ||
|
} else if (scrollElement.classList.contains("av")) {
|
||||||
hasClosestByClassName(target, "av__kanban");
|
scrollElement = hasClosestByClassName(target, "layout-tab-bar") || hasClosestByClassName(target, "av__scroll") ||
|
||||||
} else if (scrollElement.dataset.type === "NodeMathBlock") {
|
hasClosestByClassName(target, "av__kanban");
|
||||||
scrollElement = target;
|
} else if (scrollElement.dataset.type === "NodeMathBlock") {
|
||||||
while (scrollElement && scrollElement.dataset.type !== "NodeMathBlock") {
|
scrollElement = target;
|
||||||
if (scrollElement.nodeType === 1 && scrollElement.scrollLeft > 0) {
|
while (scrollElement && scrollElement.dataset.type !== "NodeMathBlock") {
|
||||||
break;
|
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;
|
||||||
let noScroll = false;
|
if (scrollElement && scrollElement.scrollLeft === 0) {
|
||||||
if (scrollElement && scrollElement.scrollLeft === 0) {
|
scrollElement.scrollLeft = 1;
|
||||||
scrollElement.scrollLeft = 1;
|
if (scrollElement.scrollLeft === 0) {
|
||||||
if (scrollElement.scrollLeft === 0) {
|
noScroll = true;
|
||||||
noScroll = true;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!noScroll) {
|
||||||
if (!noScroll) {
|
if (scrollElement && (
|
||||||
if (scrollElement && (
|
(xDiff < 0 && scrollElement.scrollLeft > 1) ||
|
||||||
(xDiff < 0 && scrollElement.scrollLeft > 0) ||
|
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)
|
||||||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)
|
)) {
|
||||||
)) {
|
scrollBlock = true;
|
||||||
scrollBlock = true;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scrollBlock || event.touches.length > 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scrollBlock) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFirstMove) {
|
if (isFirstMove) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue