@realsee/dnalogel 3.10.0 → 3.10.2
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/AreaMakerPlugin/Controller.d.ts +0 -2
- package/dist/AreaMakerPlugin/utils/Item.d.ts +1 -0
- package/dist/PanoTagPlugin/utils/index.d.ts +0 -1
- package/dist/index.cjs.js +35 -35
- package/dist/index.js +753 -752
- package/dist/index.umd.js +34 -34
- package/libs/AreaMakerPlugin/Controller.d.ts +0 -2
- package/libs/AreaMakerPlugin/Controller.js +58 -59
- package/libs/AreaMakerPlugin/index.js +3 -2
- package/libs/AreaMakerPlugin/utils/Item.d.ts +1 -0
- package/libs/AreaMakerPlugin/utils/Item.js +35 -32
- package/libs/CruisePlugin/Work.js +1 -1
- package/libs/CruisePlugin/index.js +1 -1
- package/libs/GuideLinePlugin/Controller.js +1 -1
- package/libs/GuideLinePlugin/GuideLineItem.js +1 -1
- package/libs/GuideLinePlugin/GuideLineModeItem.js +1 -1
- package/libs/GuideLinePlugin/index.js +1 -1
- package/libs/PanoTagPlugin/controller/TagComputer.js +9 -8
- package/libs/PanoTagPlugin/controller/index.js +1 -1
- package/libs/PanoTagPlugin/index.js +1 -1
- package/libs/PanoTagPlugin/utils/index.d.ts +0 -1
- package/libs/PanoTagPlugin/utils/index.js +4 -6
- package/libs/base/BasePlugin.js +1 -1
- package/libs/index.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +2 -2
- /package/dist/{PanoTagPlugin/utils → shared-utils/dom}/resizeObserver.d.ts +0 -0
- /package/libs/{PanoTagPlugin/utils → shared-utils/dom}/resizeObserver.d.ts +0 -0
- /package/libs/{PanoTagPlugin/utils → shared-utils/dom}/resizeObserver.js +0 -0
|
@@ -16,8 +16,6 @@ export declare class Controller extends BasePlugin.Controller<PluginType.State,
|
|
|
16
16
|
data?: PluginType.PluginData;
|
|
17
17
|
/** tag 容器 */
|
|
18
18
|
tagDomContainer: HTMLDivElement;
|
|
19
|
-
/** 用于监听容器尺寸变化的 iframe */
|
|
20
|
-
resizeIframe: HTMLIFrameElement;
|
|
21
19
|
/** 插件配置项 */
|
|
22
20
|
get config(): {
|
|
23
21
|
modelDepthTest: boolean;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
1
|
+
var M = Object.defineProperty, C = Object.defineProperties;
|
|
2
|
+
var S = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var f = Object.getOwnPropertySymbols;
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var m = (h, o, t) => o in h ? M(h, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[o] = t, d = (h, o) => {
|
|
6
|
+
for (var t in o || (o = {}))
|
|
7
|
+
A.call(o, t) && m(h, t, o[t]);
|
|
8
|
+
if (f)
|
|
9
|
+
for (var t of f(o))
|
|
10
|
+
_.call(o, t) && m(h, t, o[t]);
|
|
11
11
|
return h;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
}, p = (h, o) => C(h, S(o));
|
|
13
|
+
var r = (h, o, t) => (m(h, typeof o != "symbol" ? o + "" : o, t), t);
|
|
14
|
+
var u = (h, o, t) => new Promise((i, e) => {
|
|
15
15
|
var s = (n) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
e(
|
|
17
|
+
c(t.next(n));
|
|
18
|
+
} catch (l) {
|
|
19
|
+
e(l);
|
|
20
20
|
}
|
|
21
21
|
}, a = (n) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
e(
|
|
23
|
+
c(t.throw(n));
|
|
24
|
+
} catch (l) {
|
|
25
|
+
e(l);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, c = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(s, a);
|
|
28
|
+
c((t = t.apply(h, o)).next());
|
|
29
29
|
});
|
|
30
30
|
import * as g from "three";
|
|
31
|
-
import { Controller as
|
|
31
|
+
import { Controller as k } from "../base/BasePluginWithData.js";
|
|
32
32
|
import "hammerjs";
|
|
33
33
|
import "@realsee/five";
|
|
34
34
|
import "../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
35
35
|
import "../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
|
|
36
36
|
import "../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
37
|
-
import { equal as
|
|
38
|
-
import { AreaMakerItem as
|
|
37
|
+
import { equal as I } from "../shared-utils/equal.js";
|
|
38
|
+
import { AreaMakerItem as D } from "./utils/Item.js";
|
|
39
39
|
import "../base/BasePlugin.js";
|
|
40
40
|
import "../shared-utils/Subscribe.js";
|
|
41
41
|
import "../shared-utils/url/absoluteUrl.js";
|
|
@@ -61,7 +61,8 @@ import "../components/AreaLabel/LabelItem.js";
|
|
|
61
61
|
import "../vendor/svelte/internal/index.js";
|
|
62
62
|
import "../components/AreaLabel/Assets/roomLabelBg.js";
|
|
63
63
|
import "../shared-utils/math/planimetry.js";
|
|
64
|
-
|
|
64
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
65
|
+
class ht extends k {
|
|
65
66
|
/** AreaMakerPlugin
|
|
66
67
|
* @param `five` `<Five>` Five 实例
|
|
67
68
|
* @param `params` `<PluginType.Params> | <undefined>` 插件初始化参数
|
|
@@ -71,43 +72,41 @@ class at extends _ {
|
|
|
71
72
|
super(t);
|
|
72
73
|
// ==================== public properties ====================
|
|
73
74
|
/** 插件当前状态 */
|
|
74
|
-
|
|
75
|
+
r(this, "state");
|
|
75
76
|
/** 标注模型 { id: item } 的映射表 */
|
|
76
|
-
|
|
77
|
+
r(this, "itemMap");
|
|
77
78
|
/** 自定义 DOM */
|
|
78
|
-
|
|
79
|
+
r(this, "itemRenderer");
|
|
79
80
|
/** 标注模型容器 */
|
|
80
|
-
|
|
81
|
+
r(this, "modelGroup");
|
|
81
82
|
/** 当前使用的数据 */
|
|
82
|
-
|
|
83
|
+
r(this, "data");
|
|
83
84
|
/** tag 容器 */
|
|
84
|
-
|
|
85
|
-
/** 用于监听容器尺寸变化的 iframe */
|
|
86
|
-
o(this, "resizeIframe");
|
|
85
|
+
r(this, "tagDomContainer");
|
|
87
86
|
/** 查询问题使用的调试对象 */
|
|
88
|
-
|
|
87
|
+
r(this, "checkMsg", {
|
|
89
88
|
childrenMountedState: ""
|
|
90
89
|
});
|
|
91
90
|
// ==================== private properties ====================
|
|
92
91
|
/** 是否在 Five Change Mode 动画中 */
|
|
93
|
-
|
|
92
|
+
r(this, "isInFiveChangeModeAnime", !1);
|
|
94
93
|
/** 子组件是否挂载 */
|
|
95
|
-
|
|
94
|
+
r(this, "childrenMountedState", !1);
|
|
96
95
|
/** config 的原始值 */
|
|
97
|
-
|
|
96
|
+
r(this, "_config");
|
|
98
97
|
/** disposed 的原始值 */
|
|
99
|
-
|
|
98
|
+
r(this, "_disposed", !1);
|
|
100
99
|
/** 销毁插件,移除所有副作用,销毁后将不响应任何 API */
|
|
101
|
-
|
|
100
|
+
r(this, "dispose", () => {
|
|
102
101
|
this.five.scene.remove(this.modelGroup);
|
|
103
102
|
});
|
|
104
|
-
|
|
103
|
+
r(this, "onFiveInitAnimationWillStart", () => {
|
|
105
104
|
this.isInFiveChangeModeAnime = !0, this.updateChildrenMountedState();
|
|
106
105
|
});
|
|
107
|
-
|
|
106
|
+
r(this, "onFiveInitAnimationEnded", () => {
|
|
108
107
|
this.isInFiveChangeModeAnime = !1, this.updateChildrenMountedState();
|
|
109
108
|
});
|
|
110
|
-
|
|
109
|
+
r(this, "onFiveCameraUpdate", () => {
|
|
111
110
|
const t = this.five.camera;
|
|
112
111
|
[...this.itemMap.values()].sort((e, s) => {
|
|
113
112
|
const a = e.tagPosition.distanceTo(t.position);
|
|
@@ -117,22 +116,22 @@ class at extends _ {
|
|
|
117
116
|
(a = this.getMaskItemByID(e.id)) == null || a.setTagZIndex(s * 10);
|
|
118
117
|
});
|
|
119
118
|
});
|
|
120
|
-
|
|
119
|
+
r(this, "onFiveModeChange", () => {
|
|
121
120
|
this.updateChildrenMountedState();
|
|
122
121
|
});
|
|
123
|
-
|
|
122
|
+
r(this, "onMakerTagClick", (t) => {
|
|
124
123
|
this.hooks.emit("wantsTap", { target: t.target, intersectObjects: [] });
|
|
125
124
|
});
|
|
126
|
-
|
|
125
|
+
r(this, "onWantsFiveTapGesture", (t) => {
|
|
127
126
|
const i = Array.from(this.itemMap.values()).filter((n) => n.mounted && n.visible).map((n) => ({
|
|
128
127
|
makerItem: n,
|
|
129
128
|
intersects: n.modelGroup.getRaycastIntersects(t)
|
|
130
129
|
})).filter(({ intersects: n }) => n.length > 0);
|
|
131
130
|
if (i.length === 0)
|
|
132
131
|
return;
|
|
133
|
-
const e = i.reduce((n,
|
|
134
|
-
const v = n.intersects[0].distance, b =
|
|
135
|
-
return v < b ? n :
|
|
132
|
+
const e = i.reduce((n, l) => {
|
|
133
|
+
const v = n.intersects[0].distance, b = l.intersects[0].distance;
|
|
134
|
+
return v < b ? n : l;
|
|
136
135
|
}), s = this.five.model.intersectRaycaster(t)[0];
|
|
137
136
|
if (this.config.modelDepthTest && s && s.distance < e.intersects[0].distance)
|
|
138
137
|
return;
|
|
@@ -142,7 +141,7 @@ class at extends _ {
|
|
|
142
141
|
}))
|
|
143
142
|
return !1;
|
|
144
143
|
});
|
|
145
|
-
this.five = t, this.tagDomContainer = document.createElement("div"), this.tagDomContainer.style.position = "absolute", this.tagDomContainer.style.top = "0", this.tagDomContainer.style.left = "0", this.tagDomContainer.style.width = "100%", this.tagDomContainer.style.height = "100%", this.tagDomContainer.style.pointerEvents = "none"
|
|
144
|
+
this.five = t, this.tagDomContainer = document.createElement("div"), this.tagDomContainer.style.position = "absolute", this.tagDomContainer.style.top = "0", this.tagDomContainer.style.left = "0", this.tagDomContainer.style.width = "100%", this.tagDomContainer.style.height = "100%", this.tagDomContainer.style.pointerEvents = "none";
|
|
146
145
|
const e = {
|
|
147
146
|
enabled: !0,
|
|
148
147
|
visible: !0
|
|
@@ -163,10 +162,10 @@ class at extends _ {
|
|
|
163
162
|
}
|
|
164
163
|
/** 加载数据,重复调用会使用新数据覆盖旧数据 */
|
|
165
164
|
load(t) {
|
|
166
|
-
return
|
|
165
|
+
return u(this, null, function* () {
|
|
167
166
|
const i = this.data;
|
|
168
167
|
this.data = this.formatData(t), this.hooks.emit("dataChange", this.data, i), this.modelGroup.remove(...this.modelGroup.children), this.itemMap.forEach((e) => e.unmount()), this.itemMap.clear(), this.childrenMountedState = !1, this.checkMsg.childrenMountedState = "", this.data.list.forEach((e) => {
|
|
169
|
-
const s = new
|
|
168
|
+
const s = new D(this, e);
|
|
170
169
|
s.itemRenderer = this.itemRenderer, this.modelGroup.add(s.modelGroup), this.itemMap.set(e.id, s), s.hooks.on("tagClick", this.onMakerTagClick);
|
|
171
170
|
}), this.updateChildrenMountedState();
|
|
172
171
|
});
|
|
@@ -202,7 +201,7 @@ class at extends _ {
|
|
|
202
201
|
* @param `options.userAction` `<boolean> | <undefined>` 是否是用户操作。默认是 true。
|
|
203
202
|
*/
|
|
204
203
|
show(t) {
|
|
205
|
-
return
|
|
204
|
+
return u(this, null, function* () {
|
|
206
205
|
if (this.state.visible)
|
|
207
206
|
return Promise.resolve();
|
|
208
207
|
if (this.disposed)
|
|
@@ -216,7 +215,7 @@ class at extends _ {
|
|
|
216
215
|
* @param `options.userAction` `<boolean> | <undefined>` 是否是用户操作。默认是 true。
|
|
217
216
|
*/
|
|
218
217
|
hide(t) {
|
|
219
|
-
return
|
|
218
|
+
return u(this, null, function* () {
|
|
220
219
|
if (this.state.visible === !1)
|
|
221
220
|
return;
|
|
222
221
|
const i = d({ userAction: !0 }, t);
|
|
@@ -264,7 +263,7 @@ class at extends _ {
|
|
|
264
263
|
*/
|
|
265
264
|
setState(t, i = {}) {
|
|
266
265
|
const e = this.state;
|
|
267
|
-
if (
|
|
266
|
+
if (I(t, e, { deep: !0 }))
|
|
268
267
|
return;
|
|
269
268
|
const s = i.userAction !== void 0 ? i.userAction : !0;
|
|
270
269
|
if (this.updateState(t, s), t.enabled !== void 0 && e.enabled !== t.enabled && (t.enabled ? this._enable({ userAction: s }) : this._disable({ userAction: s })), t.visible !== void 0 && e.visible !== t.visible) {
|
|
@@ -292,9 +291,9 @@ class at extends _ {
|
|
|
292
291
|
return i(t) ? {
|
|
293
292
|
list: t.list.filter((e) => e.object_data.points.length >= 3).map((e) => {
|
|
294
293
|
const s = new g.Shape(), a = e.object_data.points[0];
|
|
295
|
-
return s.moveTo(a[0], a[2]), e.object_data.points.slice(1).forEach((n) => s.lineTo(n[0], n[2])), s.lineTo(a[0], a[2]),
|
|
294
|
+
return s.moveTo(a[0], a[2]), e.object_data.points.slice(1).forEach((n) => s.lineTo(n[0], n[2])), s.lineTo(a[0], a[2]), p(d({}, e), {
|
|
296
295
|
floor_index: e.object_data.floorIndex,
|
|
297
|
-
object_data:
|
|
296
|
+
object_data: p(d({}, e.object_data), {
|
|
298
297
|
bottom_y: a[1] + e.object_data.fixedY,
|
|
299
298
|
shape: s.toJSON(),
|
|
300
299
|
height: e.object_data.height + e.object_data.fixedHeight
|
|
@@ -327,16 +326,16 @@ class at extends _ {
|
|
|
327
326
|
this.hooks.emit("disable", { userAction: t.userAction }), this.five.scene.remove(this.modelGroup), this.updateChildrenMountedState(), this.five.needsRender = !0, this.five.off("wantsTapGesture", this.onWantsFiveTapGesture), this.five.off("initAnimationWillStart", this.onFiveInitAnimationWillStart), this.five.off("initAnimationEnded", this.onFiveInitAnimationEnded), this.five.off("modeChange", this.onFiveModeChange), this.five.off("cameraUpdate", this.onFiveCameraUpdate);
|
|
328
327
|
}
|
|
329
328
|
_show(t) {
|
|
330
|
-
return
|
|
329
|
+
return u(this, null, function* () {
|
|
331
330
|
this.hooks.emit("show", t), this.five.needsRender = !0;
|
|
332
331
|
});
|
|
333
332
|
}
|
|
334
333
|
_hide(t) {
|
|
335
|
-
return
|
|
334
|
+
return u(this, null, function* () {
|
|
336
335
|
this.hooks.emit("hide", t), this.five.needsRender = !0;
|
|
337
336
|
});
|
|
338
337
|
}
|
|
339
338
|
}
|
|
340
339
|
export {
|
|
341
|
-
|
|
340
|
+
ht as Controller
|
|
342
341
|
};
|
|
@@ -33,7 +33,8 @@ import "../components/AreaLabel/LabelItem.js";
|
|
|
33
33
|
import "../vendor/svelte/internal/index.js";
|
|
34
34
|
import "../components/AreaLabel/Assets/roomLabelBg.js";
|
|
35
35
|
import "../shared-utils/math/planimetry.js";
|
|
36
|
-
|
|
36
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
37
|
+
const L = (r, o) => new t(r, o);
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
L as AreaMakerPlugin
|
|
39
40
|
};
|
|
@@ -70,6 +70,7 @@ export declare class AreaMakerItem {
|
|
|
70
70
|
private isInContainerResizeAnimation;
|
|
71
71
|
/** 监听容器 resize 的计时器 id,用于判断 resize 过程是否结束 */
|
|
72
72
|
private containerResizeTimeoutID;
|
|
73
|
+
private resizeObserver?;
|
|
73
74
|
constructor(plugin: Controller, data: PluginType.ServerAreaMakerItem);
|
|
74
75
|
/** 挂载标注 */
|
|
75
76
|
mount(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var b = (
|
|
3
|
-
var i = (
|
|
4
|
-
import * as
|
|
2
|
+
var b = (n, e, t) => e in n ? f(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var i = (n, e, t) => (b(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import * as a from "three";
|
|
5
5
|
import "hammerjs";
|
|
6
6
|
import "@realsee/five";
|
|
7
7
|
import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
@@ -13,6 +13,7 @@ import { BetterTween as T } from "../../shared-utils/animationFrame/BetterTween.
|
|
|
13
13
|
import { LabelItem as C } from "../../components/AreaLabel/LabelItem.js";
|
|
14
14
|
import { getCenterPointOfPoints as O } from "../../shared-utils/math/planimetry.js";
|
|
15
15
|
import { Subscribe as v } from "../../shared-utils/Subscribe.js";
|
|
16
|
+
import { resizeObserver as M } from "../../shared-utils/dom/resizeObserver.js";
|
|
16
17
|
import "../../shared-utils/positionToVector3.js";
|
|
17
18
|
import "../../CSS3DRenderPlugin/utils/three/CSS3DRenderer.js";
|
|
18
19
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
@@ -29,7 +30,7 @@ import "../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
|
29
30
|
import "../../shared-utils/animationFrame/index.js";
|
|
30
31
|
import "../../vendor/svelte/internal/index.js";
|
|
31
32
|
import "../../components/AreaLabel/Assets/roomLabelBg.js";
|
|
32
|
-
class
|
|
33
|
+
class P extends k {
|
|
33
34
|
constructor(t) {
|
|
34
35
|
super();
|
|
35
36
|
i(this, "areaMakerItem");
|
|
@@ -39,7 +40,7 @@ class M extends k {
|
|
|
39
40
|
this.areaMakerItem.makerObject.raycast(t, s);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
class
|
|
43
|
+
class it {
|
|
43
44
|
constructor(e, t) {
|
|
44
45
|
i(this, "id");
|
|
45
46
|
/** 标注名称 */
|
|
@@ -77,9 +78,9 @@ class tt {
|
|
|
77
78
|
/** 标注标签是否可见 */
|
|
78
79
|
i(this, "tagVisible", !0);
|
|
79
80
|
/** 标注标签的世界坐标 */
|
|
80
|
-
i(this, "tagPosition", new
|
|
81
|
+
i(this, "tagPosition", new a.Vector3());
|
|
81
82
|
/** 标注标签的 NDC 坐标 */
|
|
82
|
-
i(this, "tagNDCPosition", new
|
|
83
|
+
i(this, "tagNDCPosition", new a.Vector3());
|
|
83
84
|
/** 标注标签的 transform */
|
|
84
85
|
i(this, "tagTransform", { left: 0, top: 0 });
|
|
85
86
|
/** 标注标签的显示层级 */
|
|
@@ -98,6 +99,7 @@ class tt {
|
|
|
98
99
|
i(this, "isInContainerResizeAnimation", !1);
|
|
99
100
|
/** 监听容器 resize 的计时器 id,用于判断 resize 过程是否结束 */
|
|
100
101
|
i(this, "containerResizeTimeoutID", null);
|
|
102
|
+
i(this, "resizeObserver");
|
|
101
103
|
/** 显示标注 */
|
|
102
104
|
// public show() {
|
|
103
105
|
// return this.doOpacityAnime({
|
|
@@ -188,7 +190,7 @@ class tt {
|
|
|
188
190
|
return { result: !1, msg: "标注整体不可见" };
|
|
189
191
|
if (this.isInContainerResizeAnimation)
|
|
190
192
|
return { result: !1, msg: "处于容器 resize 动画中" };
|
|
191
|
-
const t = this.plugin.five, s = new
|
|
193
|
+
const t = this.plugin.five, s = new a.Raycaster(), o = t.camera.position.clone();
|
|
192
194
|
s.set(o.clone(), this.tagPosition.clone().sub(o).normalize());
|
|
193
195
|
const [r] = t.model.intersectRaycaster(s), l = this.tagPosition.distanceTo(t.camera.position);
|
|
194
196
|
if (r && r.distance + 0.1 < l)
|
|
@@ -209,32 +211,33 @@ class tt {
|
|
|
209
211
|
this.containerResizeTimeoutID && clearTimeout(this.containerResizeTimeoutID), this.containerResizeTimeoutID = setTimeout(t, 100);
|
|
210
212
|
});
|
|
211
213
|
var p, m, c, g;
|
|
212
|
-
const s = t.object_data, o = s.bottom_y, r = s.height, l = new
|
|
213
|
-
this.data = t, this.id = t.id, this.name = (c = t.name) != null ? c : "", this.plugin = e, this.height = r, this.bottomY = o, this.opacity = h, this.shape = new
|
|
214
|
-
new
|
|
215
|
-
new
|
|
216
|
-
), u(this.outline, o), this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.setHeight(r), this.modelGroup = new
|
|
214
|
+
const s = t.object_data, o = s.bottom_y, r = s.height, l = new a.Color((p = s.color) != null ? p : "#FFFFFF"), h = (m = s.opacity) != null ? m : 0.4;
|
|
215
|
+
this.data = t, this.id = t.id, this.name = (c = t.name) != null ? c : "", this.plugin = e, this.height = r, this.bottomY = o, this.opacity = h, this.shape = new a.Shape().fromJSON(s.shape), this.floorIndex = t.floor_index, this.makerObject = new a.Mesh(d(this.shape, r), V(l, h)), u(this.makerObject, o), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline = new y(
|
|
216
|
+
new a.EdgesGeometry(this.makerObject.geometry),
|
|
217
|
+
new a.LineBasicMaterial({ color: l, transparent: !0 })
|
|
218
|
+
), u(this.outline, o), this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.setHeight(r), this.modelGroup = new P(this), this.modelGroup.visible = (g = s.visible) != null ? g : !0;
|
|
217
219
|
}
|
|
218
220
|
/** 挂载标注 */
|
|
219
221
|
mount() {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
this.mounted = !0, this.updateVisible(), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.modelGroup.add(this.makerObject, this.outline);
|
|
223
|
+
const e = !!this.name, t = this.plugin.tagDomContainer;
|
|
224
|
+
if (e) {
|
|
225
|
+
const s = {
|
|
223
226
|
data: this.data,
|
|
224
227
|
content: this.name,
|
|
225
228
|
visible: this.tagVisible,
|
|
226
229
|
renderer: this.itemRenderer,
|
|
227
230
|
transform: `translate(${this.tagTransform.left}px, ${this.tagTransform.top}px)`,
|
|
228
|
-
onClick: (
|
|
231
|
+
onClick: (o) => this.hooks.emit("tagClick", { target: this, nativeEvent: o })
|
|
229
232
|
};
|
|
230
|
-
this.tagApp = new C({ target:
|
|
233
|
+
this.tagApp = new C({ target: t, props: s }), this.updateTag();
|
|
231
234
|
}
|
|
232
|
-
this.plugin.five.needsRender = !0, this.plugin.hooks.on("stateChange", this.onPluginStateChange), this.plugin.hooks.on("configChange", this.onPluginConfigChange), this.plugin.five.on("modeChange", this.updateVisible), this.plugin.five.on("modelShownFloorChange", this.updateVisible), this.plugin.five.on("cameraUpdate", this.onFiveCameraUpdate),
|
|
235
|
+
this.plugin.five.needsRender = !0, this.plugin.hooks.on("stateChange", this.onPluginStateChange), this.plugin.hooks.on("configChange", this.onPluginConfigChange), this.plugin.five.on("modeChange", this.updateVisible), this.plugin.five.on("modelShownFloorChange", this.updateVisible), this.plugin.five.on("cameraUpdate", this.onFiveCameraUpdate), this.resizeObserver = M(this.onContainerResize, t), this.resizeObserver.observe();
|
|
233
236
|
}
|
|
234
237
|
/** 卸载标注 */
|
|
235
238
|
unmount() {
|
|
236
239
|
var e, t;
|
|
237
|
-
this.mounted = !1, this.modelGroup.remove(...this.modelGroup.children), (e = this.tagApp) == null || e.$destroy(), this.tagApp = null, this.plugin.hooks.off("stateChange", this.onPluginStateChange), this.plugin.hooks.off("configChange", this.onPluginConfigChange), this.plugin.five.off("modeChange", this.updateVisible), this.plugin.five.off("modelShownFloorChange", this.updateVisible), this.plugin.five.off("cameraUpdate", this.onFiveCameraUpdate), (t = this.
|
|
240
|
+
this.mounted = !1, this.modelGroup.remove(...this.modelGroup.children), (e = this.tagApp) == null || e.$destroy(), this.tagApp = null, this.plugin.hooks.off("stateChange", this.onPluginStateChange), this.plugin.hooks.off("configChange", this.onPluginConfigChange), this.plugin.five.off("modeChange", this.updateVisible), this.plugin.five.off("modelShownFloorChange", this.updateVisible), this.plugin.five.off("cameraUpdate", this.onFiveCameraUpdate), (t = this.resizeObserver) == null || t.unobserve();
|
|
238
241
|
}
|
|
239
242
|
/** 更改标注透明度
|
|
240
243
|
* @param opacity 标注透明度,范围:0-1
|
|
@@ -248,7 +251,7 @@ class tt {
|
|
|
248
251
|
* @example setColor('#FF0000')
|
|
249
252
|
*/
|
|
250
253
|
setColor(e) {
|
|
251
|
-
const t = new
|
|
254
|
+
const t = new a.Color(e);
|
|
252
255
|
this.makerObject.material.color = t, this.outline.material.color = t, this.plugin.five.needsRender = !0;
|
|
253
256
|
}
|
|
254
257
|
/** 更改标注高度
|
|
@@ -257,8 +260,8 @@ class tt {
|
|
|
257
260
|
setHeight(e) {
|
|
258
261
|
if (e <= 0)
|
|
259
262
|
throw new Error("高度必须大于 0");
|
|
260
|
-
this.height = e, this.makerObject.geometry = d(this.shape, e), this.outline.geometry = new
|
|
261
|
-
const t = this.shape.extractPoints(10).shape.slice(0, -1), s = O(t), o = new
|
|
263
|
+
this.height = e, this.makerObject.geometry = d(this.shape, e), this.outline.geometry = new a.EdgesGeometry(this.makerObject.geometry);
|
|
264
|
+
const t = this.shape.extractPoints(10).shape.slice(0, -1), s = O(t), o = new a.Vector3(s.x, s.y, e);
|
|
262
265
|
u(o, this.bottomY), this.tagPosition.copy(o), this.updateTag(), this.plugin.five.needsRender = !0;
|
|
263
266
|
}
|
|
264
267
|
/** 更改标注标签的显示层级
|
|
@@ -274,23 +277,23 @@ class tt {
|
|
|
274
277
|
this.tagZIndex !== e && ((t = this.tagApp) == null || t.$set({ zIndex: e }));
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
|
-
function d(
|
|
278
|
-
return new
|
|
280
|
+
function d(n, e) {
|
|
281
|
+
return new a.ExtrudeBufferGeometry(n, {
|
|
279
282
|
depth: e,
|
|
280
283
|
bevelEnabled: !1
|
|
281
284
|
});
|
|
282
285
|
}
|
|
283
|
-
function
|
|
284
|
-
return new
|
|
285
|
-
color:
|
|
286
|
+
function V(n, e) {
|
|
287
|
+
return new a.MeshBasicMaterial({
|
|
288
|
+
color: n,
|
|
286
289
|
opacity: e,
|
|
287
290
|
transparent: !0
|
|
288
291
|
});
|
|
289
292
|
}
|
|
290
|
-
function u(
|
|
291
|
-
const t = new
|
|
292
|
-
t.multiply(s), t.multiply(o), t.multiply(r),
|
|
293
|
+
function u(n, e) {
|
|
294
|
+
const t = new a.Matrix4(), s = new a.Matrix4().makeRotationX(Math.PI / 2), o = new a.Matrix4().makeTranslation(0, 0, -e), r = new a.Matrix4().makeScale(1, 1, -1);
|
|
295
|
+
t.multiply(s), t.multiply(o), t.multiply(r), n.applyMatrix4(t);
|
|
293
296
|
}
|
|
294
297
|
export {
|
|
295
|
-
|
|
298
|
+
it as AreaMakerItem
|
|
296
299
|
};
|
|
@@ -82,9 +82,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
82
82
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
83
83
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
84
84
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
85
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
86
85
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
87
86
|
import "../shared-utils/audio.js";
|
|
87
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
88
88
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
89
89
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
90
90
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -49,9 +49,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
49
49
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
50
50
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
51
51
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
52
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
53
52
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
54
53
|
import "../shared-utils/audio.js";
|
|
54
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
55
55
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
56
56
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
57
57
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -74,9 +74,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
74
74
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
75
75
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
76
76
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
77
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
78
77
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
79
78
|
import "../shared-utils/audio.js";
|
|
79
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
80
80
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
81
81
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
82
82
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -43,9 +43,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
43
43
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
44
44
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
45
45
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
46
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
47
46
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
48
47
|
import "../shared-utils/audio.js";
|
|
48
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
49
49
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
50
50
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
51
51
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -40,9 +40,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
40
40
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
41
41
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
42
42
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
43
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
44
43
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
45
44
|
import "../shared-utils/audio.js";
|
|
45
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
46
46
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
47
47
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
48
48
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -52,9 +52,9 @@ import "../PanoTagPlugin/utils/addDebugPoints.js";
|
|
|
52
52
|
import "../PanoTagPlugin/utils/tag/tagCheck.js";
|
|
53
53
|
import "../PanoTagPlugin/utils/debounce.js";
|
|
54
54
|
import "../PanoTagPlugin/utils/throttle.js";
|
|
55
|
-
import "../PanoTagPlugin/utils/resizeObserver.js";
|
|
56
55
|
import "../PanoTagPlugin/utils/tag/format.js";
|
|
57
56
|
import "../shared-utils/audio.js";
|
|
57
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
58
58
|
import "../PanoTagPlugin/controller/TagRender.js";
|
|
59
59
|
import "../PanoTagPlugin/controller/TagComputer.js";
|
|
60
60
|
import "../PanoTagPlugin/utils/tagPosition.js";
|
|
@@ -12,7 +12,7 @@ var M = (b, e, i) => e in b ? $(b, e, { enumerable: !0, configurable: !0, writab
|
|
|
12
12
|
}, D = (b, e) => w(b, E(e));
|
|
13
13
|
import * as F from "three";
|
|
14
14
|
import { is3DTag as z, isMediaModelTag as R } from "../utils/tag/tagCheck.js";
|
|
15
|
-
import { getTagCenterPosition as
|
|
15
|
+
import { getTagCenterPosition as C, getTagPosition as O } from "../utils/tagPosition.js";
|
|
16
16
|
import { checkRange as h } from "../utils/checkRange.js";
|
|
17
17
|
import { isPanoramaLike as y, isModelLike as Z } from "../../shared-utils/five/mode.js";
|
|
18
18
|
import "hammerjs";
|
|
@@ -64,7 +64,8 @@ import "../utils/tag/adaptConfig.js";
|
|
|
64
64
|
import "../../shared-utils/typescript/entries.js";
|
|
65
65
|
import "../../shared-utils/url/getUrl.js";
|
|
66
66
|
import "../../shared-utils/five/transformPosition.js";
|
|
67
|
-
const
|
|
67
|
+
const I = new F.Raycaster();
|
|
68
|
+
I.params.Points.threshold = 0.1;
|
|
68
69
|
class Je extends H {
|
|
69
70
|
constructor(e) {
|
|
70
71
|
super(e);
|
|
@@ -254,7 +255,7 @@ class Je extends H {
|
|
|
254
255
|
* @description 一个点的标签
|
|
255
256
|
*/
|
|
256
257
|
getTagProject(e) {
|
|
257
|
-
const i =
|
|
258
|
+
const i = C(e);
|
|
258
259
|
if (!i)
|
|
259
260
|
return;
|
|
260
261
|
const { x: f, y: t, z: o } = i.project(this.five.camera);
|
|
@@ -271,20 +272,20 @@ class Je extends H {
|
|
|
271
272
|
(() => {
|
|
272
273
|
var g;
|
|
273
274
|
const v = (g = f.checkPoints) != null ? g : "center";
|
|
274
|
-
return v === "center" ?
|
|
275
|
+
return v === "center" ? C(e) : v === "corner" ? O(e) : Array.isArray(v) ? v : [];
|
|
275
276
|
})()
|
|
276
277
|
);
|
|
277
278
|
let s = 0, c = 0;
|
|
278
279
|
for (const v of d) {
|
|
279
280
|
const g = new F.Vector3().subVectors(v, o).normalize();
|
|
280
|
-
|
|
281
|
-
const P = o.distanceTo(v), [l] = this.five.model.intersectRaycaster(
|
|
281
|
+
I.set(o, g);
|
|
282
|
+
const P = o.distanceTo(v), [l] = this.five.model.intersectRaycaster(I), p = (() => {
|
|
282
283
|
if (!R(e))
|
|
283
284
|
return;
|
|
284
285
|
const V = this.tags.filter(R).map((A) => {
|
|
285
286
|
var T;
|
|
286
287
|
return (T = A.model) == null ? void 0 : T.object;
|
|
287
|
-
}).filter(q), [B] =
|
|
288
|
+
}).filter(q), [B] = I.intersectObjects(V, !0);
|
|
288
289
|
return B;
|
|
289
290
|
})(), S = (r = f.distanceAccuracy) != null ? r : 0.01;
|
|
290
291
|
Math.min((a = l == null ? void 0 : l.distance) != null ? a : 1 / 0, (u = p == null ? void 0 : p.distance) != null ? u : 1 / 0) + S >= P ? s++ : c++;
|
|
@@ -306,7 +307,7 @@ class Je extends H {
|
|
|
306
307
|
var o, d, s, c, n, r, a;
|
|
307
308
|
let i = 0;
|
|
308
309
|
const f = (o = e.fiveState) == null ? void 0 : o.panoIndex;
|
|
309
|
-
f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = N(this.work, (a = (r = (c = (s = e.model) == null ? void 0 : s.object) == null ? void 0 : c.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? a :
|
|
310
|
+
f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = N(this.work, (a = (r = (c = (s = e.model) == null ? void 0 : s.object) == null ? void 0 : c.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? a : C(e));
|
|
310
311
|
const t = this.five.model.shownFloor;
|
|
311
312
|
return t === null || t === i;
|
|
312
313
|
}
|
|
@@ -35,9 +35,9 @@ import { arrayPositionToVector3 as P } from "../../shared-utils/positionToVector
|
|
|
35
35
|
import { isMediaModelTag as _, isModelTag as k } from "../utils/tag/tagCheck.js";
|
|
36
36
|
import { debounce as V } from "../utils/debounce.js";
|
|
37
37
|
import { throttle as D } from "../utils/throttle.js";
|
|
38
|
-
import { resizeObserver as S } from "../utils/resizeObserver.js";
|
|
39
38
|
import L from "../utils/tag/format.js";
|
|
40
39
|
import { generateBlankAudio as N, AudioNamespace as G } from "../../shared-utils/audio.js";
|
|
40
|
+
import { resizeObserver as S } from "../../shared-utils/dom/resizeObserver.js";
|
|
41
41
|
import { TagRender as z } from "./TagRender.js";
|
|
42
42
|
import { uuid as x } from "../../shared-utils/uuid.js";
|
|
43
43
|
import { isModelLike as $ } from "../../shared-utils/five/mode.js";
|
|
@@ -10,9 +10,9 @@ import "../shared-utils/positionToVector3.js";
|
|
|
10
10
|
import "./utils/tag/tagCheck.js";
|
|
11
11
|
import "./utils/debounce.js";
|
|
12
12
|
import "./utils/throttle.js";
|
|
13
|
-
import "./utils/resizeObserver.js";
|
|
14
13
|
import "./utils/tag/format.js";
|
|
15
14
|
import "../shared-utils/audio.js";
|
|
15
|
+
import "../shared-utils/dom/resizeObserver.js";
|
|
16
16
|
import "./controller/TagRender.js";
|
|
17
17
|
import "./controller/TagComputer.js";
|
|
18
18
|
import "./utils/tagPosition.js";
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { addDebugPoints as
|
|
1
|
+
import { addDebugPoints as a } from "./addDebugPoints.js";
|
|
2
2
|
import { noTypecheck as n } from "./noTypecheck.js";
|
|
3
3
|
import { planeNormal as f } from "./planeNormal.js";
|
|
4
4
|
import { getTagCenterPosition as l, getTagPosition as c } from "./tagPosition.js";
|
|
5
5
|
import { checkRange as h } from "./checkRange.js";
|
|
6
6
|
import { normalPositionToPositions as T } from "./normalPositionToPositions.js";
|
|
7
|
-
import { debounce as
|
|
7
|
+
import { debounce as b } from "./debounce.js";
|
|
8
8
|
import { throttle as k } from "./throttle.js";
|
|
9
9
|
import { binarySearchFirstBig as F, searchFirstValueSmallThanLastValue as S } from "./search.js";
|
|
10
|
-
import { resizeObserver as v } from "./resizeObserver.js";
|
|
11
10
|
import "three";
|
|
12
11
|
import "../../shared-utils/positionToVector3.js";
|
|
13
12
|
import "../../shared-utils/three/centerPoint.js";
|
|
14
13
|
import "./tag/tagCheck.js";
|
|
15
14
|
export {
|
|
16
|
-
|
|
15
|
+
a as addDebugPoints,
|
|
17
16
|
F as binarySearchFirstBig,
|
|
18
17
|
h as checkRange,
|
|
19
|
-
|
|
18
|
+
b as debounce,
|
|
20
19
|
l as getTagCenterPosition,
|
|
21
20
|
c as getTagPosition,
|
|
22
21
|
n as noTypecheck,
|
|
23
22
|
T as normalPositionToPositions,
|
|
24
23
|
f as planeNormal,
|
|
25
|
-
v as resizeObserver,
|
|
26
24
|
S as searchFirstValueSmallThanLastValue,
|
|
27
25
|
k as throttle
|
|
28
26
|
};
|