soonspacejs 2.14.32 → 2.14.34
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/index.esm.js +58 -8
- package/package.json +1 -1
- package/types/Viewport/EventHandler.d.ts +1 -0
- package/types/Viewport/index.d.ts +14 -3
- package/types/index.d.ts +11 -0
package/dist/index.esm.js
CHANGED
|
@@ -24,7 +24,7 @@ import * as wi from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
|
24
24
|
import * as jc from "three/examples/jsm/libs/fflate.module.js";
|
|
25
25
|
import { NURBSCurve as Uc } from "three/examples/jsm/curves/NURBSCurve.js";
|
|
26
26
|
import { RectAreaLightHelper as Gc } from "three/examples/jsm/helpers/RectAreaLightHelper.js";
|
|
27
|
-
const Vc = "soonspacejs", Hc = "2.14.
|
|
27
|
+
const Vc = "soonspacejs", Hc = "2.14.34", bi = {
|
|
28
28
|
name: Vc,
|
|
29
29
|
version: Hc
|
|
30
30
|
}, wa = "[soonspacejs]: ";
|
|
@@ -7210,11 +7210,20 @@ var ae = ad();
|
|
|
7210
7210
|
function er(i) {
|
|
7211
7211
|
return i.charAt(0).toLowerCase() + i.slice(1);
|
|
7212
7212
|
}
|
|
7213
|
-
function od(i) {
|
|
7214
|
-
let
|
|
7215
|
-
for (;
|
|
7216
|
-
|
|
7217
|
-
|
|
7213
|
+
function od(i, e) {
|
|
7214
|
+
let t = i, n;
|
|
7215
|
+
for (; t; ) {
|
|
7216
|
+
if (t instanceof De && t.stype !== "Group") {
|
|
7217
|
+
if (e && e.has(t.stype)) {
|
|
7218
|
+
t = t.parent;
|
|
7219
|
+
continue;
|
|
7220
|
+
}
|
|
7221
|
+
n = t;
|
|
7222
|
+
break;
|
|
7223
|
+
}
|
|
7224
|
+
t = t.parent;
|
|
7225
|
+
}
|
|
7226
|
+
return n;
|
|
7218
7227
|
}
|
|
7219
7228
|
function is(i, e) {
|
|
7220
7229
|
return i[e] || (i[e] = new ae.Signal()), i[e];
|
|
@@ -7249,6 +7258,8 @@ class ld {
|
|
|
7249
7258
|
touchstartTimes = [0, 0];
|
|
7250
7259
|
// 按 stype 存储当前 hover 选中的对象
|
|
7251
7260
|
hoverSelectMap = /* @__PURE__ */ new Map();
|
|
7261
|
+
// 根据 stype 排除事件触发的对象类型
|
|
7262
|
+
eventExcludeStypes = /* @__PURE__ */ new Set();
|
|
7252
7263
|
_getPoiAndModel() {
|
|
7253
7264
|
const { meshOfModelList: e, poiIconList: t } = this.viewport.scener.intersectsList;
|
|
7254
7265
|
return [...e, ...t];
|
|
@@ -7276,7 +7287,7 @@ class ld {
|
|
|
7276
7287
|
point: null
|
|
7277
7288
|
}, a = /* @__PURE__ */ new Map();
|
|
7278
7289
|
s.forEach((g) => {
|
|
7279
|
-
const v = od(g.object);
|
|
7290
|
+
const v = od(g.object, this.eventExcludeStypes);
|
|
7280
7291
|
if (!v) return;
|
|
7281
7292
|
const w = v.stype;
|
|
7282
7293
|
r.object || (r.type = w, r.object = g.object, r.point = g.point);
|
|
@@ -7771,6 +7782,30 @@ class ud {
|
|
|
7771
7782
|
clearSignals() {
|
|
7772
7783
|
for (const e in this.signals) this.signals[e].removeAll();
|
|
7773
7784
|
}
|
|
7785
|
+
/**
|
|
7786
|
+
* 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
|
|
7787
|
+
* @param objects 需要隔离显示的对象
|
|
7788
|
+
* @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
|
|
7789
|
+
*/
|
|
7790
|
+
isolate(e, t = 1) {
|
|
7791
|
+
const n = Array.isArray(e) ? e : [e], s = /* @__PURE__ */ new Set();
|
|
7792
|
+
for (const r of n)
|
|
7793
|
+
r.traverse((a) => {
|
|
7794
|
+
s.add(a);
|
|
7795
|
+
});
|
|
7796
|
+
this.scene.traverse((r) => {
|
|
7797
|
+
s.has(r) ? r.layers.enable(t) : r.layers.disable(0);
|
|
7798
|
+
}), this.camera.layers.disable(0), this.camera.layers.enable(t), this.render();
|
|
7799
|
+
}
|
|
7800
|
+
/**
|
|
7801
|
+
* 取消隔离 - 恢复场景中所有对象的可见性
|
|
7802
|
+
* @param layerChannel 之前隔离使用的 layer 通道,默认 1
|
|
7803
|
+
*/
|
|
7804
|
+
unisolate(e = 1) {
|
|
7805
|
+
this.scene.traverse((t) => {
|
|
7806
|
+
t.layers.enable(0), t.layers.disable(e);
|
|
7807
|
+
}), this.camera.layers.enable(0), this.camera.layers.disable(e), this.render();
|
|
7808
|
+
}
|
|
7774
7809
|
dispose() {
|
|
7775
7810
|
cancelAnimationFrame(this._loop), this.bvh.dispose(), this.mixer.stopAllAction(), this.clipsSet.forEach((e) => {
|
|
7776
7811
|
this.mixer.uncacheAction(e), this.mixer.uncacheClip(e);
|
|
@@ -8400,7 +8435,7 @@ class ho extends ze {
|
|
|
8400
8435
|
opacity: a = 1,
|
|
8401
8436
|
gradient: o
|
|
8402
8437
|
} = e ?? {};
|
|
8403
|
-
super(e), this.params = e, this.updateGeometry(n, s), this.updateMaterialOpacity(a), this.updateMaterial(r, o), this.stype = "Polygon", this.position.set(0, t, 0), this.rotation.set(-Math.PI / 2, 0, 0);
|
|
8438
|
+
super(e), this.params = e, this.updateGeometry(n, s), this.updateMaterialOpacity(a), this.updateMaterial(r, o), this.stype = "Polygon", this.position.set(0, t, 0), this.rotation.set(-Math.PI / 2, 0, 0), this.scale.setScalar(0.999);
|
|
8404
8439
|
}
|
|
8405
8440
|
updateGeometry(e, t) {
|
|
8406
8441
|
this.geometry.dispose();
|
|
@@ -14357,6 +14392,21 @@ class If {
|
|
|
14357
14392
|
unEmissiveShow(e) {
|
|
14358
14393
|
return this.viewport.scener.unEmissiveShow(e);
|
|
14359
14394
|
}
|
|
14395
|
+
/**
|
|
14396
|
+
* 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
|
|
14397
|
+
* @param objects 需要隔离显示的对象
|
|
14398
|
+
* @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
|
|
14399
|
+
*/
|
|
14400
|
+
isolate(e, t = 1) {
|
|
14401
|
+
this.viewport.isolate(e, t);
|
|
14402
|
+
}
|
|
14403
|
+
/**
|
|
14404
|
+
* 取消隔离 - 恢复场景中所有对象的可见性
|
|
14405
|
+
* @param layerChannel 之前隔离使用的 layer 通道,默认 1
|
|
14406
|
+
*/
|
|
14407
|
+
unisolate(e = 1) {
|
|
14408
|
+
this.viewport.unisolate(e);
|
|
14409
|
+
}
|
|
14360
14410
|
/******/
|
|
14361
14411
|
/******/
|
|
14362
14412
|
/******* Manager methods */
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mesh, Timer, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, AnimationClip, Texture, Material, OrthographicCamera } from 'three';
|
|
1
|
+
import { Mesh, Timer, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, AnimationClip, Texture, Material, OrthographicCamera, Object3D } from 'three';
|
|
2
2
|
import { EffectComposer } from 'postprocessing';
|
|
3
3
|
import { default as Stats } from 'three/examples/jsm/libs/stats.module.js';
|
|
4
4
|
import { Sky } from 'three/examples/jsm/objects/Sky.js';
|
|
@@ -122,9 +122,20 @@ declare class Viewport {
|
|
|
122
122
|
top: number;
|
|
123
123
|
};
|
|
124
124
|
getPositionByOffset(offset: OffsetPoint, z?: number, scalar?: number): Vector3;
|
|
125
|
-
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?:
|
|
126
|
-
rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<import('three').BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, Material | Material[], import('three').Object3DEventMap>[]): Intersection<
|
|
125
|
+
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D<import('three').Object3DEventMap>[], options?: IntersectsOptions): Intersection<Object3D<import('three').Object3DEventMap>>[];
|
|
126
|
+
rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<import('three').BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, Material | Material[], import('three').Object3DEventMap>[]): Intersection<Object3D<import('three').Object3DEventMap>>[];
|
|
127
127
|
clearSignals(): void;
|
|
128
|
+
/**
|
|
129
|
+
* 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
|
|
130
|
+
* @param objects 需要隔离显示的对象
|
|
131
|
+
* @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
|
|
132
|
+
*/
|
|
133
|
+
isolate(objects: Object3D | Object3D[], layerChannel?: number): void;
|
|
134
|
+
/**
|
|
135
|
+
* 取消隔离 - 恢复场景中所有对象的可见性
|
|
136
|
+
* @param layerChannel 之前隔离使用的 layer 通道,默认 1
|
|
137
|
+
*/
|
|
138
|
+
unisolate(layerChannel?: number): void;
|
|
128
139
|
dispose(): void;
|
|
129
140
|
_signalsEventListenr(): void;
|
|
130
141
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -407,6 +407,17 @@ declare class SoonSpace {
|
|
|
407
407
|
* @param objects
|
|
408
408
|
*/
|
|
409
409
|
unEmissiveShow(objects?: Object3D | Object3D[]): Promise<void | void[]>;
|
|
410
|
+
/**
|
|
411
|
+
* 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
|
|
412
|
+
* @param objects 需要隔离显示的对象
|
|
413
|
+
* @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
|
|
414
|
+
*/
|
|
415
|
+
isolate(objects: Object3D | Object3D[], layerChannel?: number): void;
|
|
416
|
+
/**
|
|
417
|
+
* 取消隔离 - 恢复场景中所有对象的可见性
|
|
418
|
+
* @param layerChannel 之前隔离使用的 layer 通道,默认 1
|
|
419
|
+
*/
|
|
420
|
+
unisolate(layerChannel?: number): void;
|
|
410
421
|
/******/
|
|
411
422
|
/******/
|
|
412
423
|
/******* Manager methods */
|