Skip to content

Commit 0f61ac8

Browse files
fix(offscreen canvas): set negative position to move offscreen (#50)
re: #43
1 parent 7ed890c commit 0f61ac8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib/axes/canvas_text_bbox_calculator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export class CanvasTextBBoxCalculator implements BBoxCalculator {
99

1010
constructor(rootElement?: HTMLElement) {
1111
this.offscreenCanvas = document.createElement('canvas');
12+
this.offscreenCanvas.style.position = 'absolute';
13+
this.offscreenCanvas.style.top = '-9999px';
14+
1215
this.context = this.offscreenCanvas.getContext('2d');
1316
this.attachedRoot = rootElement || document.documentElement;
1417
this.attachedRoot.appendChild(this.offscreenCanvas);

0 commit comments

Comments
 (0)