chore: standardize project comments in English
This commit is contained in:
1 parent
a874a39ea5
commit
ccb16acbea
167 files changed
+820
-820
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// 软键盘弹出时,iOS Safari 与新版 Android Chrome 只缩小可视区域、页面高度不变,
|
||||
// 编辑器底部(光标、键盘上方的工具条)会被键盘挡住。把应用高度设为可视区域的高度。
|
||||
// 双指缩放也会改变可视区域,缩放时不调整
|
||||
// When software keyboards open, iOS Safari and recent Android Chrome shrink the visual viewport without changing page height,
|
||||
// covering the editor bottom, cursor, and toolbar. Set application height to the visual viewport height.
|
||||
// Pinch zoom also changes the visual viewport; do not resize while zooming.
|
||||
export function trackVisualViewport(onShrink: () => void) {
|
||||
const vv = window.visualViewport
|
||||
if (!vv) return
|
||||
@@ -8,7 +8,7 @@ export function trackVisualViewport(onShrink: () => void) {
|
||||
const update = () => {
|
||||
const height = vv.scale > 1.01 ? null : vv.height
|
||||
document.documentElement.style.setProperty('--rm-app-height', height === null ? '100%' : `${height}px`)
|
||||
// iOS 会把页面整体上推以露出输入位置,应用高度已经适配,推回原位
|
||||
// iOS shifts the page to reveal the input; application height already accounts for the keyboard, so restore its position.
|
||||
if (height !== null && vv.offsetTop > 0) window.scrollTo(0, 0)
|
||||
if (height !== null && height < last) requestAnimationFrame(onShrink)
|
||||
last = vv.height
|
||||
|
||||
Reference in new issue
Block a user