UNPKG

playwright-fluent

Version:
13 lines (12 loc) 551 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDistanceBetweenClientRectangles = void 0; function getDistanceBetweenClientRectangles(rect1, rect2) { const x1 = rect1.left + rect1.width / 2; const y1 = rect1.top + rect1.height / 2; const x2 = rect2.left + rect2.width / 2; const y2 = rect2.top + rect2.height / 2; const distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); return distance; } exports.getDistanceBetweenClientRectangles = getDistanceBetweenClientRectangles;