Skip to content

Commit

Permalink
Add support for fractional width and height values (ctrl-freaks#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsunee authored May 17, 2021
1 parent 04c97e5 commit ee166f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/freezeframe/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ class Freezeframe {
private _process(freeze: Freeze): Promise<Freeze> {
return new Promise((resolve) => {
const { $canvas, $image, $container } = freeze;
const { clientWidth, clientHeight } = $image;
const { width, height } = $image.getClientRects()[0];
const clientWidth = Math.ceil(width);
const clientHeight = Math.ceil(height);

$canvas.style.width = `${width}px`;
$canvas.style.height = `${height}px`;
$canvas.setAttribute('width', clientWidth.toString());
$canvas.setAttribute('height', clientHeight.toString());

Expand Down

0 comments on commit ee166f7

Please sign in to comment.