From eb7e2a4229f4c8d77ac1d643dfcf9c481211f661 Mon Sep 17 00:00:00 2001 From: ErSan Date: Wed, 5 Nov 2025 16:19:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(SDK):=20=E8=A7=A3=E5=86=B3=E5=9B=A0?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=B8=85=E7=A9=BA=E6=97=B6=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=93=8D=E4=BD=9C=E9=80=A0=E6=88=90=E7=9A=84CSS2D?= =?UTF-8?q?=E3=80=81CSS3D=E5=A4=B1=E6=95=88=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- README.md | 2 +- packages/sdk/.env.development | 5 ++++- packages/sdk/.env.production | 5 ++++- packages/sdk/lib/core/objects/HtmlPanel.ts | 7 +++---- packages/sdk/lib/core/viewer/modules/Signals.ts | 3 --- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.en.md b/README.en.md index 4d6c638..bb005ec 100644 --- a/README.en.md +++ b/README.en.md @@ -56,7 +56,7 @@ Get the latest news and technical support in the following ways: ## ⚡ Quick start ### pre-demand -- Node.js ≥ 18.x +- Node.js ≥ 23.11.x - Yarn ### Local run diff --git a/README.md b/README.md index a8ee9e5..7ef3b6d 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ ## ⚡ 快速开始 ### 前置需求 -- Node.js ≥ 23.0.0 +- Node.js ≥ 23.11.x - PNPM ### 本地运行 diff --git a/packages/sdk/.env.development b/packages/sdk/.env.development index 41d1524..ea57a39 100644 --- a/packages/sdk/.env.development +++ b/packages/sdk/.env.development @@ -1,2 +1,5 @@ # 发布路径 -VITE_PUBLIC_PATH=/ \ No newline at end of file +VITE_PUBLIC_PATH=/ + +# 当前站点URL +VITE_GLOB_ORIGIN=https://localhost:8090/ \ No newline at end of file diff --git a/packages/sdk/.env.production b/packages/sdk/.env.production index 8097009..5e8881b 100644 --- a/packages/sdk/.env.production +++ b/packages/sdk/.env.production @@ -13,4 +13,7 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE=false VITE_ENABLE_ANALYZE=false # 是否生成app.config.js -VITE_ENABLE_CONFIG_GENERATE=false \ No newline at end of file +VITE_ENABLE_CONFIG_GENERATE=false + +# 当前站点URL +VITE_GLOB_ORIGIN=https://editor.astraljs.com/ \ No newline at end of file diff --git a/packages/sdk/lib/core/objects/HtmlPanel.ts b/packages/sdk/lib/core/objects/HtmlPanel.ts index de4bc6f..5dd2593 100644 --- a/packages/sdk/lib/core/objects/HtmlPanel.ts +++ b/packages/sdk/lib/core/objects/HtmlPanel.ts @@ -216,7 +216,7 @@ class HtmlPanelConverter { if (!option.fileName) { // 解析URL以获取文件名 // const _url = new URL(option.url, document.baseURI); - const _url = new URL(option.url, "https://editor.astraljs.com"); + const _url = new URL(option.url, import.meta.env.VITE_GLOB_ORIGIN); option.fileName = _url.pathname.split('/').pop() || 'index.html'; } @@ -231,8 +231,7 @@ class HtmlPanelConverter { } try{ - const htmlObject3D = this.parseToCSS3D(htmlPanelOption); - resolve(htmlObject3D); + resolve(this.parseToCSS3D(htmlPanelOption)); }catch (e){ reject(e); } @@ -461,7 +460,7 @@ class HtmlPanelConverter { if (!originPath) return; // 路径标准化处理 - const resolvedPath = new URL(originPath, `https://editor.astraljs.com/${basePath}/`).pathname.slice(1); + const resolvedPath = new URL(originPath, `${import.meta.env.VITE_GLOB_ORIGIN}/${basePath}/`).pathname.slice(1); if (filesMap.has(resolvedPath)) { el.setAttribute(attr, filesMap.get(resolvedPath)!); diff --git a/packages/sdk/lib/core/viewer/modules/Signals.ts b/packages/sdk/lib/core/viewer/modules/Signals.ts index 6ebc851..06cf976 100644 --- a/packages/sdk/lib/core/viewer/modules/Signals.ts +++ b/packages/sdk/lib/core/viewer/modules/Signals.ts @@ -69,9 +69,6 @@ export class Signals { this.viewer.modules.controls.setTarget(0, 0, 0,true); this.viewer.pathtracer?.reset(); - this.viewer.css2DRenderer.domElement.innerHTML = ""; - this.viewer.css3DRenderer.domElement.innerHTML = ""; - const rendererConfig = App.project.getKey("renderer"); App.FPS = rendererConfig.fps; this.viewer.renderer.shadowMap.enabled = rendererConfig.shadow.enabled;