Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Fix mobile bottom sheet resizing and closing animation https://github.com/siyuan-note/siyuan/issues/19619

Danielca4677f9b31d
diff --git a/app/src/assets/scss/main/_mobile.scss b/app/src/assets/scss/main/_mobile.scss
index bc6a2edbcf..909641d23e 100644
--- a/app/src/assets/scss/main/_mobile.scss
+++ b/app/src/assets/scss/main/_mobile.scss
@@ -1722,6 +1722,8 @@ body.mobile-topbar--merged {
}
.mobile-bottom-sheet {
+ // 退出时保持可见,由位移动画将面板移出可视区域。
+ opacity: 1;
max-height: min(60vh, 100%);
border: 0;
border-radius: var(--b3-border-radius-b) var(--b3-border-radius-b) 0 0;
diff --git a/app/src/mobile/util/bindBottomSheetDialog.ts b/app/src/mobile/util/bindBottomSheetDialog.ts
index d26ffe3093..3e3f5c36cf 100644
--- a/app/src/mobile/util/bindBottomSheetDialog.ts
+++ b/app/src/mobile/util/bindBottomSheetDialog.ts
@@ -5,6 +5,11 @@ export const bindBottomSheetDialog = (dialog: Dialog, close: () => Promise<void>
dialog.element.classList.add("mobile-bottom-sheet-dialog");
const sheet = dialog.element.querySelector<HTMLElement>(".b3-dialog__container");
sheet.classList.add("mobile-bottom-sheet");
+ // 底部面板只支持下拉关闭,不参与通用对话框的移动和缩放。
+ sheet.querySelector(".b3-dialog__header")?.classList.remove("resize__move");
+ sheet.querySelectorAll(":scope > .resize__rd, :scope > .resize__ld, :scope > .resize__lt, :scope > .resize__rt, " +
+ ":scope > .resize__r, :scope > .resize__d, :scope > .resize__t, :scope > .resize__l")
+ .forEach(element => element.remove());
const handle = document.createElement("div");
// 抓手与菜单抽屉保持一致,由 b3-menu__title 的伪元素绘制
handle.className = "b3-menu__title b3-menu__title--root";
diff --git a/app/src/mobile/util/bindBottomSheetDrag.ts b/app/src/mobile/util/bindBottomSheetDrag.ts
index 249d4d9f84..7d982e3931 100644
--- a/app/src/mobile/util/bindBottomSheetDrag.ts
+++ b/app/src/mobile/util/bindBottomSheetDrag.ts
@@ -54,6 +54,9 @@ export const bindBottomSheetDrag = (element: HTMLElement, scrim: HTMLElement, cl
}
};
const onEnd = (event: TouchEvent) => {
+ if (closing) {
+ return;
+ }
if (!dragging || !start || !event.changedTouches.length) {
reset();
return;
@@ -62,6 +65,8 @@ export const bindBottomSheetDrag = (element: HTMLElement, scrim: HTMLElement, cl
const duration = Math.max(performance.now() - start.time, 1);
const shouldClose = offset > Math.min(120, element.clientHeight * .25) || (offset > 20 && offset / duration > .6);
suppressClickUntil = performance.now() + 300;
+ // 提交最后一次拖动位置,使关闭或回弹过渡从当前位移开始。
+ void element.offsetHeight;
element.style.transition = "";
start = undefined;
dragging = false;