@realsee/dnalogel 2.1.0-alpha.26 → 2.1.0-alpha.28
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.cjs.js +556 -0
- package/dist/index.es.js +21392 -0
- package/dist/index.js +5104 -4997
- package/dist/index.umd.js +556 -0
- package/docs/classes/CruisePluginController.html +14 -14
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/classes/Object3DHelperController.html +9 -9
- package/docs/classes/PaintBrush.html +3 -3
- package/docs/classes/PanoTagPluginController.html +23 -23
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/ContentType.html +7 -7
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/DimensionType.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/LinkType.html +1 -1
- package/docs/enums/PaintBrushTypeEnum.html +1 -1
- package/docs/enums/PointType.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginEventMap.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginState.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/ContentTypeMap.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
- package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/Object3DHelperState.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PaintBrushAction.html +7 -7
- package/docs/interfaces/PaintBrushConfigs.html +1 -1
- package/docs/interfaces/PaintBrushState.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +2 -2
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/interfaces/Scissor.html +5 -5
- package/docs/interfaces/TagConfig.html +3 -3
- package/docs/interfaces/Tags.html +3 -3
- package/docs/modules.html +21 -21
- package/libs/CSS3DRenderPlugin/CSS3DRender.d.ts +15 -4
- package/libs/CSS3DRenderPlugin/CSS3DRender.js +197 -143
- package/libs/CSS3DRenderPlugin/Controller.d.ts +2 -0
- package/libs/CSS3DRenderPlugin/Controller.js +47 -26
- package/libs/CSS3DRenderPlugin/utils/CSS3DObjectPlus.d.ts +22 -4
- package/libs/CSS3DRenderPlugin/utils/CSS3DObjectPlus.js +56 -37
- package/libs/Object3DHelperPlugin/Controller.js +24 -23
- package/libs/PanoTagPlugin/Components/Common/MediaItem.js +81 -81
- package/libs/PanoTagPlugin/Components/Tag/ImageTextTag.js +69 -68
- package/libs/PanoTagPlugin/controller/index.js +1 -1
- package/libs/shared-utils/Object3DHelper/Base/BaseController.js +63 -53
- package/libs/shared-utils/Object3DHelper/Controller/MoveController.js +12 -13
- package/libs/shared-utils/Object3DHelper/Controller/RectangleScaleController.js +43 -45
- package/libs/shared-utils/Object3DHelper/Helper/Objects/ArrowGroup.js +16 -10
- package/libs/shared-utils/Object3DHelper/Helper/RectangleScaleHelper.d.ts +1 -1
- package/libs/shared-utils/Object3DHelper/Helper/RectangleScaleHelper.js +43 -43
- package/libs/shared-utils/Object3DHelper/Helper/RotateHelper.js +2 -2
- package/libs/shared-utils/Object3DHelper/index.js +12 -12
- package/package.json +2 -2
|
@@ -2,10 +2,10 @@ import * as THREE from 'three';
|
|
|
2
2
|
import { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer';
|
|
3
3
|
import { Subscribe } from '../shared-utils/Subscribe';
|
|
4
4
|
import { AnyPosition } from './utils';
|
|
5
|
-
import { CSS3DObjectPlus } from './utils/CSS3DObjectPlus';
|
|
5
|
+
import { CSS3DObjectPlus, Mode } from './utils/CSS3DObjectPlus';
|
|
6
|
+
export { MinRatio } from './utils/CSS3DObjectPlus';
|
|
6
7
|
export declare const __ELEMENT__ = "__CSS3DOBJECT_CSS3DRENDER_CONTAINER__";
|
|
7
8
|
export declare const PLUGIN: string;
|
|
8
|
-
export declare const MinRatio = 0.00216;
|
|
9
9
|
export interface CSS3DRenderState {
|
|
10
10
|
enabled: boolean;
|
|
11
11
|
visible: boolean;
|
|
@@ -54,7 +54,11 @@ export interface Create3DDElementParamsType {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
export declare const globalStore: {
|
|
57
|
-
|
|
57
|
+
frontModeResizeObserver?: {
|
|
58
|
+
observe: () => void;
|
|
59
|
+
unobserve: () => void;
|
|
60
|
+
};
|
|
61
|
+
behindModeResizeObserver?: {
|
|
58
62
|
observe: () => void;
|
|
59
63
|
unobserve: () => void;
|
|
60
64
|
};
|
|
@@ -143,10 +147,17 @@ export declare class CSS3DRender {
|
|
|
143
147
|
setEnabled: (enabled: boolean) => void;
|
|
144
148
|
appendToElement: (container: Element) => void;
|
|
145
149
|
};
|
|
146
|
-
|
|
150
|
+
setContainer(container: Element, mode: Mode): void;
|
|
151
|
+
appendToElement(container: Element | undefined, mode: Mode): void;
|
|
147
152
|
setVisibleById: (id: string, visible: boolean) => void;
|
|
148
153
|
setEnabledById: (id: string, enabled: boolean) => void;
|
|
154
|
+
private render;
|
|
149
155
|
private createObject;
|
|
156
|
+
private initGlobalModeStore;
|
|
157
|
+
/**
|
|
158
|
+
* @description: 生成透明Mesh
|
|
159
|
+
*/
|
|
160
|
+
private createOpacityMesh;
|
|
150
161
|
private handleShow;
|
|
151
162
|
private handleHide;
|
|
152
163
|
private handleEnable;
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import * as
|
|
5
|
-
import { CSS3DRenderer as
|
|
6
|
-
import { Subscribe as
|
|
7
|
-
import { evenNumber as
|
|
8
|
-
import { anyPositionToVector3 as
|
|
9
|
-
import { CSS3DObjectPlus as
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var K = (S, e, t) => e in S ? J(S, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : S[e] = t;
|
|
3
|
+
var b = (S, e, t) => (K(S, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import * as C from "three";
|
|
5
|
+
import { CSS3DRenderer as B } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
6
|
+
import { Subscribe as X } from "../shared-utils/Subscribe.js";
|
|
7
|
+
import { evenNumber as L } from "./utils/evenNumber.js";
|
|
8
|
+
import { anyPositionToVector3 as Y } from "./utils/positionToVector3.js";
|
|
9
|
+
import { CSS3DObjectPlus as Z } from "./utils/CSS3DObjectPlus.js";
|
|
10
|
+
import { MinRatio as fe } from "./utils/CSS3DObjectPlus.js";
|
|
10
11
|
import "./utils/centerPoint.js";
|
|
11
|
-
const
|
|
12
|
-
class
|
|
12
|
+
const ee = "v2.0.1", x = "CSS3DRenderer", ce = "__CSS3DOBJECT_CSS3DRENDER_CONTAINER__", m = `${x}@${ee}`, P = (S) => `${m}--${S}`, o = {};
|
|
13
|
+
class ae {
|
|
13
14
|
constructor() {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
b(this, "hooks", new X());
|
|
16
|
+
b(this, "state", {
|
|
16
17
|
enabled: !0,
|
|
17
18
|
visible: !0,
|
|
18
19
|
disposed: !1
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
b(this, "store", {
|
|
22
|
+
rendered: !1,
|
|
21
23
|
disposers: [],
|
|
22
24
|
frontModeCSS3DObjects: {},
|
|
23
25
|
behindModeCSS3DObjects: {}
|
|
24
26
|
});
|
|
25
|
-
|
|
27
|
+
b(this, "create3DElement", (e, t, s) => {
|
|
26
28
|
if (this.state.disposed)
|
|
27
29
|
return this.disposedErrorLog();
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
+
const n = (() => {
|
|
31
|
+
const r = {
|
|
30
32
|
ratio: 216e-5,
|
|
31
33
|
devicePixelRatio: 1,
|
|
32
34
|
mode: "front",
|
|
@@ -34,133 +36,143 @@ class te {
|
|
|
34
36
|
container: document.createElement("div"),
|
|
35
37
|
pointerEvents: "none"
|
|
36
38
|
};
|
|
37
|
-
return Object.assign(
|
|
38
|
-
})(),
|
|
39
|
-
if ((
|
|
40
|
-
return console.error(`${
|
|
41
|
-
const { ratio:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
return Object.assign(r, s);
|
|
40
|
+
})(), i = t.map(Y);
|
|
41
|
+
if ((i == null ? void 0 : i.length) < 4)
|
|
42
|
+
return console.error(`${m}: requires 4 point but params may have fewer`);
|
|
43
|
+
const { ratio: d, devicePixelRatio: a, mode: h, autoRender: p, container: f, pointerEvents: N } = n, w = [], { css3DObject: c, opacityMesh: O } = this.createObject(i, { ratio: d, dpr: a, container: f, mode: h, pointerEvents: N });
|
|
44
|
+
f.id = `container--${c.uuid}`;
|
|
45
|
+
const U = h === "front" && !o.frontModeStore, H = h === "behind" && !o.behindModeStore;
|
|
46
|
+
h === "front" && this.initGlobalModeStore("front"), h === "behind" && this.initGlobalModeStore("behind", n.scene), c.hooks.on("changeMode", (r, D, M) => {
|
|
47
|
+
var k, T, $;
|
|
48
|
+
if (r === D)
|
|
49
|
+
return;
|
|
50
|
+
r === "front" && this.initGlobalModeStore("front"), r === "behind" && this.initGlobalModeStore("behind", M);
|
|
51
|
+
const l = D === "front" ? o.frontModeStore : o.behindModeStore, u = r === "front" ? o.frontModeStore : o.behindModeStore, A = D === "behind" ? this.store.behindModeCSS3DObjects : this.store.frontModeCSS3DObjects, I = r === "behind" ? this.store.behindModeCSS3DObjects : this.store.frontModeCSS3DObjects;
|
|
52
|
+
if (!A || !I)
|
|
53
|
+
return console.error(`${m}: changeMode error: prevObjects or nextObjects is undefined`);
|
|
54
|
+
const j = A[c.uuid];
|
|
55
|
+
if (!j)
|
|
56
|
+
return console.error(`${m}: changeMode error: prevObject is undefined`);
|
|
57
|
+
if (r === "behind") {
|
|
58
|
+
const _ = (k = j.opacityMesh) != null ? k : this.createOpacityMesh(j.css3DObject);
|
|
59
|
+
l == null || l.css3DScene.remove(j.css3DObject), I[c.uuid] = { css3DObject: c, opacityMesh: _, visible: !0, enabled: !0, mode: r, scene: M }, u == null || u.css3DScene.add(c), M == null || M.add(_);
|
|
60
|
+
}
|
|
61
|
+
r === "front" && (l == null || l.css3DScene.remove(j.css3DObject), ($ = (T = A[c.uuid]) == null ? void 0 : T.scene) == null || $.remove(j.opacityMesh), I[c.uuid] = { css3DObject: c, visible: !0, enabled: !0, mode: r }, u == null || u.css3DScene.add(c)), r === "behind" && this.appendToElement(o.behindModeContainer, "behind"), r === "front" && this.appendToElement(o.frontModeContainer, "front"), this.render(e), console.log("change success");
|
|
47
62
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
const y = h === "front" ? o.frontModeStore : o.behindModeStore, { css3DScene: E, css3DRenderer: v } = y, F = (() => {
|
|
64
|
+
const r = () => {
|
|
65
|
+
var M, l;
|
|
66
|
+
const D = c.mode;
|
|
67
|
+
if (D === "front")
|
|
68
|
+
this.store.frontModeCSS3DObjects[c.uuid] = {
|
|
69
|
+
visible: !0,
|
|
70
|
+
enabled: !0,
|
|
71
|
+
css3DObject: c,
|
|
72
|
+
mode: "front"
|
|
73
|
+
};
|
|
74
|
+
else {
|
|
75
|
+
if (!n.scene)
|
|
76
|
+
return;
|
|
77
|
+
this.store.behindModeCSS3DObjects[c.uuid] = {
|
|
78
|
+
visible: !0,
|
|
79
|
+
enabled: !0,
|
|
80
|
+
css3DObject: c,
|
|
81
|
+
opacityMesh: O,
|
|
82
|
+
mode: "behind",
|
|
83
|
+
scene: n.scene
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
E.getObjectById(c.id) || E.add(c), D === "behind" && O && ((M = n.scene) != null && M.getObjectById(O.id) || (l = n.scene) == null || l.add(O), w.push(() => {
|
|
87
|
+
var u;
|
|
88
|
+
return O && ((u = n.scene) == null ? void 0 : u.remove(O));
|
|
89
|
+
}));
|
|
70
90
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return () => d();
|
|
82
|
-
})(), w = r === "front" ? o.frontModeContainer : o.behindModeContainer;
|
|
83
|
-
if (w) {
|
|
84
|
-
this.appendToElement(w, r);
|
|
85
|
-
const d = r === "front" ? o.frontModeStore : o.behindModeStore;
|
|
86
|
-
d && (d.appendedToPage = !0);
|
|
91
|
+
return U || H ? (v.domElement.style.position = "absolute", v.domElement.style.top = "0", v.domElement.style.userSelect = "none", v.domElement.style.pointerEvents = "none", v.domElement.classList.add(P(h)), () => {
|
|
92
|
+
r(), this.render(e);
|
|
93
|
+
}) : (this.store.rendered = !0, () => r());
|
|
94
|
+
})(), z = h === "front" ? o.frontModeContainer : o.behindModeContainer;
|
|
95
|
+
if (z) {
|
|
96
|
+
this.appendToElement(z, h);
|
|
97
|
+
const r = h === "front" ? o.frontModeStore : o.behindModeStore;
|
|
98
|
+
r && (r.appendedToPage = !0);
|
|
87
99
|
}
|
|
88
|
-
const
|
|
89
|
-
return this.store.disposers.push(
|
|
100
|
+
const g = (r) => this.setVisibleById(c.uuid, r), R = (r) => this.setEnabledById(c.uuid, r), V = () => g(!0), G = () => g(!1), Q = () => R(!0), W = () => R(!1), q = () => (delete this.store.frontModeCSS3DObjects[c.uuid], delete this.store.behindModeCSS3DObjects[c.uuid], w.forEach((r) => r == null ? void 0 : r()), E.remove(c), E.children.length === 0 && (typeof y.requestAnimationFrameId == "number" && cancelAnimationFrame(y.requestAnimationFrameId), v.domElement.remove(), h === "front" && (o.frontModeStore = void 0), h === "behind" && (o.behindModeStore = void 0), o.frontModeResizeObserver = void 0, o.behindModeResizeObserver = void 0), !0);
|
|
101
|
+
return this.store.disposers.push(q), p && F(), {
|
|
90
102
|
id: c.uuid,
|
|
91
|
-
container:
|
|
92
|
-
dispose:
|
|
103
|
+
container: f,
|
|
104
|
+
dispose: q,
|
|
93
105
|
css3DObject: c,
|
|
94
|
-
render:
|
|
95
|
-
show:
|
|
96
|
-
hide:
|
|
97
|
-
setVisible:
|
|
98
|
-
disable:
|
|
99
|
-
enable:
|
|
100
|
-
setEnabled:
|
|
101
|
-
appendToElement: (
|
|
106
|
+
render: p ? void 0 : F,
|
|
107
|
+
show: V,
|
|
108
|
+
hide: G,
|
|
109
|
+
setVisible: g,
|
|
110
|
+
disable: W,
|
|
111
|
+
enable: Q,
|
|
112
|
+
setEnabled: R,
|
|
113
|
+
appendToElement: (r) => this.appendToElement(r, h)
|
|
102
114
|
};
|
|
103
115
|
});
|
|
104
|
-
|
|
105
|
-
var
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
116
|
+
b(this, "setVisibleById", (e, t) => {
|
|
117
|
+
var n;
|
|
118
|
+
const s = (n = this.store.frontModeCSS3DObjects[e]) != null ? n : this.store.behindModeCSS3DObjects[e];
|
|
119
|
+
if (!s)
|
|
108
120
|
return console.error("id not found", e);
|
|
109
|
-
|
|
121
|
+
s.visible = t, this.state.visible && (s.css3DObject.visible = t, s.mode === "behind" && (s.opacityMesh.visible = t));
|
|
110
122
|
});
|
|
111
|
-
|
|
112
|
-
var
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
123
|
+
b(this, "setEnabledById", (e, t) => {
|
|
124
|
+
var i, d, a;
|
|
125
|
+
const s = (i = this.store.frontModeCSS3DObjects[e]) != null ? i : this.store.behindModeCSS3DObjects[e];
|
|
126
|
+
if (!s)
|
|
115
127
|
return;
|
|
116
|
-
const
|
|
117
|
-
!
|
|
128
|
+
const n = s.mode === "front" ? (d = o.frontModeStore) == null ? void 0 : d.css3DScene : (a = o.behindModeStore) == null ? void 0 : a.css3DScene;
|
|
129
|
+
!n || (t ? (n.add(s.css3DObject), s.mode === "behind" && s.scene.add(s.opacityMesh)) : (n.remove(s.css3DObject), s.mode === "behind" && s.scene.remove(s.opacityMesh)), s.enabled = t);
|
|
118
130
|
});
|
|
119
|
-
|
|
120
|
-
const { ratio:
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})();
|
|
132
|
-
return
|
|
131
|
+
b(this, "createObject", (e, t) => {
|
|
132
|
+
const { ratio: s, dpr: n, container: i, mode: d, pointerEvents: a } = t, h = new Z(i, e, s, n, d);
|
|
133
|
+
i.style.pointerEvents = a, i.classList.add(`${x}__container`);
|
|
134
|
+
const p = d === "behind" ? this.createOpacityMesh(h) : void 0;
|
|
135
|
+
return { css3DObject: h, opacityMesh: p };
|
|
136
|
+
});
|
|
137
|
+
b(this, "createOpacityMesh", (e) => {
|
|
138
|
+
const { domWidthPx: t, domHeightPx: s } = e, n = new C.MeshBasicMaterial({
|
|
139
|
+
opacity: 0,
|
|
140
|
+
color: 0,
|
|
141
|
+
transparent: !1,
|
|
142
|
+
side: C.DoubleSide
|
|
143
|
+
}), i = new C.PlaneGeometry(t, s), d = new C.Mesh(i, n);
|
|
144
|
+
return d.name = P("mesh"), d.position.copy(e.position), d.rotation.copy(e.rotation), d.scale.copy(e.scale), e.hooks.on("applyMatrix4", (a) => d.applyMatrix4(a)), e.hooks.on("applyQuaternion", (a) => d.applyQuaternion(a)), e.hooks.on("applyScaleMatrix4", (a) => d.scale.applyMatrix4(a)), d;
|
|
133
145
|
});
|
|
134
|
-
|
|
146
|
+
b(this, "createResizeObserver", (e, t, s = !0) => {
|
|
135
147
|
if (!e)
|
|
136
148
|
return console.error("createResizeObserver: element is undefined"), { observe: () => {
|
|
137
149
|
}, unobserve: () => {
|
|
138
150
|
} };
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
|
|
151
|
+
const n = () => {
|
|
152
|
+
const d = L(e.clientWidth, { smaller: !0 }), a = L(e.clientHeight, { smaller: !0 });
|
|
153
|
+
t(d, a);
|
|
142
154
|
};
|
|
143
155
|
if (typeof ResizeObserver > "u" || !ResizeObserver)
|
|
144
|
-
return console.warn("createResizeObserver: ResizeObserver is undefined"), { observe: () =>
|
|
156
|
+
return console.warn("createResizeObserver: ResizeObserver is undefined"), { observe: () => n(), unobserve: () => {
|
|
145
157
|
} };
|
|
146
|
-
const
|
|
147
|
-
return
|
|
148
|
-
observe: () =>
|
|
149
|
-
unobserve: () =>
|
|
158
|
+
const i = new ResizeObserver(n);
|
|
159
|
+
return s && n(), {
|
|
160
|
+
observe: () => i.observe(e),
|
|
161
|
+
unobserve: () => i.unobserve(e)
|
|
150
162
|
};
|
|
151
163
|
});
|
|
152
|
-
|
|
153
|
-
console.error(`${
|
|
164
|
+
b(this, "disposedErrorLog", () => {
|
|
165
|
+
console.error(`${m} is disposed`);
|
|
154
166
|
});
|
|
155
167
|
}
|
|
156
168
|
getCurrentState() {
|
|
157
169
|
return this.state;
|
|
158
170
|
}
|
|
159
|
-
setState(e,
|
|
171
|
+
setState(e, t = { userAction: !0 }) {
|
|
160
172
|
if (this.state.disposed)
|
|
161
173
|
return this.disposedErrorLog();
|
|
162
|
-
const
|
|
163
|
-
this.state = Object.assign(this.state, e),
|
|
174
|
+
const s = { ...this.state };
|
|
175
|
+
this.state = Object.assign(this.state, e), s.visible !== this.state.visible && (e.visible ? this.handleShow() : this.handleHide()), s.enabled !== this.state.enabled && (e.enabled ? this.handleEnable() : this.handleDisable()), this.hooks.emit("stateChange", { state: this.state, prevState: s, userAction: t.userAction });
|
|
164
176
|
}
|
|
165
177
|
dispose() {
|
|
166
178
|
this.store.disposers.forEach((e) => e == null ? void 0 : e()), this.store.disposers = [], this.hooks.emit("dispose"), this.state.disposed = !0;
|
|
@@ -185,24 +197,66 @@ class te {
|
|
|
185
197
|
return this.disposedErrorLog();
|
|
186
198
|
this.setState({ enabled: !1 }, { userAction: e }), this.hooks.emit("disable", { userAction: e });
|
|
187
199
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
setContainer(e, t) {
|
|
201
|
+
t === "front" ? o.frontModeContainer = e : o.behindModeContainer = e;
|
|
202
|
+
}
|
|
203
|
+
appendToElement(e, t) {
|
|
204
|
+
const s = t === "front" ? o.frontModeStore : o.behindModeStore;
|
|
205
|
+
if (!s) {
|
|
206
|
+
if (t === "front" && !o.frontModeContainer) {
|
|
207
|
+
if (!e)
|
|
208
|
+
throw new Error(`${m} Cannot append to container: front mode but container is ${e}`);
|
|
209
|
+
o.frontModeContainer = e;
|
|
210
|
+
}
|
|
211
|
+
if (t === "behind" && !o.behindModeContainer) {
|
|
212
|
+
if (!e)
|
|
213
|
+
throw new Error(`${m} Cannot append to container: behind mode but container is ${e}`);
|
|
214
|
+
o.behindModeContainer = e;
|
|
215
|
+
}
|
|
194
216
|
return;
|
|
195
217
|
}
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
218
|
+
if (s.appendedToPage)
|
|
219
|
+
return;
|
|
220
|
+
const n = t === "behind" ? o.behindModeContainer : o.frontModeContainer;
|
|
221
|
+
if (!n)
|
|
222
|
+
return console.error("wrapper is undefined");
|
|
223
|
+
if (n.appendChild(s.css3DRenderer.domElement), t === "behind" && !o.behindModeResizeObserver) {
|
|
224
|
+
const i = (h, p) => {
|
|
225
|
+
var f;
|
|
226
|
+
(f = o.behindModeStore) == null || f.css3DRenderer.setSize(h, p);
|
|
227
|
+
}, { observe: d, unobserve: a } = this.createResizeObserver(n, i, !0);
|
|
228
|
+
o.behindModeResizeObserver = { observe: d, unobserve: a }, d(), this.store.disposers.push(a);
|
|
229
|
+
}
|
|
230
|
+
if (t === "front" && !o.frontModeResizeObserver) {
|
|
231
|
+
const i = (h, p) => {
|
|
232
|
+
var f;
|
|
233
|
+
(f = o.frontModeStore) == null || f.css3DRenderer.setSize(h, p);
|
|
234
|
+
}, { observe: d, unobserve: a } = this.createResizeObserver(n, i, !0);
|
|
235
|
+
o.frontModeResizeObserver = { observe: d, unobserve: a }, d(), this.store.disposers.push(a);
|
|
236
|
+
}
|
|
237
|
+
s.appendedToPage = !0;
|
|
238
|
+
}
|
|
239
|
+
render(e) {
|
|
240
|
+
const t = o.behindModeStore, s = o.frontModeStore;
|
|
241
|
+
if (t && Object.keys(this.store.behindModeCSS3DObjects).length > 0 && !t.requestAnimationFrameId) {
|
|
242
|
+
const n = () => {
|
|
243
|
+
const i = requestAnimationFrame(n);
|
|
244
|
+
t.requestAnimationFrameId = i, t.css3DRenderer.render(t.css3DScene, e);
|
|
245
|
+
};
|
|
246
|
+
n();
|
|
247
|
+
}
|
|
248
|
+
if (s && Object.keys(this.store.frontModeCSS3DObjects).length > 0 && !s.requestAnimationFrameId) {
|
|
249
|
+
const n = () => {
|
|
250
|
+
const i = requestAnimationFrame(n);
|
|
251
|
+
s.requestAnimationFrameId = i, s.css3DRenderer.render(s.css3DScene, e);
|
|
252
|
+
};
|
|
253
|
+
n();
|
|
205
254
|
}
|
|
255
|
+
Object.keys(this.store.frontModeCSS3DObjects).length === 0 && (s == null ? void 0 : s.requestAnimationFrameId) !== void 0 && (cancelAnimationFrame(s.requestAnimationFrameId), s.requestAnimationFrameId = void 0), Object.keys(this.store.behindModeCSS3DObjects).length === 0 && (t == null ? void 0 : t.requestAnimationFrameId) !== void 0 && (cancelAnimationFrame(t.requestAnimationFrameId), t.requestAnimationFrameId = void 0);
|
|
256
|
+
}
|
|
257
|
+
initGlobalModeStore(e, t) {
|
|
258
|
+
const s = e === "front" && !o.frontModeStore;
|
|
259
|
+
e === "behind" && !o.behindModeStore && (o.behindModeStore = { scene: t, css3DScene: new C.Scene(), css3DRenderer: new B() }), s && (o.frontModeStore = { css3DScene: new C.Scene(), css3DRenderer: new B() });
|
|
206
260
|
}
|
|
207
261
|
async handleShow() {
|
|
208
262
|
Object.values(this.store.frontModeCSS3DObjects).forEach((e) => {
|
|
@@ -220,27 +274,27 @@ class te {
|
|
|
220
274
|
}
|
|
221
275
|
handleEnable() {
|
|
222
276
|
Object.values(this.store.frontModeCSS3DObjects).forEach((e) => {
|
|
223
|
-
var
|
|
224
|
-
!e.enabled || (
|
|
277
|
+
var t;
|
|
278
|
+
!e.enabled || (t = o.frontModeStore) == null || t.css3DScene.add(e.css3DObject);
|
|
225
279
|
}), Object.values(this.store.behindModeCSS3DObjects).forEach((e) => {
|
|
226
|
-
var
|
|
227
|
-
!e.enabled || ((
|
|
280
|
+
var t, s;
|
|
281
|
+
!e.enabled || ((t = o.behindModeStore) == null || t.css3DScene.add(e.css3DObject), (s = o.behindModeStore) == null || s.scene.add(e.opacityMesh));
|
|
228
282
|
});
|
|
229
283
|
}
|
|
230
284
|
handleDisable() {
|
|
231
285
|
Object.values(this.store.frontModeCSS3DObjects).forEach((e) => {
|
|
232
|
-
var
|
|
233
|
-
(
|
|
286
|
+
var t;
|
|
287
|
+
(t = o.frontModeStore) == null || t.css3DScene.remove(e.css3DObject);
|
|
234
288
|
}), Object.values(this.store.behindModeCSS3DObjects).forEach((e) => {
|
|
235
|
-
var
|
|
236
|
-
(
|
|
289
|
+
var t, s;
|
|
290
|
+
(t = o.behindModeStore) == null || t.css3DScene.remove(e.css3DObject), (s = o.behindModeStore) == null || s.scene.remove(e.opacityMesh);
|
|
237
291
|
});
|
|
238
292
|
}
|
|
239
293
|
}
|
|
240
294
|
export {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
295
|
+
ae as CSS3DRender,
|
|
296
|
+
fe as MinRatio,
|
|
297
|
+
m as PLUGIN,
|
|
298
|
+
ce as __ELEMENT__,
|
|
245
299
|
o as globalStore
|
|
246
300
|
};
|
|
@@ -22,6 +22,7 @@ export interface Create3DDomContainerParamsType {
|
|
|
22
22
|
}
|
|
23
23
|
export default class Controller extends CSS3DRender implements BasePlugin.Controller<CSS3DRenderState, CSS3DRenderEventMap> {
|
|
24
24
|
five: Five;
|
|
25
|
+
behindFiveContainer?: HTMLElement;
|
|
25
26
|
readonly staticPrefix: string;
|
|
26
27
|
constructor(five: Five);
|
|
27
28
|
/** @deprecated disposeAll() renamed as dispose() */
|
|
@@ -76,4 +77,5 @@ export default class Controller extends CSS3DRender implements BasePlugin.Contro
|
|
|
76
77
|
setEnabled: (enabled: boolean) => void;
|
|
77
78
|
appendToElement: (container: Element) => void;
|
|
78
79
|
};
|
|
80
|
+
private getBehindFiveElement;
|
|
79
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CSS3DRender as
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var E = (r, n, t) => n in r ? b(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var l = (r, n, t) => (E(r, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import { CSS3DRender as R } from "./CSS3DRender.js";
|
|
5
5
|
import "three";
|
|
6
6
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
7
7
|
import "../shared-utils/Subscribe.js";
|
|
@@ -9,40 +9,43 @@ import "./utils/evenNumber.js";
|
|
|
9
9
|
import "./utils/positionToVector3.js";
|
|
10
10
|
import "./utils/CSS3DObjectPlus.js";
|
|
11
11
|
import "./utils/centerPoint.js";
|
|
12
|
-
const
|
|
13
|
-
class
|
|
12
|
+
const C = "v2.0.1", f = `CSS3DRenderPlugin@${C}`;
|
|
13
|
+
class N extends R {
|
|
14
14
|
constructor(t) {
|
|
15
15
|
super();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
l(this, "five");
|
|
17
|
+
l(this, "behindFiveContainer");
|
|
18
|
+
l(this, "staticPrefix", "//vrlab-static.ljcdn.com");
|
|
19
|
+
l(this, "create3DDomContainer", (t, e) => {
|
|
19
20
|
if (this.state.disposed)
|
|
20
21
|
return;
|
|
21
|
-
const
|
|
22
|
+
const i = (() => {
|
|
22
23
|
var v;
|
|
23
|
-
(e == null ? void 0 : e.dpr) !== void 0 && console.warn(`${
|
|
24
|
-
const
|
|
24
|
+
(e == null ? void 0 : e.dpr) !== void 0 && console.warn(`${f}: please use "config.devicePixelRatio" replace "config.dpr"`);
|
|
25
|
+
const a = {
|
|
25
26
|
ratio: 216e-5,
|
|
26
27
|
devicePixelRatio: (v = e == null ? void 0 : e.dpr) != null ? v : 1,
|
|
27
28
|
mode: "front",
|
|
28
29
|
autoRender: !0
|
|
29
30
|
};
|
|
30
|
-
return Object.assign(
|
|
31
|
-
})(),
|
|
32
|
-
if (!
|
|
33
|
-
console.error(`${
|
|
31
|
+
return Object.assign(a, e, (e == null ? void 0 : e.mode) === "behind" ? { scene: this.five.scene } : void 0);
|
|
32
|
+
})(), o = this.five.getElement();
|
|
33
|
+
if (!o) {
|
|
34
|
+
console.error(`${f}: five.getElement() is ${o}`);
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
const { autoRender:
|
|
37
|
-
this.
|
|
38
|
-
const
|
|
39
|
-
|
|
37
|
+
const { autoRender: d, mode: s } = i, c = s === "front" ? o.parentElement : i.behindFiveContainer;
|
|
38
|
+
this.setContainer(c || document.body, "front");
|
|
39
|
+
const p = this.getBehindFiveElement();
|
|
40
|
+
p && this.setContainer(p, "behind"), this.appendToElement(c || document.body, s);
|
|
41
|
+
const m = this.create3DElement(this.five.camera, t, { ...i, autoRender: !1 });
|
|
42
|
+
if (!m)
|
|
40
43
|
return;
|
|
41
|
-
const
|
|
42
|
-
var
|
|
43
|
-
s === "front" &&
|
|
44
|
+
const u = m.render, h = () => {
|
|
45
|
+
var a;
|
|
46
|
+
s === "front" && u(), s === "behind" && ((a = this.five.model) != null && a.loaded ? u() : this.five.once("modelLoaded", () => u()));
|
|
44
47
|
};
|
|
45
|
-
return
|
|
48
|
+
return d && h(), { ...m, render: d ? void 0 : h };
|
|
46
49
|
});
|
|
47
50
|
this.five = t;
|
|
48
51
|
}
|
|
@@ -53,8 +56,26 @@ class A extends E {
|
|
|
53
56
|
const e = super.setState(...t);
|
|
54
57
|
return this.five.needsRender = !0, e;
|
|
55
58
|
}
|
|
59
|
+
getBehindFiveElement() {
|
|
60
|
+
var s;
|
|
61
|
+
const { behindFiveContainer: t } = this;
|
|
62
|
+
if (t)
|
|
63
|
+
return t;
|
|
64
|
+
const e = document.createElement("div");
|
|
65
|
+
e.style.position = "absolute", e.style.pointerEvents = "none", e.style.top = "0", e.style.left = "0", e.style.width = "100%", e.style.height = "100%", this.behindFiveContainer = e;
|
|
66
|
+
const i = this.five.getElement();
|
|
67
|
+
if (!i)
|
|
68
|
+
return;
|
|
69
|
+
const o = (s = i == null ? void 0 : i.style.position) != null ? s : getComputedStyle(i);
|
|
70
|
+
(!o || o === "static") && console.warn(
|
|
71
|
+
"if you want to use css3DRenderPlugin behind mode, five element position is static, please set position to relative or absolute"
|
|
72
|
+
);
|
|
73
|
+
const d = i == null ? void 0 : i.parentElement;
|
|
74
|
+
if (d)
|
|
75
|
+
return d.insertBefore(e, i), e;
|
|
76
|
+
}
|
|
56
77
|
}
|
|
57
78
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
f as PLUGIN_NAME,
|
|
80
|
+
N as default
|
|
60
81
|
};
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer';
|
|
2
|
-
import { Vector3 } from 'three';
|
|
2
|
+
import { Matrix4, Quaternion, Vector3 } from 'three';
|
|
3
|
+
import { Subscribe } from '../../shared-utils/Subscribe';
|
|
4
|
+
import type * as THREE from 'three';
|
|
3
5
|
export declare const MinRatio = 0.00216;
|
|
4
6
|
export declare const DefaultRatio = 0.003;
|
|
5
|
-
export declare
|
|
7
|
+
export declare type Mode = 'front' | 'behind';
|
|
8
|
+
export declare type CornerPoints = [Vector3, Vector3, Vector3, Vector3];
|
|
9
|
+
export declare type CSS3DRenderEventMap = {
|
|
10
|
+
applyMatrix4: (matrix: Matrix4) => void;
|
|
11
|
+
applyQuaternion: (quaternion: Quaternion) => void;
|
|
12
|
+
applyScaleMatrix4: (matrix: Matrix4) => void;
|
|
13
|
+
changeMode: <T extends Mode = Mode>(mode: T, prevMode: Mode, scene: T extends 'behind' ? THREE.Scene : undefined) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare class CSS3DObjectPlus<T extends HTMLElement = HTMLElement> extends CSS3DObject {
|
|
6
16
|
version: string;
|
|
7
17
|
width: number;
|
|
8
18
|
height: number;
|
|
9
19
|
domWidthPx: number;
|
|
10
20
|
domHeightPx: number;
|
|
11
|
-
cornerPoints:
|
|
21
|
+
cornerPoints: CornerPoints;
|
|
12
22
|
ratio: number;
|
|
13
23
|
container: T;
|
|
14
24
|
centerPosition: Vector3;
|
|
15
|
-
|
|
25
|
+
mode: 'front' | 'behind';
|
|
26
|
+
readonly hooks: Subscribe<CSS3DRenderEventMap>;
|
|
27
|
+
readonly isCSS3DObjectPlus: true;
|
|
28
|
+
constructor(container: T, cornerPoints: CornerPoints, ratio?: number, dpr?: number, mode?: Mode);
|
|
29
|
+
changeMode(mode: 'front'): void;
|
|
30
|
+
changeMode(mode: 'behind', scene: THREE.Scene): void;
|
|
31
|
+
applyScaleMatrix4(matrix: Matrix4): void;
|
|
32
|
+
applyMatrix4(matrix: Matrix4): void;
|
|
33
|
+
applyQuaternion(quaternion: Quaternion): this;
|
|
16
34
|
}
|