Skip to content

Commit e22c5dc

Browse files
committed
[Editor] Avoid to have slightly truncated images because of non-integer canvas dimensions
1 parent f89020e commit e22c5dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/display/editor/stamp.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ class StampEditor extends AnnotationEditor {
252252
width *= factor;
253253
height *= factor;
254254
}
255+
width = Math.ceil(width);
256+
height = Math.ceil(height);
255257
const [parentWidth, parentHeight] = this.parentDimensions;
256258
this.setDims(
257259
(width * parentWidth) / pageWidth,
@@ -288,7 +290,7 @@ class StampEditor extends AnnotationEditor {
288290
const TIME_TO_WAIT = 200;
289291
this.#resizeTimeoutId = setTimeout(() => {
290292
this.#resizeTimeoutId = null;
291-
this.#drawBitmap(width, height);
293+
this.#drawBitmap(Math.ceil(width), Math.ceil(height));
292294
}, TIME_TO_WAIT);
293295
}
294296

0 commit comments

Comments
 (0)