Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
优化排行榜触底判断
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyJiangWJ committed Jun 27, 2019
1 parent c274ca0 commit 7cf7fe3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 0 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ var default_config = {
lock_y: 970,
// 设备高度 正常情况下device.height可以获取到
// deviceHeight: 2160,
// 好友排行榜 控件“没有更多了”的中心位置距离底部的高度,当虚拟按键不存在时值为62 当有虚拟按键时需要自行计算
// noMoreCenterHeight: 62
}
// 配置缓存的key值
const CONFIG_STORAGE_NAME = 'ant_forest_config_fork_version'
Expand Down
17 changes: 9 additions & 8 deletions core/Ant_forest.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,21 +765,22 @@ function Ant_forest(automator, unlock, config) {
*/
const foundNoMoreWidget = function (sleepTime) {
let sleep = sleepTime || _config.timeout_findOne

let height = _config.deviceHeight || device.height
height = height < 10 ? 1920 : height
let noMoreCenterHeight = _config.noMoreCenterHeight || 62
let noMoreWidgetCenterY = 0
let noMoreWidgetHeight = 0

let noMoreWidget = widgetGetOne('没有更多了', sleep)
if (noMoreWidget) {
noMoreWidgetCenterY = noMoreWidget.bounds().centerY()
let bounds = noMoreWidget.bounds()
commonFunctions.debug("找到控件: [" + bounds.left + ", " + bounds.top + ", " + bounds.right + ", " + bounds.bottom + "]")
noMoreWidgetHeight = bounds.bottom - bounds.top
}
// todo 该校验并不完美,当列表已经加载过之后,明明没有在视野中的控件,位置centerY还是能够获取到,而且非0
if (noMoreWidgetCenterY !== 0 && noMoreWidgetCenterY <= height - noMoreCenterHeight) {
commonFunctions.debug('"没有更多了" 当前centerY:' + noMoreWidgetCenterY)
if (noMoreWidgetHeight > 50) {
commonFunctions.debug('"没有更多了" 当前控件高度:' + noMoreWidgetHeight)
return true
} else {
if (noMoreWidgetHeight > 0) {
commonFunctions.debug('"没有更多了" 控件高度不符合要求' + noMoreWidgetHeight)
}
return false
}
}
Expand Down

0 comments on commit 7cf7fe3

Please sign in to comment.