Skip to content

Commit d646095

Browse files
committed
Fix problem creating SVG renderer in normal browser
1 parent cfefb05 commit d646095

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/base/base3d.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ function createSVGRenderer(as_is, precision, doc) {
7171
}
7272
};
7373

74-
let originalDocument = globalThis.document;
75-
globalThis.document = doc_wrapper;
74+
let originalDocument;
75+
76+
if (isNodeJs()) {
77+
originalDocument = globalThis.document;
78+
globalThis.document = doc_wrapper;
79+
}
7680

7781
let rndr = new SVGRenderer();
7882

79-
globalThis.document = originalDocument;
83+
if (isNodeJs())
84+
globalThis.document = originalDocument;
8085

8186
rndr.doc_wrapper = doc_wrapper; // use it to get final SVG code
8287

0 commit comments

Comments
 (0)