@@ -8,7 +8,6 @@ import {Region} from "./region.class";
8
8
import { timeout } from "./util/timeout.function" ;
9
9
import { Image } from "./image.class" ;
10
10
import { ProviderRegistry } from "./provider/provider-registry.class" ;
11
- import { loadImageResource } from "./imageResources.function" ;
12
11
import { FirstArgumentType } from "./typings" ;
13
12
import { Point } from "./point.class" ;
14
13
@@ -97,20 +96,15 @@ export class ScreenClass {
97
96
* @param params {@link LocationParameters } which are used to fine tune search region and / or match confidence
98
97
*/
99
98
public async find (
100
- templateImage : string | Image | Promise < Image > ,
99
+ templateImage : Image | Promise < Image > ,
101
100
params ?: LocationParameters ,
102
101
) : Promise < Region > {
103
102
const minMatch = ( params && params . confidence ) || this . config . confidence ;
104
103
const screenSize = await this . providerRegistry . getScreen ( ) . screenSize ( ) ;
105
104
const searchRegion = ( params && params . searchRegion ) || screenSize ;
106
105
const searchMultipleScales = ( params && params . searchMultipleScales )
107
106
108
- let needle : Image ;
109
- if ( typeof templateImage === "string" ) {
110
- needle = await loadImageResource ( this . providerRegistry , this . config . resourceDirectory , templateImage ) ;
111
- } else {
112
- needle = await templateImage ;
113
- }
107
+ const needle = await templateImage ;
114
108
115
109
const screenImage = await this . providerRegistry . getScreen ( ) . grabScreenRegion ( searchRegion ) ;
116
110
@@ -154,20 +148,15 @@ export class ScreenClass {
154
148
* @param params {@link LocationParameters } which are used to fine tune search region and / or match confidence
155
149
*/
156
150
public async findAll (
157
- templateImage : string | Image | Promise < Image > ,
151
+ templateImage : Image | Promise < Image > ,
158
152
params ?: LocationParameters ,
159
153
) : Promise < Region [ ] > {
160
154
const minMatch = ( params && params . confidence ) || this . config . confidence ;
161
155
const screenSize = await this . providerRegistry . getScreen ( ) . screenSize ( ) ;
162
156
const searchRegion = ( params && params . searchRegion ) || screenSize ;
163
157
const searchMultipleScales = ( params && params . searchMultipleScales )
164
158
165
- let needle : Image ;
166
- if ( typeof templateImage === "string" ) {
167
- needle = await loadImageResource ( this . providerRegistry , this . config . resourceDirectory , templateImage ) ;
168
- } else {
169
- needle = await templateImage ;
170
- }
159
+ const needle = await templateImage ;
171
160
172
161
const screenImage = await this . providerRegistry . getScreen ( ) . grabScreenRegion ( searchRegion ) ;
173
162
0 commit comments