Skip to content

Commit

Permalink
fix: 设备高度并非完全正确,并且被错误使用 #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebartin committed Mar 9, 2023
1 parent 7f2389e commit dd0e2ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions NIKKE/NIKKEutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,13 @@ function 刷刷刷() {
sleep(2000);
return null;
}
return res.find(e => e.text.includes('点击'));
return res.find(e => e.text.includes(''));
}, 50, 1000);
let hasBlue = images.findColor(captureScreen(), '#00a1ff', {
let img = captureScreen();
let hasBlue = images.findColor(img, '#00a1ff', {
region: [
0, clickNext.bounds.bottom,
clickNext.bounds.right, height - clickNext.bounds.bottom
clickNext.bounds.right, img.height - clickNext.bounds.bottom
],
threshold: 20
});
Expand Down
11 changes: 8 additions & 3 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ function getOcrRes() {
toast('识别完成,可以退出查看日志');
}

function getDisplaySize() {
let metrics = context.getResources().getDisplayMetrics();
return [metrics.widthPixels, metrics.heightPixels];
function getDisplaySize(doNotForcePortrait) {
let { width, height } = device;
if (doNotForcePortrait)
return [width, height]
return [
Math.min(width, height),
Math.max(width, height)
];
}

function ocrUntilFound(found, retry, interval) {
Expand Down

0 comments on commit dd0e2ff

Please sign in to comment.