@realsee/dnalogel 3.72.4-alpha.2 → 3.72.5-alpha.1
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/CHANGELOG.md +4 -0
- package/dist/PanoTagPlugin/controller/Tag/BaseTag.d.ts +8 -0
- package/dist/PanoTagPlugin/controller/Tag/PointTag.d.ts +13 -0
- package/dist/PanoTagPlugin/typings/tag/TagConfig.d.ts +15 -0
- package/dist/PanoTagPlugin/typings/tag/Utils.d.ts +2 -0
- package/dist/index.cjs.js +71 -71
- package/dist/index.js +6803 -6690
- package/dist/index.umd.js +67 -67
- package/libs/ItemLabelPlugin/ItemLabelItem.js +85 -85
- package/libs/PanoMeasurePlugin/Components/Tip.js +51 -51
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +262 -262
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.d.ts +8 -0
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +351 -331
- package/libs/PanoTagPlugin/controller/Tag/PointTag.d.ts +13 -0
- package/libs/PanoTagPlugin/controller/Tag/PointTag.js +143 -42
- package/libs/PanoTagPlugin/tag.config.js +4 -0
- package/libs/PanoTagPlugin/typings/tag/TagConfig.d.ts +15 -0
- package/libs/PanoTagPlugin/typings/tag/Utils.d.ts +2 -0
- package/libs/base/BasePlugin.js +1 -1
- package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +44 -44
- package/libs/shared-utils/logger.js +1 -1
- package/libs/vendor/hotkeys-js/dist/hotkeys.esm.js +139 -151
- package/package.json +2 -2
|
@@ -7,7 +7,11 @@ export type PointTagInterface<C extends TagContentType = TagContentType> = TagIn
|
|
|
7
7
|
export declare class PointTag<C extends TagContentType = TagContentType> extends BaseTag<C, '2DPoint' | '3DPoint'> {
|
|
8
8
|
private __Object__;
|
|
9
9
|
private requestIdleCallbackId?;
|
|
10
|
+
private iconPixelGap;
|
|
11
|
+
private _temp;
|
|
12
|
+
private _lastUpdateCache;
|
|
10
13
|
constructor(plugin: PanoTagPluginController, tagData: TagData);
|
|
14
|
+
initialTagLine(): void;
|
|
11
15
|
/**
|
|
12
16
|
* @description 展开自己,收起其他标签
|
|
13
17
|
*/
|
|
@@ -22,6 +26,11 @@ export declare class PointTag<C extends TagContentType = TagContentType> extends
|
|
|
22
26
|
*/
|
|
23
27
|
setUnfold(unfolded: boolean): void;
|
|
24
28
|
setPosition(position: ArrayPosition): void;
|
|
29
|
+
/**
|
|
30
|
+
* 更新标签连线的位置,使其端点与icon保持固定像素距离
|
|
31
|
+
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
32
|
+
*/
|
|
33
|
+
private updateTagNormalLinePosition;
|
|
25
34
|
updateScreenPosition(params?: {
|
|
26
35
|
force?: boolean;
|
|
27
36
|
}): void;
|
|
@@ -29,4 +38,8 @@ export declare class PointTag<C extends TagContentType = TagContentType> extends
|
|
|
29
38
|
setData(...data: Parameters<InstanceType<typeof BaseTag<C, '2DPoint' | '3DPoint'>>['setData']>): void;
|
|
30
39
|
updateUnfoldedByPanoIndex(): void;
|
|
31
40
|
computeNormal(): THREE.Vector3;
|
|
41
|
+
/**
|
|
42
|
+
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
43
|
+
*/
|
|
44
|
+
protected getAdditionalBlinkTargets(): any | any[] | null;
|
|
32
45
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BaseTag as
|
|
5
|
-
import * as
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var S = (h, l, t) => l in h ? C(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
|
|
3
|
+
var m = (h, l, t) => (S(h, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
|
+
import { BaseTag as N } from "./BaseTag.js";
|
|
5
|
+
import * as s from "three";
|
|
6
|
+
import { Line as T } from "@realsee/five/line";
|
|
7
|
+
import { anyPositionToVector3 as D } from "../../../shared-utils/positionToVector3.js";
|
|
8
|
+
import { transformPosition as A } from "../../../shared-utils/five/transformPosition.js";
|
|
6
9
|
import "../../../shared-utils/Subscribe.js";
|
|
7
10
|
import "../../utils/tag/calculateTagConfig.js";
|
|
8
11
|
import "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -11,13 +14,11 @@ import "../../utils/tag/adaptConfig.js";
|
|
|
11
14
|
import "../../typings/tag/TagConfig.js";
|
|
12
15
|
import "@realsee/five";
|
|
13
16
|
import "../../../shared-utils/tag.js";
|
|
14
|
-
import "../../../shared-utils/positionToVector3.js";
|
|
15
17
|
import "../../../shared-utils/five/vector3ToScreen.js";
|
|
16
18
|
import "../../../shared-utils/five/getFiveModel.js";
|
|
17
19
|
import "../../../shared-utils/Utils/FiveUtil.js";
|
|
18
20
|
import "../../../shared-utils/Utils/BaseUtil.js";
|
|
19
21
|
import "../../../shared-utils/Utils/WorkUtil.js";
|
|
20
|
-
import "../../../shared-utils/five/transformPosition.js";
|
|
21
22
|
import "../../../shared-utils/three/temp.js";
|
|
22
23
|
import "../../../shared-utils/three/core/Raycaster.js";
|
|
23
24
|
import "../../../shared-utils/dom/resizeObserver.js";
|
|
@@ -36,7 +37,6 @@ import "../../../shared-utils/three/centerPoint.js";
|
|
|
36
37
|
import "../../../shared-utils/three/getObjectVisible.js";
|
|
37
38
|
import "../../../shared-utils/three/CSS3DRenderer/index.js";
|
|
38
39
|
import "../../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
39
|
-
import "@realsee/five/line";
|
|
40
40
|
import "../../../shared-utils/isNil.js";
|
|
41
41
|
import "../../../shared-utils/three/core/Five_LineMaterial2.js";
|
|
42
42
|
import "../../../shared-utils/three/core/Sphere.js";
|
|
@@ -87,12 +87,56 @@ import "../../../shared-utils/five/getFloorIndex.js";
|
|
|
87
87
|
import "../../../shared-utils/safeObj.js";
|
|
88
88
|
import "../../utils/Cache.js";
|
|
89
89
|
import "../../../shared-utils/promise/withResolvers.js";
|
|
90
|
-
const
|
|
91
|
-
class
|
|
92
|
-
constructor(t,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
const u = new s.Vector2();
|
|
91
|
+
class hi extends N {
|
|
92
|
+
constructor(t, e) {
|
|
93
|
+
var i, o, n, r, a;
|
|
94
|
+
super(t, e);
|
|
95
|
+
m(this, "__Object__");
|
|
96
|
+
m(this, "requestIdleCallbackId");
|
|
97
|
+
// icon 与线条端点的固定像素间距
|
|
98
|
+
m(this, "iconPixelGap", 10);
|
|
99
|
+
// 优化:重用临时对象,避免频繁创建
|
|
100
|
+
m(this, "_temp", {
|
|
101
|
+
lineStart: new s.Vector3(),
|
|
102
|
+
// 线条起点(project后会变成NDC)
|
|
103
|
+
iconPos: new s.Vector3(),
|
|
104
|
+
// icon位置(project后会变成NDC)
|
|
105
|
+
screenDirPixel: new s.Vector2(),
|
|
106
|
+
// 屏幕方向(normalize后会变成单位向量)
|
|
107
|
+
targetNDC: new s.Vector2(),
|
|
108
|
+
// 目标NDC坐标
|
|
109
|
+
lineDir: new s.Vector3(),
|
|
110
|
+
// 线条方向(计算w0时重用)
|
|
111
|
+
lineEnd: new s.Vector3(),
|
|
112
|
+
// 线条终点
|
|
113
|
+
raycaster: new s.Raycaster()
|
|
114
|
+
// 射线投射器
|
|
115
|
+
});
|
|
116
|
+
// 用于变化检测的缓存值(position不需要缓存,因为它基于originPosition计算)
|
|
117
|
+
m(this, "_lastUpdateCache", {
|
|
118
|
+
position: [0, 0, 0],
|
|
119
|
+
screenLeft: 0,
|
|
120
|
+
screenTop: 0,
|
|
121
|
+
visible: !1
|
|
122
|
+
});
|
|
123
|
+
if ((o = (i = e.style) == null ? void 0 : i.point) != null && o.width) {
|
|
124
|
+
const p = (a = (r = (n = e.style) == null ? void 0 : n.point) == null ? void 0 : r.scale) != null ? a : 1;
|
|
125
|
+
this.iconPixelGap = e.style.point.width * p * 1.4 / 2 + 2;
|
|
126
|
+
}
|
|
127
|
+
this.initialTagLine();
|
|
128
|
+
}
|
|
129
|
+
initialTagLine() {
|
|
130
|
+
var o, n, r;
|
|
131
|
+
const t = this.config;
|
|
132
|
+
if (!((o = t == null ? void 0 : t.tagNormalLineConfig) != null && o.enabled) || !this.normalLineLength)
|
|
133
|
+
return;
|
|
134
|
+
const e = this.five.renderer.getSize(u), i = this.five.renderer.getPixelRatio();
|
|
135
|
+
this.tagNormalLine = new T(new s.Vector3().fromArray(this.position), new s.Vector3().fromArray(this.originPosition)), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
|
|
136
|
+
color: new s.Vector3(1, 1, 1),
|
|
137
|
+
linewidth: (r = (n = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : n.lineWidth) != null ? r : 1.2,
|
|
138
|
+
dashed: !1
|
|
139
|
+
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !1, this.tagNormalLine.line.material.dashed = !1, this.tagNormalLine.line.renderOrder = 2, this.tagNormalLine.setResolution(e.width * i, e.height * i), this.tagNormalLine.visible = !1, this.tagNormalLine.name = `tagNormalLine-${this.id}`, this.plugin.group.add(this.tagNormalLine);
|
|
96
140
|
}
|
|
97
141
|
/**
|
|
98
142
|
* @description 展开自己,收起其他标签
|
|
@@ -100,20 +144,20 @@ class Kt extends g {
|
|
|
100
144
|
unfoldAndFoldOthers() {
|
|
101
145
|
if (this.isPopoverConfigEnabled())
|
|
102
146
|
return;
|
|
103
|
-
const t = this.can("fold"),
|
|
104
|
-
t &&
|
|
105
|
-
|
|
147
|
+
const t = this.can("fold"), e = this.can("unfold");
|
|
148
|
+
t && e && (this.state.unfolded = !this.state.unfolded, this.manuallyOperated = !0, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), this.state.unfolded && this.plugin.tags.forEach((i) => {
|
|
149
|
+
i.id !== this.id && i.fold();
|
|
106
150
|
}));
|
|
107
151
|
}
|
|
108
152
|
onClick(t) {
|
|
109
153
|
t.target === "TagPoint" && this.unfoldAndFoldOthers();
|
|
110
154
|
}
|
|
111
155
|
applyVisible() {
|
|
112
|
-
var t,
|
|
113
|
-
this.currentVisible && this.updateScreenPosition(), (t = this.tag3DContentSvelte) != null && t.css3DInstance && (this.tag3DContentSvelte.css3DInstance.visible = this.visible), (
|
|
156
|
+
var t, e;
|
|
157
|
+
this.currentVisible && this.updateScreenPosition(), (t = this.tag3DContentSvelte) != null && t.css3DInstance && (this.tag3DContentSvelte.css3DInstance.visible = this.visible), (e = this.tag3DContentSvelte) == null || e.svelteApp.$set({
|
|
114
158
|
state: this.plugin.state,
|
|
115
159
|
temporaryState: this.temporaryState
|
|
116
|
-
}), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
160
|
+
}), !this.tagNormalLine && this.normalLineLength && this.initialTagLine(), this.tagNormalLine && (this.tagNormalLine.visible = this.visible), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
117
161
|
}
|
|
118
162
|
unfold() {
|
|
119
163
|
this.isPopoverConfigEnabled() || this.setUnfold(!0);
|
|
@@ -128,45 +172,95 @@ class Kt extends g {
|
|
|
128
172
|
setUnfold(t) {
|
|
129
173
|
if (this.isPopoverConfigEnabled())
|
|
130
174
|
return;
|
|
131
|
-
const
|
|
132
|
-
|
|
175
|
+
const e = this.can("fold"), i = this.can("unfold");
|
|
176
|
+
e && i && (this.state.unfolded = t, this.hooks.emit(t ? "unfolded" : "folded"), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
133
177
|
}
|
|
134
178
|
setPosition(t) {
|
|
135
|
-
this.originPosition = t, this.position =
|
|
179
|
+
this.originPosition = t, this.position = (() => {
|
|
180
|
+
const e = this.plugin.workUtil.transform;
|
|
181
|
+
let i = A(D(t), e).toArray();
|
|
182
|
+
if (this.normal && this.normalLineLength) {
|
|
183
|
+
const o = this.computeNormal();
|
|
184
|
+
i = new s.Vector3().fromArray(i).clone().add(o.clone().setLength(this.normalLineLength)).toArray();
|
|
185
|
+
}
|
|
186
|
+
return i;
|
|
187
|
+
})(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 更新标签连线的位置,使其端点与icon保持固定像素距离
|
|
191
|
+
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
192
|
+
*/
|
|
193
|
+
updateTagNormalLinePosition() {
|
|
194
|
+
var _, y, v, L;
|
|
195
|
+
if (!this.screenPosition || !this.tagNormalLine)
|
|
196
|
+
return;
|
|
197
|
+
if (!this.visible) {
|
|
198
|
+
this.tagNormalLine.visible = !1;
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const t = this._lastUpdateCache;
|
|
202
|
+
if (!(this.visible !== t.visible)) {
|
|
203
|
+
const f = Math.abs(this.position[0] - t.position[0]) > 1e-3 || Math.abs(this.position[1] - t.position[1]) > 1e-3 || Math.abs(this.position[2] - t.position[2]) > 1e-3, x = Math.abs(((_ = this.screenPosition.leftPx) != null ? _ : 0) - t.screenLeft) > 0.5 || Math.abs(((y = this.screenPosition.topPx) != null ? y : 0) - t.screenTop) > 0.5;
|
|
204
|
+
if (!f && !x)
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
t.position = new s.Vector3().fromArray(this.position).toArray(), t.screenLeft = (v = this.screenPosition.leftPx) != null ? v : 0, t.screenTop = (L = this.screenPosition.topPx) != null ? L : 0, t.visible = this.visible;
|
|
208
|
+
const i = this.five.renderer.getSize(u);
|
|
209
|
+
this._temp.lineStart.fromArray(this.originPosition), this._temp.iconPos.fromArray(this.position), this._temp.lineStart.project(this.five.camera), this._temp.iconPos.project(this.five.camera), this._temp.screenDirPixel.set(
|
|
210
|
+
(this._temp.iconPos.x - this._temp.lineStart.x) * i.x / 2,
|
|
211
|
+
(this._temp.iconPos.y - this._temp.lineStart.y) * i.y / 2
|
|
212
|
+
);
|
|
213
|
+
const o = this._temp.screenDirPixel.length();
|
|
214
|
+
this._temp.screenDirPixel.normalize(), this._temp.targetNDC.set(
|
|
215
|
+
(this._temp.iconPos.x * i.x / 2 - this._temp.screenDirPixel.x * this.iconPixelGap) / (i.x / 2),
|
|
216
|
+
(this._temp.iconPos.y * i.y / 2 - this._temp.screenDirPixel.y * this.iconPixelGap) / (i.y / 2)
|
|
217
|
+
), this._temp.raycaster.setFromCamera(this._temp.targetNDC, this.five.camera);
|
|
218
|
+
const n = this._temp.raycaster.ray;
|
|
219
|
+
this._temp.lineStart.fromArray(this.originPosition), this._temp.iconPos.fromArray(this.position), this._temp.lineDir.copy(this._temp.iconPos).sub(this._temp.lineStart).normalize(), this._temp.lineEnd.copy(n.origin).sub(this._temp.lineStart);
|
|
220
|
+
const r = n.direction.dot(n.direction), a = n.direction.dot(this._temp.lineDir), p = this._temp.lineDir.dot(this._temp.lineDir), c = n.direction.dot(this._temp.lineEnd), d = this._temp.lineDir.dot(this._temp.lineEnd), g = r * p - a * a;
|
|
221
|
+
let P = 0;
|
|
222
|
+
Math.abs(g) > 1e-4 && (P = (a * d - p * c) / g), this._temp.lineEnd.copy(n.origin).add(n.direction.multiplyScalar(Math.max(0, P)));
|
|
223
|
+
const b = this._temp.lineStart.distanceTo(this._temp.iconPos);
|
|
224
|
+
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > b) {
|
|
225
|
+
const f = Math.max(0, 1 - this.iconPixelGap / o);
|
|
226
|
+
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos, f);
|
|
227
|
+
}
|
|
228
|
+
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0, this.five.needsRender = !0;
|
|
136
229
|
}
|
|
137
230
|
updateScreenPosition(t) {
|
|
138
|
-
var
|
|
231
|
+
var r;
|
|
139
232
|
if (this.stickType !== "2DPoint" && this.stickType !== "3DPoint")
|
|
140
233
|
return;
|
|
141
|
-
const { force:
|
|
234
|
+
const { force: e = !1 } = t != null ? t : {}, i = e ? this.state.visible : this.currentVisible, o = (r = this.__Object__) != null ? r : {
|
|
142
235
|
timeoutId: void 0,
|
|
143
236
|
inAnimation: !1
|
|
144
237
|
};
|
|
145
|
-
if (this.__Object__ =
|
|
238
|
+
if (this.__Object__ = o, !i && this.screenPosition ? (o.inAnimation = !0, o.timeoutId = setTimeout(() => {
|
|
146
239
|
requestAnimationFrame(() => {
|
|
147
|
-
this.currentVisible || (
|
|
240
|
+
this.currentVisible || (o.inAnimation = !1, this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
148
241
|
});
|
|
149
|
-
}, 1e3)) :
|
|
242
|
+
}, 1e3)) : o.timeoutId && (clearTimeout(o.timeoutId), o.inAnimation = !1, o.timeoutId = void 0), !i && !o.inAnimation)
|
|
150
243
|
return;
|
|
151
244
|
const n = this.computeTagProject();
|
|
152
245
|
if (n && this.five.renderer) {
|
|
153
|
-
const
|
|
246
|
+
const a = this.getDistance(void 0, 1), p = (() => {
|
|
154
247
|
if (!this.currentConfig.simulate3D)
|
|
155
248
|
return 1;
|
|
156
|
-
const
|
|
157
|
-
return Math.max(Math.min(1 -
|
|
158
|
-
})(),
|
|
249
|
+
const d = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
|
|
250
|
+
return Math.max(Math.min(1 - d * a / 40, 1), 0.7);
|
|
251
|
+
})(), c = this.five.renderer.getSize(u);
|
|
159
252
|
this.screenPosition = {
|
|
160
|
-
leftPx: (n.x + 1) / 2 *
|
|
161
|
-
topPx: (-n.y + 1) / 2 *
|
|
162
|
-
scale:
|
|
163
|
-
};
|
|
253
|
+
leftPx: (n.x + 1) / 2 * c.x,
|
|
254
|
+
topPx: (-n.y + 1) / 2 * c.y,
|
|
255
|
+
scale: p
|
|
256
|
+
}, this.updateTagNormalLinePosition();
|
|
164
257
|
} else
|
|
165
258
|
this.screenPosition = null;
|
|
166
259
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
167
260
|
}
|
|
168
|
-
set(t,
|
|
169
|
-
|
|
261
|
+
set(t, e = !0) {
|
|
262
|
+
var o, n;
|
|
263
|
+
super.set(t, e), ((n = (o = t.style) == null ? void 0 : o.point) == null ? void 0 : n.normalLen) !== void 0 && (this.normalLineLength = t.style.point.normalLen, this._lastUpdateCache.position = [0, 0, 0]), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), t.position && this.setPosition(this.position);
|
|
170
264
|
}
|
|
171
265
|
setData(...t) {
|
|
172
266
|
super.setData(...t), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -176,14 +270,21 @@ class Kt extends g {
|
|
|
176
270
|
return;
|
|
177
271
|
const t = this.getUnfoldedByPanoIndex();
|
|
178
272
|
if (this.state && (t !== void 0 && (this.state.unfolded = t), t && !this.state.visible)) {
|
|
179
|
-
const
|
|
180
|
-
typeof
|
|
273
|
+
const e = this.getConfig();
|
|
274
|
+
typeof e.unfoldedConfig == "object" && e.unfoldedConfig.autoFoldWhenHide !== !1 && (this.state.unfolded = !1);
|
|
181
275
|
}
|
|
182
276
|
}
|
|
183
277
|
computeNormal() {
|
|
184
|
-
return new
|
|
278
|
+
return new s.Vector3().fromArray(this.normal);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @description 获取额外的闪烁目标,包括法线(如果有)
|
|
282
|
+
*/
|
|
283
|
+
getAdditionalBlinkTargets() {
|
|
284
|
+
var t;
|
|
285
|
+
return (t = this.tagNormalLine) != null && t.line ? this.tagNormalLine.line : null;
|
|
185
286
|
}
|
|
186
287
|
}
|
|
187
288
|
export {
|
|
188
|
-
|
|
289
|
+
hi as PointTag
|
|
189
290
|
};
|
|
@@ -356,6 +356,21 @@ export interface TagConfig<C extends TagContentType = TagContentType> {
|
|
|
356
356
|
*/
|
|
357
357
|
beforeOpen?: (tag?: TagInstance) => boolean | undefined;
|
|
358
358
|
};
|
|
359
|
+
/**
|
|
360
|
+
* @description 标签法线相关配置
|
|
361
|
+
*/
|
|
362
|
+
tagNormalLineConfig?: {
|
|
363
|
+
/**
|
|
364
|
+
* @description 是否启用标签法线
|
|
365
|
+
* @default true
|
|
366
|
+
*/
|
|
367
|
+
enabled?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* @description 标签法线宽度
|
|
370
|
+
* @default 1.2
|
|
371
|
+
*/
|
|
372
|
+
lineWidth?: number;
|
|
373
|
+
};
|
|
359
374
|
}
|
|
360
375
|
export declare const defaultGlobalConfig: TagConfig;
|
|
361
376
|
type ConfigFunction = (five: Five, tagState: {
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
var O = Object.defineProperty, D = Object.defineProperties;
|
|
2
2
|
var T = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var b = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var H = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var v = (l, h, t) => h in l ? O(l, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[h] = t, m = (l, h) => {
|
|
6
6
|
for (var t in h || (h = {}))
|
|
7
|
-
|
|
7
|
+
H.call(h, t) && v(l, t, h[t]);
|
|
8
8
|
if (b)
|
|
9
9
|
for (var t of b(h))
|
|
10
|
-
|
|
10
|
+
R.call(h, t) && v(l, t, h[t]);
|
|
11
11
|
return l;
|
|
12
12
|
}, g = (l, h) => D(l, T(h));
|
|
13
13
|
var o = (l, h, t) => (v(l, typeof h != "symbol" ? h + "" : h, t), t);
|
|
14
14
|
var f = (l, h, t) => new Promise((e, i) => {
|
|
15
|
-
var s = (
|
|
15
|
+
var s = (n) => {
|
|
16
16
|
try {
|
|
17
|
-
r(t.next(
|
|
17
|
+
r(t.next(n));
|
|
18
18
|
} catch (d) {
|
|
19
19
|
i(d);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, a = (n) => {
|
|
22
22
|
try {
|
|
23
|
-
r(t.throw(
|
|
23
|
+
r(t.throw(n));
|
|
24
24
|
} catch (d) {
|
|
25
25
|
i(d);
|
|
26
26
|
}
|
|
27
|
-
}, r = (
|
|
27
|
+
}, r = (n) => n.done ? e(n.value) : Promise.resolve(n.value).then(s, a);
|
|
28
28
|
r((t = t.apply(l, h)).next());
|
|
29
29
|
});
|
|
30
30
|
import S from "./items.js";
|
|
31
31
|
import * as C from "three";
|
|
32
|
-
import { to as
|
|
32
|
+
import { to as k } from "../../shared-utils/to.js";
|
|
33
33
|
import { equal as U } from "../../shared-utils/equal.js";
|
|
34
34
|
import { Main as N } from "../Components/Main.js";
|
|
35
35
|
import { formatData as A } from "../utils/formatData.js";
|
|
@@ -156,7 +156,7 @@ function Q(l) {
|
|
|
156
156
|
}
|
|
157
157
|
class li extends G {
|
|
158
158
|
constructor(t, e) {
|
|
159
|
-
var
|
|
159
|
+
var n, d;
|
|
160
160
|
super(t);
|
|
161
161
|
// =============== public properties =================
|
|
162
162
|
o(this, "name", "modelFloorplanPlugin");
|
|
@@ -221,8 +221,8 @@ class li extends G {
|
|
|
221
221
|
o(this, "updateSize", () => {
|
|
222
222
|
if (!this.data || !this.container || !this.wrapper)
|
|
223
223
|
return !1;
|
|
224
|
-
const { min: t, max: e } = this.data.bounding, i = e.x - t.x, s = e.y - t.y,
|
|
225
|
-
return this.size.width ===
|
|
224
|
+
const { min: t, max: e } = this.data.bounding, i = e.x - t.x, s = e.y - t.y, a = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : void 0, r = B(this.five, this.wrapper, this.floorIndex, a), n = Math.ceil(i * r), d = Math.ceil(s * r);
|
|
225
|
+
return this.size.width === n && this.size.height === d || (this.container.style.width = n + "px", this.container.style.height = d + "px", this.size = { width: n, height: d }), !0;
|
|
226
226
|
});
|
|
227
227
|
o(this, "highlight", (t) => {
|
|
228
228
|
this.state.config.highlightEnable && (this.highlightData = t, this.render());
|
|
@@ -231,19 +231,19 @@ class li extends G {
|
|
|
231
231
|
this.highlightData = {}, this.render();
|
|
232
232
|
});
|
|
233
233
|
o(this, "_disable", (t) => {
|
|
234
|
-
var i, s,
|
|
234
|
+
var i, s, a;
|
|
235
235
|
const { userAction: e } = t;
|
|
236
|
-
this.hooks.emit("disable", { userAction: e }), (i = this.showRejection) == null || i.call(this, c.BreakOffByDisable), this.showPromise = void 0, (s = this.app) == null || s.$destroy(), this.app = void 0, (
|
|
236
|
+
this.hooks.emit("disable", { userAction: e }), (i = this.showRejection) == null || i.call(this, c.BreakOffByDisable), this.showPromise = void 0, (s = this.app) == null || s.$destroy(), this.app = void 0, (a = this.container) == null || a.remove(), this.removeEventListener();
|
|
237
237
|
});
|
|
238
238
|
o(this, "_enable", (t) => {
|
|
239
239
|
const { userAction: e } = t;
|
|
240
240
|
this.addEventListener(), this.wrapper && (this.wrapper.append(this.container), this.hooks.emit("enable", { userAction: e }), this.state.visible && this._show({ userAction: e }));
|
|
241
241
|
});
|
|
242
242
|
o(this, "_show", (t) => f(this, null, function* () {
|
|
243
|
-
var
|
|
243
|
+
var a;
|
|
244
244
|
if (!this.state.enabled)
|
|
245
245
|
return;
|
|
246
|
-
if (!((
|
|
246
|
+
if (!((a = this.fiveUtil.model) != null && a.loaded))
|
|
247
247
|
throw new Error(c.ModelNotLoaded);
|
|
248
248
|
if (!this.data)
|
|
249
249
|
throw new Error(c.DataNotLoaded);
|
|
@@ -257,23 +257,23 @@ class li extends G {
|
|
|
257
257
|
userAction: !0
|
|
258
258
|
}, i = m(m({}, e), t), s = () => f(this, null, function* () {
|
|
259
259
|
this.hooks.emit("show", { userAction: i.userAction, auto: i.isAutoShow });
|
|
260
|
-
let r = !1,
|
|
260
|
+
let r = !1, n;
|
|
261
261
|
this.showRejection = (u) => {
|
|
262
|
-
r = !0,
|
|
262
|
+
r = !0, n = u;
|
|
263
263
|
};
|
|
264
|
-
const [d] = yield
|
|
264
|
+
const [d] = yield k(V(this.five, this.showState, i.userAction));
|
|
265
265
|
if (d)
|
|
266
266
|
throw d;
|
|
267
267
|
if (r)
|
|
268
|
-
throw
|
|
268
|
+
throw n ? new Error(n) : new Error(c.UnknownError);
|
|
269
269
|
if (!this.updateSize())
|
|
270
270
|
throw new Error(c.UpdateSizeError);
|
|
271
271
|
this.updatePosition(), this.floorIndex = i.floorIndex, this.fiveUtil.model.show(this.floorIndex);
|
|
272
272
|
});
|
|
273
273
|
return this.isHiddenByHideFunc = !1, this.showPromise = s().then(() => {
|
|
274
274
|
this.showPromise = void 0, this.showRejection = void 0;
|
|
275
|
-
const r = i.modelOpacity,
|
|
276
|
-
E(this.five, r,
|
|
275
|
+
const r = i.modelOpacity, n = i.immediately ? 0 : $;
|
|
276
|
+
E(this.five, r, n), this.render(n), this.hooks.emit("showAnimationEnded", {
|
|
277
277
|
auto: i.isAutoShow,
|
|
278
278
|
userAction: i.userAction
|
|
279
279
|
});
|
|
@@ -299,13 +299,13 @@ class li extends G {
|
|
|
299
299
|
});
|
|
300
300
|
/** modelLoaded 之后自动执行 append container 操作 */
|
|
301
301
|
o(this, "onFiveModelLoaded", () => {
|
|
302
|
-
const
|
|
303
|
-
if (this.showState.offset =
|
|
302
|
+
const e = this.five.model.bounding.getCenter(new C.Vector3());
|
|
303
|
+
if (this.showState.offset = e, this.state.enabled === !1 || this.wrapper || !this.selector)
|
|
304
304
|
return;
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
305
|
+
const i = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
|
|
306
|
+
if (!i)
|
|
307
307
|
throw new Error("不正确的父容器选择器");
|
|
308
|
-
this.wrapper =
|
|
308
|
+
this.wrapper = i, i.append(this.container);
|
|
309
309
|
});
|
|
310
310
|
/** 更改模型时,自动隐藏户型图 */
|
|
311
311
|
o(this, "onFiveModeChange", (t) => {
|
|
@@ -360,7 +360,7 @@ class li extends G {
|
|
|
360
360
|
imageURL: X(e == null ? void 0 : e.staticPrefix, J),
|
|
361
361
|
imageWidth: 200,
|
|
362
362
|
imageHeight: 120,
|
|
363
|
-
text: (d = (
|
|
363
|
+
text: (d = (n = e.i18n) == null ? void 0 : n.call(e, "暂无平面图")) != null ? d : "暂无平面图",
|
|
364
364
|
textFontSize: 14
|
|
365
365
|
};
|
|
366
366
|
const i = {
|
|
@@ -386,7 +386,7 @@ class li extends G {
|
|
|
386
386
|
getRoomAreaText: (p) => (p / 1e6).toFixed(1) + "㎡",
|
|
387
387
|
getRoomDimensionText: (p, u) => (p / 1e3).toFixed(1) + "m × " + (u / 1e3).toFixed(1) + "m",
|
|
388
388
|
getRuleDistanceText: (p) => p.toString()
|
|
389
|
-
}, s = e ? F(e, ["selector", "scale"]) : {},
|
|
389
|
+
}, s = e ? F(e, ["selector", "scale"]) : {}, a = m(m({}, i.missingFloorConfig), s.missingFloorConfig), r = g(m(m({}, i), s), { missingFloorConfig: a });
|
|
390
390
|
this.state = { enabled: !0, visible: !1, config: r }, this.panoIndex = t.getCurrentState().panoIndex, this.initContainer(), Y(t).then(this.onFiveModelLoaded), t.once("dispose", this.dispose), this.addEventListener();
|
|
391
391
|
}
|
|
392
392
|
load(t, e, i = !0) {
|
|
@@ -394,22 +394,22 @@ class li extends G {
|
|
|
394
394
|
function s(p) {
|
|
395
395
|
return Object.prototype.hasOwnProperty.apply(p, ["version"]);
|
|
396
396
|
}
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
const r = JSON.parse(JSON.stringify(t)),
|
|
400
|
-
this.data = yield A(
|
|
397
|
+
const a = t;
|
|
398
|
+
a && q(a.version) && console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");
|
|
399
|
+
const r = JSON.parse(JSON.stringify(t)), n = s(r) ? r.data : r, d = this.data;
|
|
400
|
+
this.data = yield A(n), this.hooks.emit("dataLoaded", this.data), this.hooks.emit("dataChange", this.data, d), e && this.updateState(e, i), this.render();
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
loadItems(t) {
|
|
404
|
-
const { min: e, max: i } = this.data.bounding, s = i.x - e.x,
|
|
405
|
-
this.data.floorDatas.forEach((r,
|
|
406
|
-
r.items = t[
|
|
404
|
+
const { min: e, max: i } = this.data.bounding, s = i.x - e.x, a = i.y - e.y;
|
|
405
|
+
this.data.floorDatas.forEach((r, n) => {
|
|
406
|
+
r.items = t[n].filter((d) => d.displayName === "Item-SimpleItem").map((d) => {
|
|
407
407
|
const { x: p, y: u, width: P, height: x, notes: y, type: w, id: I, rotateX: M, rotateY: L, rotateZ: _ = 0 } = d;
|
|
408
408
|
return {
|
|
409
409
|
id: I,
|
|
410
|
-
positionInImage: { x: (p - e.x) / s, y: (i.y - u) /
|
|
410
|
+
positionInImage: { x: (p - e.x) / s, y: (i.y - u) / a },
|
|
411
411
|
width: P / s,
|
|
412
|
-
height: x /
|
|
412
|
+
height: x / a,
|
|
413
413
|
src: Z + S[w].href.replace(/\{\{\stheme\s\}\}/, "realsee"),
|
|
414
414
|
notes: y || S[w].description,
|
|
415
415
|
rotateX: M,
|
|
@@ -442,8 +442,8 @@ class li extends G {
|
|
|
442
442
|
setState(t, e = {}) {
|
|
443
443
|
const i = this.state, s = e.userAction !== void 0 ? e.userAction : !0;
|
|
444
444
|
if (this.updateState(t, s), t.enabled !== void 0 && i.enabled !== t.enabled && (t.enabled ? this._enable({ userAction: s }) : this._disable({ userAction: s })), t.visible !== void 0 && i.visible !== t.visible) {
|
|
445
|
-
const
|
|
446
|
-
t.visible ? this._show(
|
|
445
|
+
const a = { userAction: s };
|
|
446
|
+
t.visible ? this._show(a) : this._hide(a);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
changeConfigs(t, e = !0) {
|
|
@@ -455,8 +455,8 @@ class li extends G {
|
|
|
455
455
|
const t = j(this.five, this.floorIndex, this.state.config.attachedTo), e = (r = this.fiveUtil.model) == null ? void 0 : r.bounding.getCenter(new C.Vector3()).setY(t);
|
|
456
456
|
if (!e)
|
|
457
457
|
return;
|
|
458
|
-
const i = e.clone().project(this.five.camera), s = (i.x + 1) / 2,
|
|
459
|
-
this.container.style.left = s * 100 + "%", this.container.style.top =
|
|
458
|
+
const i = e.clone().project(this.five.camera), s = (i.x + 1) / 2, a = -(i.y - 1) / 2;
|
|
459
|
+
this.container.style.left = s * 100 + "%", this.container.style.top = a * 100 + "%";
|
|
460
460
|
}
|
|
461
461
|
formatData(t) {
|
|
462
462
|
return f(this, null, function* () {
|
|
@@ -465,8 +465,8 @@ class li extends G {
|
|
|
465
465
|
}
|
|
466
466
|
updateState(t, e) {
|
|
467
467
|
var r;
|
|
468
|
-
const i = this.state, s = (r = t.config) != null && r.missingFloorConfig ? m(m({}, i.config.missingFloorConfig), t.config.missingFloorConfig) : i.config.missingFloorConfig,
|
|
469
|
-
this.state = g(m(m({}, this.state), t), { config:
|
|
468
|
+
const i = this.state, s = (r = t.config) != null && r.missingFloorConfig ? m(m({}, i.config.missingFloorConfig), t.config.missingFloorConfig) : i.config.missingFloorConfig, a = t.config ? g(m(m({}, i.config), t.config), { missingFloorConfig: s }) : i.config;
|
|
469
|
+
this.state = g(m(m({}, this.state), t), { config: a }), !U(this.state, i, { deep: !0 }) && this.hooks.emit("stateChange", { state: this.state, prevState: i, userAction: e });
|
|
470
470
|
}
|
|
471
471
|
/** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
|
|
472
472
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.72.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.72.5-alpha.1",
|
|
4
4
|
[
|
|
5
5
|
"background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
|
|
6
6
|
"background-repeat: no-repeat",
|