fix(SDK): 解决因场景清空时的错误操作造成的CSS2D、CSS3D失效;
This commit is contained in:
parent
d17c5a25a3
commit
eb7e2a4229
@ -56,7 +56,7 @@ Get the latest news and technical support in the following ways:
|
|||||||
## ⚡ Quick start
|
## ⚡ Quick start
|
||||||
|
|
||||||
### pre-demand
|
### pre-demand
|
||||||
- Node.js ≥ 18.x
|
- Node.js ≥ 23.11.x
|
||||||
- Yarn
|
- Yarn
|
||||||
|
|
||||||
### Local run
|
### Local run
|
||||||
|
|||||||
@ -57,7 +57,7 @@
|
|||||||
## ⚡ 快速开始
|
## ⚡ 快速开始
|
||||||
|
|
||||||
### 前置需求
|
### 前置需求
|
||||||
- Node.js ≥ 23.0.0
|
- Node.js ≥ 23.11.x
|
||||||
- PNPM
|
- PNPM
|
||||||
|
|
||||||
### 本地运行
|
### 本地运行
|
||||||
|
|||||||
@ -1,2 +1,5 @@
|
|||||||
# 发布路径
|
# 发布路径
|
||||||
VITE_PUBLIC_PATH=/
|
VITE_PUBLIC_PATH=/
|
||||||
|
|
||||||
|
# 当前站点URL
|
||||||
|
VITE_GLOB_ORIGIN=https://localhost:8090/
|
||||||
@ -14,3 +14,6 @@ VITE_ENABLE_ANALYZE=false
|
|||||||
|
|
||||||
# 是否生成app.config.js
|
# 是否生成app.config.js
|
||||||
VITE_ENABLE_CONFIG_GENERATE=false
|
VITE_ENABLE_CONFIG_GENERATE=false
|
||||||
|
|
||||||
|
# 当前站点URL
|
||||||
|
VITE_GLOB_ORIGIN=https://editor.astraljs.com/
|
||||||
@ -216,7 +216,7 @@ class HtmlPanelConverter {
|
|||||||
if (!option.fileName) {
|
if (!option.fileName) {
|
||||||
// 解析URL以获取文件名
|
// 解析URL以获取文件名
|
||||||
// const _url = new URL(option.url, document.baseURI);
|
// 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';
|
option.fileName = _url.pathname.split('/').pop() || 'index.html';
|
||||||
}
|
}
|
||||||
@ -231,8 +231,7 @@ class HtmlPanelConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
const htmlObject3D = this.parseToCSS3D(htmlPanelOption);
|
resolve(this.parseToCSS3D(htmlPanelOption));
|
||||||
resolve(htmlObject3D);
|
|
||||||
}catch (e){
|
}catch (e){
|
||||||
reject(e);
|
reject(e);
|
||||||
}
|
}
|
||||||
@ -461,7 +460,7 @@ class HtmlPanelConverter {
|
|||||||
if (!originPath) return;
|
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)) {
|
if (filesMap.has(resolvedPath)) {
|
||||||
el.setAttribute(attr, filesMap.get(resolvedPath)!);
|
el.setAttribute(attr, filesMap.get(resolvedPath)!);
|
||||||
|
|||||||
@ -69,9 +69,6 @@ export class Signals {
|
|||||||
this.viewer.modules.controls.setTarget(0, 0, 0,true);
|
this.viewer.modules.controls.setTarget(0, 0, 0,true);
|
||||||
this.viewer.pathtracer?.reset();
|
this.viewer.pathtracer?.reset();
|
||||||
|
|
||||||
this.viewer.css2DRenderer.domElement.innerHTML = "";
|
|
||||||
this.viewer.css3DRenderer.domElement.innerHTML = "";
|
|
||||||
|
|
||||||
const rendererConfig = App.project.getKey("renderer");
|
const rendererConfig = App.project.getKey("renderer");
|
||||||
App.FPS = rendererConfig.fps;
|
App.FPS = rendererConfig.fps;
|
||||||
this.viewer.renderer.shadowMap.enabled = rendererConfig.shadow.enabled;
|
this.viewer.renderer.shadowMap.enabled = rendererConfig.shadow.enabled;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user