From 9c3e5b3e1b39992b9b66dd4140aa6936f3247f1e Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Wed, 11 Oct 2023 18:19:57 +0200 Subject: [PATCH] Leave it float --- lib/commands/web.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/commands/web.js b/lib/commands/web.js index 221953ac6..0477c19e6 100644 --- a/lib/commands/web.js +++ b/lib/commands/web.js @@ -667,8 +667,8 @@ const extensions = { const shouldApplyPixelRatio = wvDims.innerWidth > wvDims.outerWidth || wvDims.innerHeight > wvDims.outerHeight; return { - x: Math.round(offsetX + x * (shouldApplyPixelRatio ? pixelRatioX : 1)), - y: Math.round(offsetY + y * (shouldApplyPixelRatio ? pixelRatioY : 1)), + x: offsetX + x * (shouldApplyPixelRatio ? pixelRatioX : 1), + y: offsetY + y * (shouldApplyPixelRatio ? pixelRatioY : 1), }; } else { this.log.debug( @@ -916,8 +916,8 @@ const extensions = { const pixelRatioX = CALIBRATION_TAP_DELTA * 2 / (x1 - x0); const pixelRatioY = CALIBRATION_TAP_DELTA * 2 / (y1 - y0); this.webviewCalibrationResult = { - offsetX: Math.round(centerX - CALIBRATION_TAP_DELTA - x0 * pixelRatioX), - offsetY: Math.round(centerY - CALIBRATION_TAP_DELTA - y0 * pixelRatioY), + offsetX: centerX - CALIBRATION_TAP_DELTA - x0 * pixelRatioX, + offsetY: centerY - CALIBRATION_TAP_DELTA - y0 * pixelRatioY, pixelRatioX, pixelRatioY, }; @@ -928,8 +928,14 @@ const extensions = { // restore the previous url await this.setUrl(currentUrl); } - // @ts-ignore it is always defined here - return this.webviewCalibrationResult; + /** @type {import('../types').CalibrationData} */ + // @ts-ignore this.webviewCalibrationResult is always defined here + const result = this.webviewCalibrationResult; + return { + ...result, + offsetX: Math.round(result.offsetX), + offsetY: Math.round(result.offsetY), + }; }, /**