@realsee/dnalogel 2.0.5-alpha.4 → 2.0.5-alpha.6

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.
Files changed (94) hide show
  1. package/dist/index.cjs.js +14 -14
  2. package/dist/index.es.js +1044 -1042
  3. package/dist/index.js +1044 -1042
  4. package/dist/index.umd.js +15 -15
  5. package/docs/classes/CruisePluginController.html +14 -14
  6. package/docs/classes/Magnifier.html +4 -4
  7. package/docs/classes/ModelRoomLabelController.html +4 -4
  8. package/docs/classes/PaintBrush.html +3 -3
  9. package/docs/enums/CameraMovementEffect.html +2 -2
  10. package/docs/enums/DIRECTION.html +1 -1
  11. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  12. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  13. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  14. package/docs/enums/PaintBrushTypeEnum.html +1 -1
  15. package/docs/enums/Rotation.html +2 -2
  16. package/docs/index.html +1 -1
  17. package/docs/interfaces/CSS3DRenderPluginEventMap.html +2 -2
  18. package/docs/interfaces/CSS3DRenderPluginState.html +2 -2
  19. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  20. package/docs/interfaces/FloorplanBounding.html +4 -4
  21. package/docs/interfaces/FloorplanData.html +2 -2
  22. package/docs/interfaces/FloorplanEntrance.html +7 -7
  23. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  24. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  25. package/docs/interfaces/FloorplanFloorData.html +2 -2
  26. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  27. package/docs/interfaces/FloorplanObserver.html +2 -2
  28. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  29. package/docs/interfaces/FloorplanPosition.html +2 -2
  30. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  31. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  32. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  33. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  34. package/docs/interfaces/FloorplanServerData.html +2 -2
  35. package/docs/interfaces/FloorplanServerDoorItem.html +1 -1
  36. package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
  37. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  38. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  39. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  40. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  41. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  42. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  43. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  44. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  45. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  46. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  47. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  48. package/docs/interfaces/LineJson.html +1 -1
  49. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  50. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  51. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  52. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  53. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  54. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  55. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  56. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  57. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  58. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  59. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  60. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  61. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  62. package/docs/interfaces/OpenParameter.html +2 -2
  63. package/docs/interfaces/PaintBrushAction.html +7 -7
  64. package/docs/interfaces/PaintBrushConfigs.html +1 -1
  65. package/docs/interfaces/PaintBrushState.html +1 -1
  66. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  67. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  68. package/docs/interfaces/PanoMeasureParameterType.html +2 -2
  69. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  70. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  71. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  72. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  73. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  74. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  75. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  76. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  77. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  78. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  79. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  81. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  82. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  83. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  85. package/docs/interfaces/Point.html +1 -1
  86. package/docs/interfaces/PointJson.html +1 -1
  87. package/docs/interfaces/Room.html +1 -1
  88. package/docs/interfaces/RoomInfo.html +1 -1
  89. package/docs/interfaces/RoomLabel.html +7 -7
  90. package/docs/interfaces/RoomRules.html +1 -1
  91. package/docs/interfaces/Rooms.html +1 -1
  92. package/docs/modules.html +17 -17
  93. package/libs/ModelTVVideoPlugin/Plugin.js +84 -82
  94. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import * as d from "three";
2
- import { parseModelTVVideoPoints as I } from "./utils/parseData.js";
3
- import { CSS3DRenderPlugin as z } from "../CSS3DRenderPlugin/index.js";
1
+ import * as c from "three";
2
+ import { parseModelTVVideoPoints as z } from "./utils/parseData.js";
3
+ import { CSS3DRenderPlugin as O } from "../CSS3DRenderPlugin/index.js";
4
4
  import "./typings.js";
5
5
  import "../CSS3DRenderPlugin/Controller.js";
6
6
  import "../CSS3DRenderPlugin/CSS3DRender.js";
