Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
fix: Canvas breaks styles if picture is big enough
Browse files Browse the repository at this point in the history
  • Loading branch information
ribizli committed Nov 14, 2016
1 parent 976f9c9 commit 4e1b420
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ const resizeAreaId = 'imageupload-resize-area';
function getResizeArea() {
let resizeArea = document.getElementById(resizeAreaId);
if (!resizeArea) {
let wrap = document.createElement('div');
resizeArea = document.createElement('canvas');
wrap.appendChild(resizeArea);
wrap.id = 'wrap-' + resizeAreaId;
wrap.style.position = 'relative';
wrap.style.overflow = 'hidden';
wrap.style.width = '0';
wrap.style.height = '0';
resizeArea.id = resizeAreaId;
resizeArea.style.visibility = 'hidden';
resizeArea.style.position = 'absolute';
resizeArea.style.transform = 'translate(-1000px, 0)';
document.body.appendChild(resizeArea);
document.body.appendChild(wrap);
}

return <HTMLCanvasElement>resizeArea;
Expand Down

0 comments on commit 4e1b420

Please sign in to comment.