Skip to content

Commit

Permalink
fix(offscreen canvas): set negative position to move offscreen (opens…
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacunningham authored Feb 8, 2019
1 parent a6a608e commit 0e676a2
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class CanvasTextBBoxCalculator implements BBoxCalculator {

constructor(rootElement?: HTMLElement) {
this.offscreenCanvas = document.createElement('canvas');
this.offscreenCanvas.style.position = 'absolute';
this.offscreenCanvas.style.top = '-9999px';

this.context = this.offscreenCanvas.getContext('2d');
this.attachedRoot = rootElement || document.documentElement;
this.attachedRoot.appendChild(this.offscreenCanvas);
Expand Down

0 comments on commit 0e676a2

Please sign in to comment.