Skip to content

Commit

Permalink
Leave it float
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Oct 11, 2023
1 parent 369d8b4 commit 9c3e5b3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/commands/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
};
Expand All @@ -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),
};
},

/**
Expand Down

0 comments on commit 9c3e5b3

Please sign in to comment.