From 15e4bdabf576226c507ff1cbb9d164e950d1fc40 Mon Sep 17 00:00:00 2001 From: Jan Umbach Date: Wed, 19 Jun 2024 21:08:28 +0200 Subject: [PATCH] shx-3d-render --- snippets/shx-3d-render-input.liquid | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/snippets/shx-3d-render-input.liquid b/snippets/shx-3d-render-input.liquid index c41b1b0..7d642ab 100644 --- a/snippets/shx-3d-render-input.liquid +++ b/snippets/shx-3d-render-input.liquid @@ -163,7 +163,13 @@ return; } - if(data.id !== this.uuid) return; + if(data.id !== this.uuid) { + if(status === "init" ) { + Viewer3D.contentWindow.postMessage(JSON.stringify({"init":{"uuid":this.uuid}}), "*"); + this.Viewer3DContainer.querySelector('.shx-loading-spinner-container').classList.remove('shx-loading-spinner-container-done'); + } + return; + }; console.log("Message received from the child: ", data); // Message received from child @@ -200,10 +206,7 @@ function createIFrame() { this.Viewer3D = document.createElement('iframe'); - const Viewer3D = this.Viewer3D; - this.Viewer3D.onload = () => { - Viewer3D.contentWindow.postMessage(JSON.stringify({"init":{"uuid":this.uuid}}), "*"); - }; + const Viewer3D = this.Viewer3D; this.Viewer3D.src = "https://3d-viewer.shinnex.de/"; this.Viewer3D.classList.add('shx-threejs-renderer');