mirror of
https://gitee.com/openharmony/applications_screenlock
synced 2024-11-27 00:21:03 +00:00
!49 修复ScreenLock收到消息通知后过于频繁刷新UI组件的问题
Merge pull request !49 from yangpeng85/master
This commit is contained in:
commit
81eb43c2c1
@ -82,8 +82,14 @@ export default struct GroupItem {
|
||||
.scrollable(ScrollDirection.Horizontal)
|
||||
.scrollBar(BarState.On)
|
||||
.onScroll(() => {
|
||||
this.mIconAlpha += 0.1;
|
||||
this.mIconAlpha = this.mScroller.currentOffset().xOffset * 1.0 / getIconListSize();
|
||||
let accuracy = 0.1
|
||||
let newOpacity = this.mScroller.currentOffset().xOffset * 1.0 / getIconListSize()
|
||||
let diffs = Math.abs(this.mIconAlpha - newOpacity)
|
||||
if (diffs >= accuracy) {
|
||||
let finalAlpha = newOpacity < accuracy ? 0 : newOpacity
|
||||
finalAlpha = finalAlpha > (1 - accuracy) ? 1 : finalAlpha
|
||||
this.mIconAlpha = finalAlpha
|
||||
}
|
||||
})
|
||||
.onScrollEnd(() => {
|
||||
this.mEdgeEnd = (this.mEdgeEnd &&
|
||||
|
@ -47,8 +47,14 @@ export default struct NotificationItem {
|
||||
.scrollable(ScrollDirection.Horizontal)
|
||||
.scrollBar(BarState.On)
|
||||
.onScroll(() => {
|
||||
this.mIconAlpha += 0.1;
|
||||
this.mIconAlpha = this.mScroller.currentOffset().xOffset * 1.0 / getIconListSize();
|
||||
let accuracy = 0.1
|
||||
let newOpacity = this.mScroller.currentOffset().xOffset * 1.0 / getIconListSize()
|
||||
let diffs = Math.abs(this.mIconAlpha - newOpacity)
|
||||
if (diffs >= accuracy) {
|
||||
let finalAlpha = newOpacity < accuracy ? 0 : newOpacity
|
||||
finalAlpha = finalAlpha > (1 - accuracy) ? 1 : finalAlpha
|
||||
this.mIconAlpha = finalAlpha
|
||||
}
|
||||
})
|
||||
.onScrollEnd(() => {
|
||||
this.mEdgeEnd = (this.mEdgeEnd &&
|
||||
|
Loading…
Reference in New Issue
Block a user