@realsee/dnalogel 2.0.5-alpha.2 → 2.0.5-alpha.4
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 +18 -18
- package/dist/index.es.js +1191 -1190
- package/dist/index.js +1191 -1190
- package/dist/index.umd.js +18 -18
- package/docs/classes/CruisePluginController.html +14 -14
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/classes/PaintBrush.html +3 -3
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.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/PaintBrushTypeEnum.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/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/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/modules.html +17 -17
- package/libs/ModelTVVideoPlugin/Plugin.js +49 -48
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as d from "three";
|
|
2
|
-
import { parseModelTVVideoPoints as
|
|
3
|
-
import { CSS3DRenderPlugin as
|
|
2
|
+
import { parseModelTVVideoPoints as I } from "./utils/parseData.js";
|
|
3
|
+
import { CSS3DRenderPlugin as z } from "../CSS3DRenderPlugin/index.js";
|
|
4
4
|
import "./typings.js";
|
|
5
5
|
import "../CSS3DRenderPlugin/Controller.js";
|
|
6
6
|
import "../CSS3DRenderPlugin/CSS3DRender.js";
|
|
@@ -10,7 +10,7 @@ import "../CSS3DRenderPlugin/utils/evenNumber.js";
|
|
|
10
10
|
import "../CSS3DRenderPlugin/utils/positionToVector3.js";
|
|
11
11
|
import "../CSS3DRenderPlugin/utils/CSS3DObjectPlus.js";
|
|
12
12
|
import "../CSS3DRenderPlugin/utils/centerPoint.js";
|
|
13
|
-
const q = (
|
|
13
|
+
const q = (i, { videoElement: E }) => {
|
|
14
14
|
const t = {
|
|
15
15
|
videoMeshes: [],
|
|
16
16
|
videoTextureEnabled: !1,
|
|
@@ -18,39 +18,40 @@ const q = (s, { videoElement: E }) => {
|
|
|
18
18
|
rectPoints: [],
|
|
19
19
|
enabled: !1,
|
|
20
20
|
videoElement: E
|
|
21
|
-
},
|
|
21
|
+
}, f = z(i), y = /* @__PURE__ */ new Map(), M = (e) => {
|
|
22
22
|
t.videoTexture && (t.videoTexture.image.muted = e);
|
|
23
|
-
}, A = () => t.videoTexture ? t.videoTexture.image.muted : !0,
|
|
23
|
+
}, A = () => t.videoTexture ? t.videoTexture.image.muted : !0, x = () => {
|
|
24
24
|
if (t.enabled || !t.videoTexture)
|
|
25
25
|
return;
|
|
26
|
-
t.enabled = !0, t.videoMeshes = R(), t.videoMeshes.forEach((o) =>
|
|
26
|
+
t.enabled = !0, t.videoMeshes = R(), t.videoMeshes.forEach((o) => i.scene.add(o));
|
|
27
27
|
const e = () => {
|
|
28
28
|
if (!t.videoTexture)
|
|
29
29
|
return;
|
|
30
30
|
const o = () => {
|
|
31
|
-
var
|
|
32
|
-
!t.videoTexture || ((
|
|
31
|
+
var s;
|
|
32
|
+
!t.videoTexture || ((s = t.videoTexture) == null || s.image.removeEventListener("timeupdate", o), t.videoTextureEnabled = !0, t.videoMeshes.forEach((n) => {
|
|
33
33
|
n.material.map !== t.videoTexture && (n.material.map = t.videoTexture);
|
|
34
|
-
}),
|
|
34
|
+
}), i.needsRender = !0);
|
|
35
35
|
};
|
|
36
36
|
t.videoTexture.image.addEventListener("timeupdate", o), t.videoTexture && t.videoMeshes.length && (t.videoTexture.image.play(), t.videoTexture.image.onplay = () => {
|
|
37
|
-
|
|
37
|
+
f.hide();
|
|
38
38
|
}, t.videoTexture.image.onpause = () => {
|
|
39
|
-
|
|
39
|
+
f.show();
|
|
40
40
|
}, t.videoTexture.image.onclick = () => {
|
|
41
41
|
t.videoTexture.image.muted = !1, t.videoTexture.image.play();
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
if (
|
|
44
|
+
if (i.model.loaded)
|
|
45
45
|
e();
|
|
46
46
|
else
|
|
47
|
-
return
|
|
48
|
-
|
|
47
|
+
return i.once("modelLoaded", () => e());
|
|
48
|
+
b();
|
|
49
|
+
}, T = () => {
|
|
49
50
|
!t.enabled || (t.enabled = !1, t.videoMeshes.forEach((e) => {
|
|
50
|
-
e.geometry.dispose(), e.material.dispose(),
|
|
51
|
-
}), t.videoMeshes = [],
|
|
51
|
+
e.geometry.dispose(), e.material.dispose(), i.scene.remove(e), t.videoTexture && t.videoTexture.image.pause();
|
|
52
|
+
}), t.videoMeshes = [], i.needsRender = !0);
|
|
52
53
|
}, R = () => t.rectPoints.map((e, o) => {
|
|
53
|
-
const
|
|
54
|
+
const s = new d.BufferGeometry(), n = 128, a = [];
|
|
54
55
|
a.push(...e[0].toArray());
|
|
55
56
|
for (let r = 1; r < n; r++)
|
|
56
57
|
a.push(
|
|
@@ -77,28 +78,26 @@ const q = (s, { videoElement: E }) => {
|
|
|
77
78
|
const u = [];
|
|
78
79
|
for (let r = 0; r < n; r++)
|
|
79
80
|
u.push(r, r + 1, n * 2 - r, r, n * 2 - r, n * 2 + 1 - r);
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
s.scene.add(l);
|
|
83
|
-
const f = new d.MeshBasicMaterial({
|
|
81
|
+
s.setAttribute("position", new d.BufferAttribute(new Float32Array(a), 3)), s.setAttribute("uv", new d.BufferAttribute(new Float32Array(c), 2)), s.setIndex(new d.BufferAttribute(new Uint32Array(u), 1));
|
|
82
|
+
const m = new d.MeshBasicMaterial({
|
|
84
83
|
map: t.videoTextureEnabled ? t.videoTexture : t.imageTexture,
|
|
85
84
|
side: d.DoubleSide
|
|
86
|
-
}),
|
|
87
|
-
|
|
88
|
-
const S = [e[1], e[2], e[3], e[0]], p =
|
|
85
|
+
}), l = new d.Mesh(s, m);
|
|
86
|
+
l.renderOrder = 1, l.name = `ModelTVVideoPlugin-${o}-${performance.now()}`;
|
|
87
|
+
const S = [e[1], e[2], e[3], e[0]], p = f.create3DDomContainer(S);
|
|
89
88
|
if (p != null && p.container) {
|
|
90
89
|
const r = document.createElement("div");
|
|
91
90
|
r.classList.add("play-icon"), r.style.width = "100%", r.style.height = "100%", r.style.display = "flex", r.style.justifyContent = "center", r.style.alignItems = "center", r.style.pointerEvents = "none", p.container.appendChild(r);
|
|
92
91
|
const h = document.createElement("img");
|
|
93
92
|
h.src = "//vrlab-static.ljcdn.com/release/web/play.2ada5b6f.png", h.style.width = "200px", h.style.pointerEvents = "auto", h.onclick = () => {
|
|
94
93
|
t.videoTexture.image.muted = !1, t.videoTexture.image.play();
|
|
95
|
-
}, r.appendChild(h), y.set(
|
|
94
|
+
}, r.appendChild(h), y.set(l, p);
|
|
96
95
|
}
|
|
97
|
-
return
|
|
96
|
+
return l;
|
|
98
97
|
}), F = (e) => {
|
|
99
98
|
const o = new d.TextureLoader().load(e);
|
|
100
99
|
return o.minFilter = d.LinearFilter, o.magFilter = d.LinearFilter, o.format = d.RGBFormat, o;
|
|
101
|
-
},
|
|
100
|
+
}, P = (e, o) => new Promise((s, n) => {
|
|
102
101
|
const a = new XMLHttpRequest();
|
|
103
102
|
a.onreadystatechange = () => {
|
|
104
103
|
if (a.readyState == 4)
|
|
@@ -106,50 +105,52 @@ const q = (s, { videoElement: E }) => {
|
|
|
106
105
|
const c = window.URL || window.webkitURL;
|
|
107
106
|
o = o || document.createElement("video"), o.crossOrigin = "anonymous", o.muted = !0, o.loop = !0, o.playsInline = !0, o.src = c.createObjectURL(a.response);
|
|
108
107
|
const u = new d.VideoTexture(o);
|
|
109
|
-
u.minFilter = d.LinearFilter, u.magFilter = d.LinearFilter, u.format = d.RGBFormat,
|
|
108
|
+
u.minFilter = d.LinearFilter, u.magFilter = d.LinearFilter, u.format = d.RGBFormat, s(Object.assign(u, { videoSource: e }));
|
|
110
109
|
} else
|
|
111
110
|
n(new Error("Video download Error: " + a.status));
|
|
112
111
|
}, a.onerror = (c) => n(c), a.open("GET", e), a.responseType = "blob", a.send();
|
|
113
|
-
}),
|
|
114
|
-
const { video_src:
|
|
115
|
-
t.videoSource =
|
|
116
|
-
},
|
|
112
|
+
}), L = async (e, o) => {
|
|
113
|
+
const { video_src: s, video_poster_src: n, points: a } = e;
|
|
114
|
+
t.videoSource = s, t.rectPoints = I(a).map((c) => c.map(({ x: u, y: m, z: l }) => new d.Vector3(u, m, l))), t.imageTexture = F(n), o && (t.videoElement = o), t.videoTexture = await P(t.videoSource, t.videoElement), t.enabled = !!e.enable, t.enabled && x();
|
|
115
|
+
}, g = (e) => {
|
|
117
116
|
if (!t.enabled)
|
|
118
117
|
return;
|
|
119
118
|
const o = t.videoMeshes;
|
|
120
119
|
if (!(!o || e.intersectObjects(o).length === 0))
|
|
121
120
|
return t.videoTexture && (t.videoTexture.image.paused || t.videoTexture.image.pause()), !1;
|
|
122
|
-
},
|
|
123
|
-
e === "Floorplan"
|
|
124
|
-
},
|
|
121
|
+
}, v = (e) => {
|
|
122
|
+
e === "Floorplan" ? f.hide() : t.videoTexture.image.paused ? f.show() : f.hide();
|
|
123
|
+
}, b = () => {
|
|
125
124
|
if (!t.enabled)
|
|
126
125
|
return;
|
|
127
|
-
const e =
|
|
128
|
-
if (y.forEach((o,
|
|
129
|
-
const n = o.css3DObject.position.clone(), a = n.clone().sub(e).normalize(), c = new d.Raycaster(e, a), u =
|
|
130
|
-
u && u.distance +
|
|
126
|
+
const e = i.camera.position;
|
|
127
|
+
if (y.forEach((o, s) => {
|
|
128
|
+
const n = o.css3DObject.position.clone(), a = n.clone().sub(e).normalize(), c = new d.Raycaster(e, a), u = i.model.intersectRaycaster(c)[0], m = n.distanceTo(e), l = 0.01;
|
|
129
|
+
u && u.distance + l < m ? o.hide() : o.show();
|
|
131
130
|
}), !A()) {
|
|
132
|
-
const o = t.rectPoints.find((
|
|
133
|
-
const n =
|
|
134
|
-
return
|
|
135
|
-
const c = a.distanceTo(e), u = new d.Raycaster(e, a.clone().sub(e).normalize()),
|
|
136
|
-
return !(
|
|
131
|
+
const o = t.rectPoints.find((s) => {
|
|
132
|
+
const n = s[0].clone().add(s[1]).add(s[2]).add(s[3]).divideScalar(4);
|
|
133
|
+
return s.map((a) => a.clone().add(n).divideScalar(2)).filter((a) => {
|
|
134
|
+
const c = a.distanceTo(e), u = new d.Raycaster(e, a.clone().sub(e).normalize()), m = i.model.intersectRaycaster(u)[0], l = 0.01;
|
|
135
|
+
return !(m && m.distance + l < c);
|
|
137
136
|
}).length >= 2;
|
|
138
137
|
});
|
|
139
138
|
(!o || o.length === 0) && M(!0);
|
|
140
139
|
}
|
|
140
|
+
}, w = () => {
|
|
141
|
+
b();
|
|
141
142
|
}, V = () => {
|
|
142
|
-
|
|
143
|
+
T(), t.videoTexture = void 0, i.off("modeChange", v), i.off("wantsTapGesture", g), i.off("panoArrived", w), i.off("renderFrame", () => {
|
|
143
144
|
t.videoMeshes.forEach((e) => {
|
|
144
145
|
e && (e.needsRender = !0);
|
|
145
146
|
});
|
|
146
|
-
});
|
|
147
|
+
}), y.clear();
|
|
147
148
|
};
|
|
148
|
-
return
|
|
149
|
+
return i.on("modeChange", v), i.on("wantsTapGesture", g), i.on("panoArrived", w), i.on("renderFrame", () => {
|
|
149
150
|
t.videoMeshes.forEach((e) => {
|
|
150
151
|
e && (e.needsRender = !0);
|
|
151
152
|
});
|
|
152
|
-
}), { enable:
|
|
153
|
+
}), { enable: x, disable: T, load: L, dispose: V, state: t, css3DRenderPlugin: f };
|
|
153
154
|
};
|
|
154
155
|
export {
|
|
155
156
|
q as ModelTVVideoPlugin,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
10
10
|
"description": "如视 VR 看房插件合集",
|
|
11
11
|
"private": false,
|
|
12
|
-
"version": "2.0.5-alpha.
|
|
12
|
+
"version": "2.0.5-alpha.4",
|
|
13
13
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "sh bin/build-production.sh",
|