Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / getMatchBounds

Function: getMatchBounds()

getMatchBounds(match): object

Defined in: botjs/src/image-match.ts:406

Get the bounding rectangle of a match result

Parameters

match

MatchResult

MatchResult to get bounds for

Returns

object

Object with left, top, right, bottom coordinates

left

left: number

top

top: number

right: number

bottom

bottom: number

Example

typescript
import { imageResource, findOnScreen, getMatchBounds } from "@tego/botjs";

const match = await findOnScreen(template);
if (match) {
  const bounds = getMatchBounds(match);
  console.log(`Match bounds: (${bounds.left}, ${bounds.top}) to (${bounds.right}, ${bounds.bottom})`);
}

Released under the MIT License.