Skip to content

Commit 09eff66

Browse files
committed
fix: revert rounding changes
1 parent ebf07f1 commit 09eff66

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/browser/client-scripts/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ function prepareScreenshotUnsafe(areas, opts) {
350350
logger("prepareScreenshotUnsafe, pixelRatio:", pixelRatio);
351351

352352
return {
353-
captureArea: rect.scale(pixelRatio).round().serialize(),
353+
captureArea: rect.scale(pixelRatio).serialize(),
354354
ignoreAreas: ignoreAreas,
355355
viewport: new Rect({
356356
left: util.getScrollLeft(scrollElem),
@@ -734,7 +734,7 @@ function getCaptureRect(captureElements, opts, logger) {
734734
}
735735
}
736736

737-
return rect;
737+
return rect ? rect.round() : rect;
738738
}
739739

740740
function configurePixelRatio(usePixelRatio) {
@@ -772,7 +772,7 @@ function addIgnoreArea(element, opts, logger) {
772772
return;
773773
}
774774

775-
var ignoreArea = rect.scale(opts.pixelRatio).round().serialize();
775+
var ignoreArea = rect.round().scale(opts.pixelRatio).serialize();
776776

777777
this.push(ignoreArea);
778778
}

src/browser/client-scripts/rect.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ Rect.prototype = {
7979

8080
round: function () {
8181
return new Rect({
82-
top: Math.round(this.top),
83-
left: Math.round(this.left),
84-
bottom: Math.round(this.top + this.height),
85-
right: Math.round(this.left + this.width)
82+
top: Math.floor(this.top),
83+
left: Math.floor(this.left),
84+
right: Math.ceil(this.right),
85+
bottom: Math.ceil(this.bottom)
8686
});
8787
},
8888

0 commit comments

Comments
 (0)