@@ -10,30 +10,32 @@ 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 = (i, { videoElement: E }) => {
13
+ const W = (d, { videoElement: M }) => {
14
14
  const t = {
15
15
  videoMeshes: [],
16
16
  videoTextureEnabled: !1,
17
17
  videoSource: "",
18
18
  rectPoints: [],
19
19
  enabled: !1,
20
- videoElement: E
21
- }, f = z(i), y = /* @__PURE__ */ new Map(), M = (e) => {
20
+ videoElement: M
21
+ }, f = O(d), p = /* @__PURE__ */ new Map(), A = (e) => {
22
22
  t.videoTexture && (t.videoTexture.image.muted = e);
23
- }, A = () => t.videoTexture ? t.videoTexture.image.muted : !0, x = () => {
23
+ }, R = () => 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) => i.scene.add(o));
26
+ t.enabled = !0, t.videoMeshes = F(), t.videoMeshes.forEach((r) => d.scene.add(r)), p.forEach((r) => {
27
+ r.enable();
28
+ });
27
29
  const e = () => {
28
30
  if (!t.videoTexture)
29
31
  return;
30
- const o = () => {
32
+ const r = () => {
31
33
  var s;
32
- !t.videoTexture || ((s = t.videoTexture) == null || s.image.removeEventListener("timeupdate", o), t.videoTextureEnabled = !0, t.videoMeshes.forEach((n) => {
34
+ !t.videoTexture || ((s = t.videoTexture) == null || s.image.removeEventListener("timeupdate", r), t.videoTextureEnabled = !0, t.videoMeshes.forEach((n) => {
33
35
  n.material.map !== t.videoTexture && (n.material.map = t.videoTexture);
34
- }), i.needsRender = !0);
36
+ }), d.needsRender = !0);
35
37
  };
36
- t.videoTexture.image.addEventListener("timeupdate", o), t.videoTexture && t.videoMeshes.length && (t.videoTexture.image.play(), t.videoTexture.image.onplay = () => {
38
+ t.videoTexture.image.addEventListener("timeupdate", r), t.videoTexture && t.videoMeshes.length && (t.videoTexture.image.play(), t.videoTexture.image.onplay = () => {
37
39
  f.hide();
38
40
  }, t.videoTexture.image.onpause = () => {
39
41
  f.show();
@@ -41,118 +43,118 @@ const q = (i, { videoElement: E }) => {
41
43
  t.videoTexture.image.muted = !1, t.videoTexture.image.play();
42
44
  });
43
45
  };
44
- if (i.model.loaded)
46
+ if (d.model.loaded)
45
47
  e();
46
48
  else
47
- return i.once("modelLoaded", () => e());
49
+ return d.once("modelLoaded", () => e());
48
50
  b();
49
51
  }, T = () => {
50
52
  !t.enabled || (t.enabled = !1, t.videoMeshes.forEach((e) => {
51
- e.geometry.dispose(), e.material.dispose(), i.scene.remove(e), t.videoTexture && t.videoTexture.image.pause();
52
- }), t.videoMeshes = [], i.needsRender = !0);
53
- }, R = () => t.rectPoints.map((e, o) => {
54
- const s = new d.BufferGeometry(), n = 128, a = [];
53
+ e.geometry.dispose(), e.material.dispose(), d.scene.remove(e), t.videoTexture && t.videoTexture.image.pause();
54
+ }), p.forEach((e) => {
55
+ e.disable();
56
+ }), t.videoMeshes = [], d.needsRender = !0);
57
+ }, F = () => t.rectPoints.map((e, r) => {
58
+ const s = new c.BufferGeometry(), n = 128, a = [];
55
59
  a.push(...e[0].toArray());
56
- for (let r = 1; r < n; r++)
60
+ for (let o = 1; o < n; o++)
57
61
  a.push(
58
- e[0].x + (e[1].x - e[0].x) * r / n,
59
- e[0].y + (e[1].y - e[0].y) * r / n,
60
- e[0].z + (e[1].z - e[0].z) * r / n
62
+ e[0].x + (e[1].x - e[0].x) * o / n,
63
+ e[0].y + (e[1].y - e[0].y) * o / n,
64
+ e[0].z + (e[1].z - e[0].z) * o / n
61
65
  );
62
66
  a.push(...e[1].toArray()), a.push(...e[2].toArray());
63
- for (let r = 1; r < n; r++)
67
+ for (let o = 1; o < n; o++)
64
68
  a.push(
65
- e[2].x + (e[3].x - e[2].x) * r / n,
66
- e[2].y + (e[3].y - e[2].y) * r / n,
67
- e[2].z + (e[3].z - e[2].z) * r / n
69
+ e[2].x + (e[3].x - e[2].x) * o / n,
70
+ e[2].y + (e[3].y - e[2].y) * o / n,
71
+ e[2].z + (e[3].z - e[2].z) * o / n
68
72
  );
69
73
  a.push(...e[3].toArray());
70
- const c = [];
71
- c.push(0, 1);
72
- for (let r = 1; r < n; r++)
73
- c.push(0, 1 - r / n);
74
- c.push(0, 0), c.push(1, 0);
75
- for (let r = 1; r < n; r++)
76
- c.push(1, r / n);
77
- c.push(1, 1);
74
+ const i = [];
75
+ i.push(0, 1);
76
+ for (let o = 1; o < n; o++)
77
+ i.push(0, 1 - o / n);
78
+ i.push(0, 0), i.push(1, 0);
79
+ for (let o = 1; o < n; o++)
80
+ i.push(1, o / n);
81
+ i.push(1, 1);
78
82
  const u = [];
79
- for (let r = 0; r < n; r++)
80
- u.push(r, r + 1, n * 2 - r, r, n * 2 - r, n * 2 + 1 - r);
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({
83
+ for (let o = 0; o < n; o++)
84
+ u.push(o, o + 1, n * 2 - o, o, n * 2 - o, n * 2 + 1 - o);
85
+ s.setAttribute("position", new c.BufferAttribute(new Float32Array(a), 3)), s.setAttribute("uv", new c.BufferAttribute(new Float32Array(i), 2)), s.setIndex(new c.BufferAttribute(new Uint32Array(u), 1));
86
+ const m = new c.MeshBasicMaterial({
83
87
  map: t.videoTextureEnabled ? t.videoTexture : t.imageTexture,
84
- side: d.DoubleSide
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);
88
- if (p != null && p.container) {
89
- const r = document.createElement("div");
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);
91
- const h = document.createElement("img");
92
- h.src = "//vrlab-static.ljcdn.com/release/web/play.2ada5b6f.png", h.style.width = "200px", h.style.pointerEvents = "auto", h.onclick = () => {
88
+ side: c.DoubleSide
89
+ }), l = new c.Mesh(s, m);
90
+ l.renderOrder = 1, l.name = `ModelTVVideoPlugin-${r}-${performance.now()}`;
91
+ const I = [e[1], e[2], e[3], e[0]], h = f.create3DDomContainer(I);
92
+ if (h != null && h.container) {
93
+ const o = document.createElement("div");
94
+ o.classList.add("play-icon"), o.style.width = "100%", o.style.height = "100%", o.style.display = "flex", o.style.justifyContent = "center", o.style.alignItems = "center", o.style.pointerEvents = "none", h.container.appendChild(o);
95
+ const y = document.createElement("img");
96
+ y.src = "//vrlab-static.ljcdn.com/release/web/play.2ada5b6f.png", y.style.width = "200px", y.style.pointerEvents = "auto", y.onclick = () => {
93
97
  t.videoTexture.image.muted = !1, t.videoTexture.image.play();
94
- }, r.appendChild(h), y.set(l, p);
98
+ }, o.appendChild(y), p.set(l, h);
95
99
  }
96
100
  return l;
97
- }), F = (e) => {
98
- const o = new d.TextureLoader().load(e);
99
- return o.minFilter = d.LinearFilter, o.magFilter = d.LinearFilter, o.format = d.RGBFormat, o;
100
- }, P = (e, o) => new Promise((s, n) => {
101
+ }), P = (e) => {
102
+ const r = new c.TextureLoader().load(e);
103
+ return r.minFilter = c.LinearFilter, r.magFilter = c.LinearFilter, r.format = c.RGBFormat, r;
104
+ }, L = (e, r) => new Promise((s, n) => {
101
105
  const a = new XMLHttpRequest();
102
106
  a.onreadystatechange = () => {
103
107
  if (a.readyState == 4)
104
108
  if (a.status == 200) {
105
- const c = window.URL || window.webkitURL;
106
- o = o || document.createElement("video"), o.crossOrigin = "anonymous", o.muted = !0, o.loop = !0, o.playsInline = !0, o.src = c.createObjectURL(a.response);
107
- const u = new d.VideoTexture(o);
108
- u.minFilter = d.LinearFilter, u.magFilter = d.LinearFilter, u.format = d.RGBFormat, s(Object.assign(u, { videoSource: e }));
109
+ const i = window.URL || window.webkitURL;
110
+ r = r || document.createElement("video"), r.crossOrigin = "anonymous", r.muted = !0, r.loop = !0, r.playsInline = !0, r.src = i.createObjectURL(a.response);
111
+ const u = new c.VideoTexture(r);
112
+ u.minFilter = c.LinearFilter, u.magFilter = c.LinearFilter, u.format = c.RGBFormat, s(Object.assign(u, { videoSource: e }));
109
113
  } else
110
114
  n(new Error("Video download Error: " + a.status));
111
- }, a.onerror = (c) => n(c), a.open("GET", e), a.responseType = "blob", a.send();
112
- }), L = async (e, o) => {
115
+ }, a.onerror = (i) => n(i), a.open("GET", e), a.responseType = "blob", a.send();
116
+ }), V = async (e, r) => {
117
+ p.forEach((i) => i.dispose()), p.clear();
113
118
  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();
119
+ t.videoSource = s, t.rectPoints = z(a).map((i) => i.map(({ x: u, y: m, z: l }) => new c.Vector3(u, m, l))), t.imageTexture = P(n), r && (t.videoElement = r), t.videoTexture = await L(t.videoSource, t.videoElement), t.enabled = !!e.enable, t.enabled && x();
115
120
  }, g = (e) => {
116
121
  if (!t.enabled)
117
122
  return;
118
- const o = t.videoMeshes;
119
- if (!(!o || e.intersectObjects(o).length === 0))
123
+ const r = t.videoMeshes;
124
+ if (!(!r || e.intersectObjects(r).length === 0))
120
125
  return t.videoTexture && (t.videoTexture.image.paused || t.videoTexture.image.pause()), !1;
121
126
  }, v = (e) => {
122
- e === "Floorplan" ? f.hide() : t.videoTexture.image.paused ? f.show() : f.hide();
127
+ var r;
128
+ e === "Floorplan" ? f.hide() : (r = t.videoTexture) != null && r.image.paused ? f.show() : f.hide();
123
129
  }, b = () => {
124
130
  if (!t.enabled)
125
131
  return;
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();
130
- }), !A()) {
131
- const o = t.rectPoints.find((s) => {
132
+ const e = d.camera.position;
133
+ if (p.forEach((r, s) => {
134
+ const n = r.css3DObject.position.clone(), a = n.clone().sub(e).normalize(), i = new c.Raycaster(e, a), u = d.model.intersectRaycaster(i)[0], m = n.distanceTo(e), l = 0.01;
135
+ u && u.distance + l < m ? r.hide() : r.show();
136
+ }), !R()) {
137
+ const r = t.rectPoints.find((s) => {
132
138
  const n = s[0].clone().add(s[1]).add(s[2]).add(s[3]).divideScalar(4);
133
139
  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);
140
+ const i = a.distanceTo(e), u = new c.Raycaster(e, a.clone().sub(e).normalize()), m = d.model.intersectRaycaster(u)[0], l = 0.01;
141
+ return !(m && m.distance + l < i);
136
142
  }).length >= 2;
137
143
  });
138
- (!o || o.length === 0) && M(!0);
144
+ (!r || r.length === 0) && A(!0);
139
145
  }
