Skip to content

Commit

Permalink
fix(offscreen canvas): set negative position to move offscreen (#50)
Browse files Browse the repository at this point in the history
re: #43
  • Loading branch information
emmacunningham authored Feb 8, 2019
1 parent 7ed890c commit 0f61ac8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/axes/canvas_text_bbox_calculator.ts
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 0f61ac8

Please sign in to comment.