Skip to content

Commit

Permalink
Adding Floor & Ceil to shifter variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit3200 committed Nov 21, 2023
1 parent b79c1a0 commit 0bfaad1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/webdriver-utils/src/providers/genericProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export default class GenericProvider {
headerAdjustment = this.statusBarHeight;
}
const coOrdinates = {
top: Math.floor(element.y * scaleFactor) + headerAdjustment,
bottom: Math.ceil((element.y + element.height) * scaleFactor) + headerAdjustment,
top: Math.floor(element.y * scaleFactor) + Math.floor(headerAdjustment),
bottom: Math.ceil((element.y + element.height) * scaleFactor) + Math.ceil(headerAdjustment),
left: Math.floor(element.x * scaleFactor),
right: Math.ceil((element.x + element.width) * scaleFactor)
};
Expand Down Expand Up @@ -273,10 +273,10 @@ export default class GenericProvider {
// Subtracting ScrollY/ScrollX ensures if the element is visible in viewport or not.
await this.updatePageShiftFactor(location, scaleFactor);
const coOrdinates = {
top: Math.floor(location.y * scaleFactor) + this.pageYShiftFactor,
bottom: Math.ceil((location.y + size.height) * scaleFactor) + this.pageYShiftFactor,
left: Math.floor(location.x * scaleFactor) + this.pageXShiftFactor,
right: Math.ceil((location.x + size.width) * scaleFactor) + this.pageXShiftFactor
top: Math.floor(location.y * scaleFactor) + Math.floor(this.pageYShiftFactor),
bottom: Math.ceil((location.y + size.height) * scaleFactor) + Math.ceil(this.pageYShiftFactor),
left: Math.floor(location.x * scaleFactor) + Math.floor(this.pageXShiftFactor),
right: Math.ceil((location.x + size.width) * scaleFactor) + Math.ceil(this.pageXShiftFactor)
};

const jsonObject = {
Expand Down

0 comments on commit 0bfaad1

Please sign in to comment.