MCPcopy Create free account
hub / github.com/xerrors/Yuxi / handleScroll

Method handleScroll

web/src/utils/scrollController.js:48–69  ·  view source on GitHub ↗

* 处理滚动事件

()

Source from the content-addressed store, hash-verified

46 * 处理滚动事件
47 */
48 handleScroll() {
49 if (this.scrollTimer) {
50 clearTimeout(this.scrollTimer)
51 }
52
53 // 如果是程序性滚动,忽略此次事件
54 if (this.isProgrammaticScroll) {
55 this.isProgrammaticScroll = false
56 return
57 }
58
59 // 标记用户正在滚动
60 this.isUserScrolling = true
61
62 // 检查是否在底部
63 this.shouldAutoScroll = this.isAtBottom()
64
65 // 滚动结束后一段时间重置用户滚动状态
66 this.scrollTimer = setTimeout(() => {
67 this.isUserScrolling = false
68 }, this.options.scrollDelay)
69 }
70
71 /**
72 * 等待 DOM 布局稳定

Callers

nothing calls this directly

Calls 1

isAtBottomMethod · 0.95

Tested by

no test coverage detected