lythreeframe 1.2.31 → 1.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs.js
CHANGED
|
@@ -1546,6 +1546,9 @@ class Viewport {
|
|
|
1546
1546
|
if (viewportParam.isLabelRendererNeeded) {
|
|
1547
1547
|
this.createLabelRenderer();
|
|
1548
1548
|
}
|
|
1549
|
+
if (viewportParam.isUILayerNeeded) {
|
|
1550
|
+
this.createUILayer();
|
|
1551
|
+
}
|
|
1549
1552
|
if (this._canvas) {
|
|
1550
1553
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1551
1554
|
for (let entry of entries) {
|
|
@@ -1610,9 +1613,37 @@ class Viewport {
|
|
|
1610
1613
|
element.appendChild(this.labelRenderer.domElement);
|
|
1611
1614
|
}
|
|
1612
1615
|
}
|
|
1616
|
+
createUILayer() {
|
|
1617
|
+
if (!this._canvas)
|
|
1618
|
+
return;
|
|
1619
|
+
// 检查是否已存在 UI 层,避免重复创建
|
|
1620
|
+
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1621
|
+
if (!uiLayer) {
|
|
1622
|
+
uiLayer = document.createElement('div');
|
|
1623
|
+
uiLayer.className = 'scene-uiLayer';
|
|
1624
|
+
uiLayer.style.position = 'absolute';
|
|
1625
|
+
uiLayer.style.left = '0';
|
|
1626
|
+
uiLayer.style.top = '0';
|
|
1627
|
+
uiLayer.style.width = '100%';
|
|
1628
|
+
uiLayer.style.height = '100%';
|
|
1629
|
+
uiLayer.style.pointerEvents = 'none'; // UI层默认不响应鼠标事件
|
|
1630
|
+
uiLayer.style.zIndex = '10'; // 保证在渲染层之上
|
|
1631
|
+
this._canvas.appendChild(uiLayer);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1613
1634
|
init() {
|
|
1614
1635
|
this.setupPostProcess();
|
|
1615
1636
|
}
|
|
1637
|
+
addWidget(widget) {
|
|
1638
|
+
if (!this._canvas)
|
|
1639
|
+
return;
|
|
1640
|
+
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1641
|
+
if (!uiLayer) {
|
|
1642
|
+
console.warn("UI Layer not found, check your settings.");
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
uiLayer.appendChild(widget);
|
|
1646
|
+
}
|
|
1616
1647
|
setupPostProcess() {
|
|
1617
1648
|
if (this.postProcessParam.steps.length === 0) {
|
|
1618
1649
|
this.destroyPostProcess();
|
|
@@ -2224,6 +2255,13 @@ class Controller {
|
|
|
2224
2255
|
if (out[i].object.userData["rayIgnored"]) {
|
|
2225
2256
|
continue;
|
|
2226
2257
|
}
|
|
2258
|
+
let component = out[i].object.userData["LYObject"];
|
|
2259
|
+
if (!component) {
|
|
2260
|
+
continue;
|
|
2261
|
+
}
|
|
2262
|
+
if (!component.isHoverEnabled && !component.isClickEnabled) {
|
|
2263
|
+
continue;
|
|
2264
|
+
}
|
|
2227
2265
|
return out[i];
|
|
2228
2266
|
}
|
|
2229
2267
|
return null;
|
|
@@ -2322,7 +2360,8 @@ const DefaultCameraParam = JSON.parse(JSON.stringify(DefaultPerspectiveCameraPar
|
|
|
2322
2360
|
|
|
2323
2361
|
const DefaultViewportParam = {
|
|
2324
2362
|
elementId: null,
|
|
2325
|
-
isLabelRendererNeeded: false
|
|
2363
|
+
isLabelRendererNeeded: false,
|
|
2364
|
+
isUILayerNeeded: false,
|
|
2326
2365
|
};
|
|
2327
2366
|
|
|
2328
2367
|
const DefaultRendererParameters = {
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1544,6 +1544,9 @@ class Viewport {
|
|
|
1544
1544
|
if (viewportParam.isLabelRendererNeeded) {
|
|
1545
1545
|
this.createLabelRenderer();
|
|
1546
1546
|
}
|
|
1547
|
+
if (viewportParam.isUILayerNeeded) {
|
|
1548
|
+
this.createUILayer();
|
|
1549
|
+
}
|
|
1547
1550
|
if (this._canvas) {
|
|
1548
1551
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1549
1552
|
for (let entry of entries) {
|
|
@@ -1608,9 +1611,37 @@ class Viewport {
|
|
|
1608
1611
|
element.appendChild(this.labelRenderer.domElement);
|
|
1609
1612
|
}
|
|
1610
1613
|
}
|
|
1614
|
+
createUILayer() {
|
|
1615
|
+
if (!this._canvas)
|
|
1616
|
+
return;
|
|
1617
|
+
// 检查是否已存在 UI 层,避免重复创建
|
|
1618
|
+
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1619
|
+
if (!uiLayer) {
|
|
1620
|
+
uiLayer = document.createElement('div');
|
|
1621
|
+
uiLayer.className = 'scene-uiLayer';
|
|
1622
|
+
uiLayer.style.position = 'absolute';
|
|
1623
|
+
uiLayer.style.left = '0';
|
|
1624
|
+
uiLayer.style.top = '0';
|
|
1625
|
+
uiLayer.style.width = '100%';
|
|
1626
|
+
uiLayer.style.height = '100%';
|
|
1627
|
+
uiLayer.style.pointerEvents = 'none'; // UI层默认不响应鼠标事件
|
|
1628
|
+
uiLayer.style.zIndex = '10'; // 保证在渲染层之上
|
|
1629
|
+
this._canvas.appendChild(uiLayer);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1611
1632
|
init() {
|
|
1612
1633
|
this.setupPostProcess();
|
|
1613
1634
|
}
|
|
1635
|
+
addWidget(widget) {
|
|
1636
|
+
if (!this._canvas)
|
|
1637
|
+
return;
|
|
1638
|
+
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1639
|
+
if (!uiLayer) {
|
|
1640
|
+
console.warn("UI Layer not found, check your settings.");
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
uiLayer.appendChild(widget);
|
|
1644
|
+
}
|
|
1614
1645
|
setupPostProcess() {
|
|
1615
1646
|
if (this.postProcessParam.steps.length === 0) {
|
|
1616
1647
|
this.destroyPostProcess();
|
|
@@ -2222,6 +2253,13 @@ class Controller {
|
|
|
2222
2253
|
if (out[i].object.userData["rayIgnored"]) {
|
|
2223
2254
|
continue;
|
|
2224
2255
|
}
|
|
2256
|
+
let component = out[i].object.userData["LYObject"];
|
|
2257
|
+
if (!component) {
|
|
2258
|
+
continue;
|
|
2259
|
+
}
|
|
2260
|
+
if (!component.isHoverEnabled && !component.isClickEnabled) {
|
|
2261
|
+
continue;
|
|
2262
|
+
}
|
|
2225
2263
|
return out[i];
|
|
2226
2264
|
}
|
|
2227
2265
|
return null;
|
|
@@ -2320,7 +2358,8 @@ const DefaultCameraParam = JSON.parse(JSON.stringify(DefaultPerspectiveCameraPar
|
|
|
2320
2358
|
|
|
2321
2359
|
const DefaultViewportParam = {
|
|
2322
2360
|
elementId: null,
|
|
2323
|
-
isLabelRendererNeeded: false
|
|
2361
|
+
isLabelRendererNeeded: false,
|
|
2362
|
+
isUILayerNeeded: false,
|
|
2324
2363
|
};
|
|
2325
2364
|
|
|
2326
2365
|
const DefaultRendererParameters = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Object3D } from
|
|
2
|
-
import { ShadowMapType, ToneMapping, WebGPURenderer } from "three/webgpu";
|
|
1
|
+
import { ShadowMapType, ToneMapping, WebGPURenderer, Object3D } from "three/webgpu";
|
|
3
2
|
import { ThreeJsApp } from "../ThreeJsApp";
|
|
4
3
|
import { PostProcessParam, PostProcessStepParam } from './../PostProcess/PostProcessParam';
|
|
5
4
|
import { RendererParameters } from './Parameters/RendererParameters';
|
|
@@ -20,7 +19,9 @@ export declare class Viewport {
|
|
|
20
19
|
constructor(app: ThreeJsApp, viewportParam: ViewportParam, rendererParam: RendererParameters, postProcessParam: PostProcessParam);
|
|
21
20
|
protected createRenderer(rendererParam: RendererParameters): void;
|
|
22
21
|
protected createLabelRenderer(): void;
|
|
22
|
+
protected createUILayer(): void;
|
|
23
23
|
init(): void;
|
|
24
|
+
addWidget(widget: HTMLElement): void;
|
|
24
25
|
setupPostProcess(): void;
|
|
25
26
|
updatePostProcess(steps: PostProcessStepParam[]): void;
|
|
26
27
|
updateRendererSettings(data: RendererParameters): void;
|