UNPKG

askui

Version:

Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on

26 lines (25 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DetectedElement = void 0; const boundary_box_1 = require("./boundary-box"); /** * * @param {string} name - The element type e.g text, button * @param {string} text - The detected text inside the element * @param {BoundingBox} bndbox - The element bounding box * @param {string[]} colors - An optional, the element top 3 dominate colors * */ class DetectedElement { constructor(name, text, bndbox, colors, similarityScore) { this.name = name; this.text = text; this.bndbox = bndbox; this.colors = colors; this.similarityScore = similarityScore; } static fromJson(detectedElement, resizeRatio = 1) { return new DetectedElement(detectedElement.name, detectedElement.text, boundary_box_1.BoundingBox.fromJson(detectedElement.bndbox, resizeRatio), detectedElement.colors || undefined, detectedElement.similarityScore || 0); } } exports.DetectedElement = DetectedElement;