File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -101,17 +101,17 @@ export class Screen {
101
101
102
102
return new Promise < Region > ( async ( resolve , reject ) => {
103
103
try {
104
- if ( region . left < 0 || region . top < 0 || region . width < 0 || region . height < 0 ) {
105
- throw new Error ( `Negative values in search region ${ region } ` )
104
+ if ( searchRegion . left < 0 || searchRegion . top < 0 || searchRegion . width < 0 || searchRegion . height < 0 ) {
105
+ throw new Error ( `Negative values in search region ${ searchRegion } ` )
106
106
}
107
- if ( isNaN ( region . left ) || isNaN ( region . top ) || isNaN ( region . width ) || isNaN ( region . height ) ) {
108
- throw new Error ( `NaN values in search region ${ region } ` )
107
+ if ( isNaN ( searchRegion . left ) || isNaN ( searchRegion . top ) || isNaN ( searchRegion . width ) || isNaN ( searchRegion . height ) ) {
108
+ throw new Error ( `NaN values in search region ${ searchRegion } ` )
109
109
}
110
- if ( region . width < 2 || region . height < 2 ) {
111
- throw new Error ( `Search region ${ region } is not large enough. Must be at least two pixels in both width and height.` )
110
+ if ( searchRegion . width < 2 || searchRegion . height < 2 ) {
111
+ throw new Error ( `Search region ${ searchRegion } is not large enough. Must be at least two pixels in both width and height.` )
112
112
}
113
- if ( region . left + region . width > screenSize . width || region . top + region . height > screenSize . height ) {
114
- throw new Error ( `Search region ${ region } extends beyond screen boundaries (${ screenSize . width } x${ screenSize . height } )` )
113
+ if ( searchRegion . left + searchRegion . width > screenSize . width || searchRegion . top + searchRegion . height > screenSize . height ) {
114
+ throw new Error ( `Search region ${ searchRegion } extends beyond screen boundaries (${ screenSize . width } x${ screenSize . height } )` )
115
115
}
116
116
const matchResult = await this . vision . findOnScreenRegion ( matchRequest ) ;
117
117
if ( matchResult . confidence >= minMatch ) {
You can’t perform that action at this time.
0 commit comments