140
146
  }, w = () => {
141
147
  b();
142
- }, V = () => {
143
- T(), t.videoTexture = void 0, i.off("modeChange", v), i.off("wantsTapGesture", g), i.off("panoArrived", w), i.off("renderFrame", () => {
144
- t.videoMeshes.forEach((e) => {
145
- e && (e.needsRender = !0);
146
- });
147
- }), y.clear();
148
- };
149
- return i.on("modeChange", v), i.on("wantsTapGesture", g), i.on("panoArrived", w), i.on("renderFrame", () => {
148
+ }, E = () => {
150
149
  t.videoMeshes.forEach((e) => {
151
150
  e && (e.needsRender = !0);
152
151
  });
153
- }), { enable: x, disable: T, load: L, dispose: V, state: t, css3DRenderPlugin: f };
152
+ }, S = () => {
153
+ T(), t.videoTexture = void 0, d.off("modeChange", v), d.off("wantsTapGesture", g), d.off("panoArrived", w), d.off("renderFrame", E), p.clear();
154
+ };
155
+ return d.on("modeChange", v), d.on("wantsTapGesture", g), d.on("panoArrived", w), d.on("renderFrame", E), { enable: x, disable: T, load: V, dispose: S, state: t, css3DRenderPlugin: f };
154
156
  };
155
157
  export {
156
- q as ModelTVVideoPlugin,
157
- q as default
158
+ W as ModelTVVideoPlugin,
159
+ W as default
158
160
  };
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.4",
12
+ "version": "2.0.5-alpha.6",
13
13
  "license": "SEE LICENSE IN TERMS.txt",
14
14
  "scripts": {
15
15
  "build": "sh bin/build-production.sh",