UNPKG

playwright-fluent

Version:
21 lines (20 loc) 928 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isHandleMoving = void 0; const get_client_rectangle_of_handle_1 = require("../get-client-rectangle-of-handle"); const utils_1 = require("../../../utils"); async function isHandleMoving(selector) { if (!selector) { return false; } const previousClientRectangle = await (0, get_client_rectangle_of_handle_1.getClientRectangleOfHandle)(selector); await (0, utils_1.sleep)(50); const currentClientRectangle = await (0, get_client_rectangle_of_handle_1.getClientRectangleOfHandle)(selector); if (previousClientRectangle === null || currentClientRectangle === null) { return false; } const threshold = 5; const distance = (0, utils_1.getDistanceBetweenClientRectangles)(currentClientRectangle, previousClientRectangle); return distance >= threshold; } exports.isHandleMoving = isHandleMoving;