Skip to content

Commit 40447fd

Browse files
committed
Fix - more protect for SVG rendering
1 parent d646095 commit 40447fd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/base/base3d.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function createSVGRenderer(as_is, precision, doc) {
3030
svg_style: {},
3131
path_attr: {},
3232
accPath: '',
33-
createElementNS(ns,kind) {
33+
createElementNS(ns, kind) {
3434
if (kind == 'path')
3535
return {
3636
_wrapper: this,
@@ -89,11 +89,13 @@ function createSVGRenderer(as_is, precision, doc) {
8989

9090
rndr.render = function (scene, camera) {
9191
let originalDocument = globalThis.document;
92-
globalThis.document = this.doc_wrapper;
92+
if (isNodeJs())
93+
globalThis.document = this.doc_wrapper;
9394

9495
this.originalRender(scene, camera);
9596

96-
globalThis.document = originalDocument;
97+
if (isNodeJs())
98+
globalThis.document = originalDocument;
9799
}
98100

99101
rndr.clearHTML = function() {

0 commit comments

Comments
 (0)