@realsee/dnalogel 3.5.1 → 3.6.0
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 +2 -0
- package/dist/AreaMakerPlugin/typing.d.ts +1 -0
- package/dist/AreaMakerPlugin/utils/Item.d.ts +4 -0
- package/dist/index.cjs.js +45 -45
- package/dist/index.js +2626 -2575
- package/dist/index.umd.js +49 -49
- package/libs/AreaMakerPlugin/Controller.d.ts +2 -0
- package/libs/AreaMakerPlugin/Controller.js +32 -30
- package/libs/AreaMakerPlugin/typing.d.ts +1 -0
- package/libs/AreaMakerPlugin/utils/Item.d.ts +4 -0
- package/libs/AreaMakerPlugin/utils/Item.js +59 -53
- package/libs/base/BasePlugin.js +1 -1
- package/libs/components/AreaLabel/LabelItem.js +111 -68
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ export declare class Controller extends BasePlugin.Controller<PluginType.State,
|
|
|
8
8
|
state: PluginType.State;
|
|
9
9
|
/** 标注模型 { id: item } 的映射表 */
|
|
10
10
|
itemMap: Map<string | number, AreaMakerItem>;
|
|
11
|
+
/** 自定义 DOM */
|
|
12
|
+
itemRenderer?: PluginType.ItemRenderer;
|
|
11
13
|
/** 标注模型容器 */
|
|
12
14
|
modelGroup: THREE.Group;
|
|
13
15
|
/** 当前使用的数据 */
|
|
@@ -2,16 +2,16 @@ var C = Object.defineProperty, M = Object.defineProperties;
|
|
|
2
2
|
var I = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var p = Object.getOwnPropertySymbols;
|
|
4
4
|
var A = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var u = (h,
|
|
6
|
-
for (var t in
|
|
7
|
-
A.call(
|
|
5
|
+
var u = (h, r, t) => r in h ? C(h, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[r] = t, d = (h, r) => {
|
|
6
|
+
for (var t in r || (r = {}))
|
|
7
|
+
A.call(r, t) && u(h, t, r[t]);
|
|
8
8
|
if (p)
|
|
9
|
-
for (var t of p(
|
|
10
|
-
S.call(
|
|
9
|
+
for (var t of p(r))
|
|
10
|
+
S.call(r, t) && u(h, t, r[t]);
|
|
11
11
|
return h;
|
|
12
|
-
}, f = (h,
|
|
13
|
-
var
|
|
14
|
-
var m = (h,
|
|
12
|
+
}, f = (h, r) => M(h, I(r));
|
|
13
|
+
var o = (h, r, t) => (u(h, typeof r != "symbol" ? r + "" : r, t), t);
|
|
14
|
+
var m = (h, r, t) => new Promise((i, e) => {
|
|
15
15
|
var s = (n) => {
|
|
16
16
|
try {
|
|
17
17
|
l(t.next(n));
|
|
@@ -25,7 +25,7 @@ var m = (h, o, t) => new Promise((i, e) => {
|
|
|
25
25
|
e(c);
|
|
26
26
|
}
|
|
27
27
|
}, l = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(s, a);
|
|
28
|
-
l((t = t.apply(h,
|
|
28
|
+
l((t = t.apply(h, r)).next());
|
|
29
29
|
});
|
|
30
30
|
import * as g from "three";
|
|
31
31
|
import { Controller as _ } from "../base/BasePluginWithData.js";
|
|
@@ -61,7 +61,7 @@ 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
|
-
class
|
|
64
|
+
class at extends _ {
|
|
65
65
|
/** AreaMakerPlugin
|
|
66
66
|
* @param `five` `<Five>` Five 实例
|
|
67
67
|
* @param `params` `<PluginType.Params> | <undefined>` 插件初始化参数
|
|
@@ -71,41 +71,43 @@ class rt extends _ {
|
|
|
71
71
|
super(t);
|
|
72
72
|
// ==================== public properties ====================
|
|
73
73
|
/** 插件当前状态 */
|
|
74
|
-
|
|
74
|
+
o(this, "state");
|
|
75
75
|
/** 标注模型 { id: item } 的映射表 */
|
|
76
|
-
|
|
76
|
+
o(this, "itemMap");
|
|
77
|
+
/** 自定义 DOM */
|
|
78
|
+
o(this, "itemRenderer");
|
|
77
79
|
/** 标注模型容器 */
|
|
78
|
-
|
|
80
|
+
o(this, "modelGroup");
|
|
79
81
|
/** 当前使用的数据 */
|
|
80
|
-
|
|
82
|
+
o(this, "data");
|
|
81
83
|
/** tag 容器 */
|
|
82
|
-
|
|
84
|
+
o(this, "tagDomContainer");
|
|
83
85
|
/** 用于监听容器尺寸变化的 iframe */
|
|
84
|
-
|
|
86
|
+
o(this, "resizeIframe");
|
|
85
87
|
/** 查询问题使用的调试对象 */
|
|
86
|
-
|
|
88
|
+
o(this, "checkMsg", {
|
|
87
89
|
childrenMountedState: ""
|
|
88
90
|
});
|
|
89
91
|
// ==================== private properties ====================
|
|
90
92
|
/** 是否在 Five Change Mode 动画中 */
|
|
91
|
-
|
|
93
|
+
o(this, "isInFiveChangeModeAnime", !1);
|
|
92
94
|
/** 子组件是否挂载 */
|
|
93
|
-
|
|
95
|
+
o(this, "childrenMountedState", !1);
|
|
94
96
|
/** config 的原始值 */
|
|
95
|
-
|
|
97
|
+
o(this, "_config");
|
|
96
98
|
/** disposed 的原始值 */
|
|
97
|
-
|
|
99
|
+
o(this, "_disposed", !1);
|
|
98
100
|
/** 销毁插件,移除所有副作用,销毁后将不响应任何 API */
|
|
99
|
-
|
|
101
|
+
o(this, "dispose", () => {
|
|
100
102
|
this.five.scene.remove(this.modelGroup);
|
|
101
103
|
});
|
|
102
|
-
|
|
104
|
+
o(this, "onFiveInitAnimationWillStart", () => {
|
|
103
105
|
this.isInFiveChangeModeAnime = !0, this.updateChildrenMountedState();
|
|
104
106
|
});
|
|
105
|
-
|
|
107
|
+
o(this, "onFiveInitAnimationEnded", () => {
|
|
106
108
|
this.isInFiveChangeModeAnime = !1, this.updateChildrenMountedState();
|
|
107
109
|
});
|
|
108
|
-
|
|
110
|
+
o(this, "onFiveCameraUpdate", () => {
|
|
109
111
|
const t = this.five.camera;
|
|
110
112
|
[...this.itemMap.values()].sort((e, s) => {
|
|
111
113
|
const a = e.tagPosition.distanceTo(t.position);
|
|
@@ -115,13 +117,13 @@ class rt extends _ {
|
|
|
115
117
|
(a = this.getMaskItemByID(e.id)) == null || a.setTagZIndex(s * 10);
|
|
116
118
|
});
|
|
117
119
|
});
|
|
118
|
-
|
|
120
|
+
o(this, "onFiveModeChange", () => {
|
|
119
121
|
this.updateChildrenMountedState();
|
|
120
122
|
});
|
|
121
|
-
|
|
123
|
+
o(this, "onMakerTagClick", (t) => {
|
|
122
124
|
this.hooks.emit("wantsTap", { target: t.target, intersectObjects: [] });
|
|
123
125
|
});
|
|
124
|
-
|
|
126
|
+
o(this, "onWantsFiveTapGesture", (t) => {
|
|
125
127
|
const i = Array.from(this.itemMap.values()).filter((n) => n.mounted && n.visible).map((n) => ({
|
|
126
128
|
makerItem: n,
|
|
127
129
|
intersects: n.modelGroup.getRaycastIntersects(t)
|
|
@@ -165,7 +167,7 @@ class rt extends _ {
|
|
|
165
167
|
const i = this.data;
|
|
166
168
|
this.data = this.formatData(t), this.hooks.emit("dataChange", this.data, i), this.modelGroup.remove(...this.modelGroup.children), this.itemMap.clear(), this.data.list.forEach((e) => {
|
|
167
169
|
const s = new y(this, e);
|
|
168
|
-
this.modelGroup.add(s.modelGroup), this.itemMap.set(e.id, s), s.hooks.on("tagClick", this.onMakerTagClick);
|
|
170
|
+
s.itemRenderer = this.itemRenderer, this.modelGroup.add(s.modelGroup), this.itemMap.set(e.id, s), s.hooks.on("tagClick", this.onMakerTagClick);
|
|
169
171
|
});
|
|
170
172
|
});
|
|
171
173
|
}
|
|
@@ -336,5 +338,5 @@ class rt extends _ {
|
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
340
|
export {
|
|
339
|
-
|
|
341
|
+
at as Controller
|
|
340
342
|
};
|
|
@@ -106,6 +106,7 @@ export interface ServerDataV2 {
|
|
|
106
106
|
export type ServerData = ServerDataV1 | ServerDataV2;
|
|
107
107
|
/** 插件使用的数据 */
|
|
108
108
|
export type PluginData = ServerDataV2;
|
|
109
|
+
export type ItemRenderer = (container: HTMLElement, item: ServerAreaMakerItem) => () => void;
|
|
109
110
|
export interface ServerAreaMakerItem {
|
|
110
111
|
id: number | string;
|
|
111
112
|
/** 标注名称 */
|
|
@@ -58,6 +58,10 @@ export declare class AreaMakerItem {
|
|
|
58
58
|
tagZIndex: number;
|
|
59
59
|
/** 标注实例的事件处理器 */
|
|
60
60
|
hooks: Subscribe<PluginType.AreaMakerItemEventMap>;
|
|
61
|
+
/** 自定义 Dom */
|
|
62
|
+
itemRenderer?: PluginType.ItemRenderer;
|
|
63
|
+
/** 数据 */
|
|
64
|
+
private data;
|
|
61
65
|
/** Plugin 实例 */
|
|
62
66
|
private plugin;
|
|
63
67
|
/** 标注透明度动画 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (a,
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var f = (a, e, t) => e in a ? d(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var i = (a, e, t) => (f(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import * as n from "three";
|
|
5
5
|
import "hammerjs";
|
|
6
6
|
import "@realsee/five";
|
|
@@ -30,17 +30,17 @@ import "../../shared-utils/animationFrame/index.js";
|
|
|
30
30
|
import "../../vendor/svelte/internal/index.js";
|
|
31
31
|
import "../../components/AreaLabel/Assets/roomLabelBg.js";
|
|
32
32
|
class v extends b {
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(t) {
|
|
34
34
|
super();
|
|
35
35
|
i(this, "areaMakerItem");
|
|
36
|
-
this.areaMakerItem =
|
|
36
|
+
this.areaMakerItem = t;
|
|
37
37
|
}
|
|
38
|
-
raycast(
|
|
39
|
-
this.areaMakerItem.makerObject.raycast(
|
|
38
|
+
raycast(t, s) {
|
|
39
|
+
this.areaMakerItem.makerObject.raycast(t, s);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
class Q {
|
|
43
|
-
constructor(
|
|
43
|
+
constructor(e, t) {
|
|
44
44
|
i(this, "id");
|
|
45
45
|
/** 标注名称 */
|
|
46
46
|
i(this, "name", "");
|
|
@@ -86,6 +86,10 @@ class Q {
|
|
|
86
86
|
i(this, "tagZIndex", 0);
|
|
87
87
|
/** 标注实例的事件处理器 */
|
|
88
88
|
i(this, "hooks", new O());
|
|
89
|
+
/** 自定义 Dom */
|
|
90
|
+
i(this, "itemRenderer");
|
|
91
|
+
/** 数据 */
|
|
92
|
+
i(this, "data");
|
|
89
93
|
/** Plugin 实例 */
|
|
90
94
|
i(this, "plugin");
|
|
91
95
|
/** 标注透明度动画 */
|
|
@@ -113,11 +117,11 @@ class Q {
|
|
|
113
117
|
// })
|
|
114
118
|
// }
|
|
115
119
|
/** 透明度动画 */
|
|
116
|
-
i(this, "doOpacityAnime", (
|
|
120
|
+
i(this, "doOpacityAnime", (e) => {
|
|
117
121
|
var h;
|
|
118
122
|
(h = this.opacityAnime) == null || h.dispose();
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
123
|
+
const t = e.duration, [s, o] = e.makerObjectOpacity, [r, l] = e.outlineOpacity;
|
|
124
|
+
if (t === 0) {
|
|
121
125
|
this.makerObject.material.opacity = o, this.outline.material.opacity = l;
|
|
122
126
|
return;
|
|
123
127
|
}
|
|
@@ -133,8 +137,8 @@ class Q {
|
|
|
133
137
|
});
|
|
134
138
|
});
|
|
135
139
|
/** 插件 Config 变化时更新自身 depthTest */
|
|
136
|
-
i(this, "onPluginConfigChange", (
|
|
137
|
-
this.makerObject.material.depthTest =
|
|
140
|
+
i(this, "onPluginConfigChange", (e) => {
|
|
141
|
+
this.makerObject.material.depthTest = e.config.modelDepthTest, this.outline.material.depthTest = e.config.modelDepthTest, this.plugin.five.needsRender = !0;
|
|
138
142
|
});
|
|
139
143
|
/** 插件整体可见性变化时,需要更新自身可见性 */
|
|
140
144
|
i(this, "onPluginStateChange", () => {
|
|
@@ -142,15 +146,15 @@ class Q {
|
|
|
142
146
|
});
|
|
143
147
|
/** 更新标注可见性 */
|
|
144
148
|
i(this, "updateVisible", () => {
|
|
145
|
-
const { result:
|
|
146
|
-
this.checkMsg.checkVisibleMsg =
|
|
149
|
+
const { result: e, msg: t } = this.checkVisible();
|
|
150
|
+
this.checkMsg.checkVisibleMsg = t, this.visible !== e && (this.visible = e, this.modelGroup.visible = e, this.plugin.five.needsRender = !0);
|
|
147
151
|
});
|
|
148
152
|
/** 检测标注是否可见 */
|
|
149
153
|
i(this, "checkVisible", () => {
|
|
150
154
|
if (!this.plugin.state.visible)
|
|
151
155
|
return { result: !1, msg: "插件不可见" };
|
|
152
|
-
const
|
|
153
|
-
return
|
|
156
|
+
const t = this.plugin.five.model.shownFloor;
|
|
157
|
+
return t === null || t === this.floorIndex ? { result: !0, msg: "" } : { result: !1, msg: `模型高亮楼层不符合展示条件, 当前高亮楼层为:${t}` };
|
|
154
158
|
});
|
|
155
159
|
/** 更新标注标签 */
|
|
156
160
|
i(this, "updateTag", () => {
|
|
@@ -158,20 +162,20 @@ class Q {
|
|
|
158
162
|
});
|
|
159
163
|
/** 更新标注标签的 NDC Position */
|
|
160
164
|
i(this, "updateTagNDCPosition", () => {
|
|
161
|
-
const
|
|
162
|
-
this.tagNDCPosition.copy(
|
|
165
|
+
const t = this.tagPosition.clone().project(this.plugin.five.camera);
|
|
166
|
+
this.tagNDCPosition.copy(t);
|
|
163
167
|
});
|
|
164
168
|
/** 更新标注标签的 transform */
|
|
165
169
|
i(this, "updateTagDomTransform", () => {
|
|
166
170
|
var o;
|
|
167
|
-
const
|
|
168
|
-
this.tagTransform.left ===
|
|
171
|
+
const e = this.tagNDCPosition, t = Math.round((e.x + 1) / 2 * this.plugin.tagDomContainer.clientWidth), s = Math.round((-e.y + 1) / 2 * this.plugin.tagDomContainer.clientHeight);
|
|
172
|
+
this.tagTransform.left === t && this.tagTransform.top === s || (this.tagTransform = { left: t, top: s }, (o = this.tagApp) == null || o.$set({ transform: `translate(${t}px, ${s}px)` }));
|
|
169
173
|
});
|
|
170
174
|
/** 更新标注标签可见性 */
|
|
171
175
|
i(this, "updateTagVisible", () => {
|
|
172
176
|
var s;
|
|
173
|
-
const { result:
|
|
174
|
-
this.checkMsg.checkTagVisibleMsg =
|
|
177
|
+
const { result: e, msg: t } = this.checkTagVisible();
|
|
178
|
+
this.checkMsg.checkTagVisibleMsg = t, this.tagVisible !== e && (this.tagVisible = e, (s = this.tagApp) == null || s.$set({ visible: e }));
|
|
175
179
|
});
|
|
176
180
|
/** 检测标注标签是否可见 */
|
|
177
181
|
i(this, "checkTagVisible", () => {
|
|
@@ -179,9 +183,9 @@ class Q {
|
|
|
179
183
|
return { result: !1, msg: "标注整体不可见" };
|
|
180
184
|
if (this.isInContainerResizeAnimation)
|
|
181
185
|
return { result: !1, msg: "处于容器 resize 动画中" };
|
|
182
|
-
const
|
|
186
|
+
const t = this.plugin.five, s = new n.Raycaster(), o = t.camera.position.clone();
|
|
183
187
|
s.set(o.clone(), this.tagPosition.clone().sub(o).normalize());
|
|
184
|
-
const [r] =
|
|
188
|
+
const [r] = t.model.intersectRaycaster(s), l = this.tagPosition.distanceTo(t.camera.position);
|
|
185
189
|
if (r && r.distance + 0.1 < l)
|
|
186
190
|
return { result: !1, msg: "标注标签被 Five 模型遮挡" };
|
|
187
191
|
const h = this.tagNDCPosition;
|
|
@@ -194,14 +198,14 @@ class Q {
|
|
|
194
198
|
/** tag container DOM 发生 resize */
|
|
195
199
|
i(this, "onContainerResize", () => {
|
|
196
200
|
this.isInContainerResizeAnimation === !1 && (this.isInContainerResizeAnimation = !0, this.updateTag());
|
|
197
|
-
const
|
|
201
|
+
const t = () => {
|
|
198
202
|
this.isInContainerResizeAnimation = !1, this.containerResizeTimeoutID = null, this.updateTag();
|
|
199
203
|
};
|
|
200
|
-
this.containerResizeTimeoutID && clearTimeout(this.containerResizeTimeoutID), this.containerResizeTimeoutID = setTimeout(
|
|
204
|
+
this.containerResizeTimeoutID && clearTimeout(this.containerResizeTimeoutID), this.containerResizeTimeoutID = setTimeout(t, 100);
|
|
201
205
|
});
|
|
202
206
|
var p, m, c;
|
|
203
|
-
const s =
|
|
204
|
-
this.id =
|
|
207
|
+
const s = t.object_data, o = s.bottom_y, r = s.height, l = new n.Color((p = s.color) != null ? p : "#FFFFFF"), h = (m = s.opacity) != null ? m : 0.4;
|
|
208
|
+
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 n.Shape().fromJSON(s.shape), this.floorIndex = t.floor_index, this.makerObject = new n.Mesh(g(this.shape, r), M(l, h)), u(this.makerObject, o), this.makerObject.material.depthTest = this.plugin.config.modelDepthTest, this.outline = new k(
|
|
205
209
|
new n.EdgesGeometry(this.makerObject.geometry),
|
|
206
210
|
new n.LineBasicMaterial({ color: l, transparent: !0 })
|
|
207
211
|
), u(this.outline, o), this.outline.material.depthTest = this.plugin.config.modelDepthTest, this.setHeight(r), this.modelGroup = new v(this);
|
|
@@ -209,44 +213,46 @@ class Q {
|
|
|
209
213
|
/** 挂载标注 */
|
|
210
214
|
mount() {
|
|
211
215
|
if (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), !!this.name) {
|
|
212
|
-
const
|
|
216
|
+
const t = this.plugin.tagDomContainer, s = {
|
|
217
|
+
data: this.data,
|
|
213
218
|
content: this.name,
|
|
214
219
|
visible: this.tagVisible,
|
|
220
|
+
renderer: this.itemRenderer,
|
|
215
221
|
transform: `translate(${this.tagTransform.left}px, ${this.tagTransform.top}px)`,
|
|
216
222
|
onClick: (o) => this.hooks.emit("tagClick", { target: this, nativeEvent: o })
|
|
217
223
|
};
|
|
218
|
-
this.tagApp = new T({ target:
|
|
224
|
+
this.tagApp = new T({ target: t, props: s }), this.updateTag();
|
|
219
225
|
}
|
|
220
226
|
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.plugin.resizeIframe.contentWindow.addEventListener("resize", this.onContainerResize);
|
|
221
227
|
}
|
|
222
228
|
/** 卸载标注 */
|
|
223
229
|
unmount() {
|
|
224
|
-
var
|
|
225
|
-
this.mounted = !1, this.modelGroup.remove(...this.modelGroup.children), (
|
|
230
|
+
var e;
|
|
231
|
+
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), this.plugin.resizeIframe.contentWindow.removeEventListener("resize", this.onContainerResize);
|
|
226
232
|
}
|
|
227
233
|
/** 更改标注透明度
|
|
228
234
|
* @param opacity 标注透明度,范围:0-1
|
|
229
235
|
*/
|
|
230
|
-
setOpacity(
|
|
231
|
-
var
|
|
232
|
-
this.opacity =
|
|
236
|
+
setOpacity(e) {
|
|
237
|
+
var t;
|
|
238
|
+
this.opacity = e, (t = this.opacityAnime) == null || t.dispose(), this.makerObject.material.opacity = e, this.plugin.five.needsRender = !0;
|
|
233
239
|
}
|
|
234
240
|
/** 更改标注颜色
|
|
235
241
|
* @param color 标注颜色,支持 hex
|
|
236
242
|
* @example setColor('#FF0000')
|
|
237
243
|
*/
|
|
238
|
-
setColor(
|
|
239
|
-
const
|
|
240
|
-
this.makerObject.material.color =
|
|
244
|
+
setColor(e) {
|
|
245
|
+
const t = new n.Color(e);
|
|
246
|
+
this.makerObject.material.color = t, this.outline.material.color = t, this.plugin.five.needsRender = !0;
|
|
241
247
|
}
|
|
242
248
|
/** 更改标注高度
|
|
243
249
|
* @param height 标注高度,单位:米
|
|
244
250
|
*/
|
|
245
|
-
setHeight(
|
|
246
|
-
if (
|
|
251
|
+
setHeight(e) {
|
|
252
|
+
if (e <= 0)
|
|
247
253
|
throw new Error("高度必须大于 0");
|
|
248
|
-
this.height =
|
|
249
|
-
const
|
|
254
|
+
this.height = e, this.makerObject.geometry = g(this.shape, e), this.outline.geometry = new n.EdgesGeometry(this.makerObject.geometry);
|
|
255
|
+
const t = this.shape.extractPoints(10).shape.slice(0, -1), s = C(t), o = new n.Vector3(s.x, s.y, e);
|
|
250
256
|
u(o, this.bottomY), this.tagPosition.copy(o), this.updateTag(), this.plugin.five.needsRender = !0;
|
|
251
257
|
}
|
|
252
258
|
/** 更改标注标签的显示层级
|
|
@@ -257,27 +263,27 @@ class Q {
|
|
|
257
263
|
* - 标签 A <- 标签 B <- 相机: 标签 A 在标签 B 的后面
|
|
258
264
|
* 但是当前元素是无法感知到这种变化的,所以需要通过父元素调用这个方法来更新标签的层级。
|
|
259
265
|
*/
|
|
260
|
-
setTagZIndex(
|
|
261
|
-
var
|
|
262
|
-
this.tagZIndex !==
|
|
266
|
+
setTagZIndex(e) {
|
|
267
|
+
var t;
|
|
268
|
+
this.tagZIndex !== e && ((t = this.tagApp) == null || t.$set({ zIndex: e }));
|
|
263
269
|
}
|
|
264
270
|
}
|
|
265
|
-
function g(a,
|
|
271
|
+
function g(a, e) {
|
|
266
272
|
return new n.ExtrudeBufferGeometry(a, {
|
|
267
|
-
depth:
|
|
273
|
+
depth: e,
|
|
268
274
|
bevelEnabled: !1
|
|
269
275
|
});
|
|
270
276
|
}
|
|
271
|
-
function M(a,
|
|
277
|
+
function M(a, e) {
|
|
272
278
|
return new n.MeshBasicMaterial({
|
|
273
279
|
color: a,
|
|
274
|
-
opacity:
|
|
280
|
+
opacity: e,
|
|
275
281
|
transparent: !0
|
|
276
282
|
});
|
|
277
283
|
}
|
|
278
|
-
function u(a,
|
|
279
|
-
const
|
|
280
|
-
|
|
284
|
+
function u(a, e) {
|
|
285
|
+
const t = new n.Matrix4(), s = new n.Matrix4().makeRotationX(Math.PI / 2), o = new n.Matrix4().makeTranslation(0, 0, -e), r = new n.Matrix4().makeScale(1, 1, -1);
|
|
286
|
+
t.multiply(s), t.multiply(o), t.multiply(r), a.applyMatrix4(t);
|
|
281
287
|
}
|
|
282
288
|
export {
|
|
283
289
|
Q as AreaMakerItem
|