@realsee/dnalogel 3.3.4 → 3.3.5
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/PanoTagPlugin/controller/TagComputer.d.ts +0 -4
- package/dist/PanoTagPlugin/controller/TagRender.d.ts +4 -0
- package/dist/index.cjs.js +45 -45
- package/dist/index.js +2821 -2789
- package/dist/index.umd.js +37 -37
- package/libs/PanoTagPlugin/Components/TagItem.js +287 -255
- package/libs/PanoTagPlugin/controller/TagComputer.d.ts +0 -4
- package/libs/PanoTagPlugin/controller/TagComputer.js +116 -135
- package/libs/PanoTagPlugin/controller/TagRender.d.ts +4 -0
- package/libs/PanoTagPlugin/controller/TagRender.js +90 -71
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var k = (
|
|
1
|
+
var $ = Object.defineProperty, w = Object.defineProperties;
|
|
2
|
+
var E = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var T = Object.getOwnPropertySymbols;
|
|
4
|
+
var L = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var k = (p, e, i) => e in p ? $(p, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : p[e] = i, h = (p, e) => {
|
|
6
6
|
for (var i in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var i of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, M = (
|
|
13
|
-
import * as
|
|
14
|
-
import { is3DTag as
|
|
15
|
-
import { getTagCenterPosition as
|
|
16
|
-
import { checkRange as
|
|
7
|
+
L.call(e, i) && k(p, i, e[i]);
|
|
8
|
+
if (T)
|
|
9
|
+
for (var i of T(e))
|
|
10
|
+
_.call(e, i) && k(p, i, e[i]);
|
|
11
|
+
return p;
|
|
12
|
+
}, M = (p, e) => w(p, E(e));
|
|
13
|
+
import * as U from "three";
|
|
14
|
+
import { is3DTag as z, isMediaModelTag as D } from "../utils/tag/tagCheck.js";
|
|
15
|
+
import { getTagCenterPosition as P, getTagPosition as O } from "../utils/tagPosition.js";
|
|
16
|
+
import { checkRange as m } from "../utils/checkRange.js";
|
|
17
17
|
import { isPanoramaLike as b, isModelLike as Z } from "../../shared-utils/five/mode.js";
|
|
18
18
|
import "hammerjs";
|
|
19
19
|
import "@realsee/five";
|
|
@@ -64,7 +64,7 @@ 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 I = new
|
|
67
|
+
const I = new U.Raycaster();
|
|
68
68
|
class Je extends N {
|
|
69
69
|
constructor(e) {
|
|
70
70
|
super(e);
|
|
@@ -73,80 +73,80 @@ class Je extends N {
|
|
|
73
73
|
* @description: 获取是否可见
|
|
74
74
|
*/
|
|
75
75
|
getVisible(e, i) {
|
|
76
|
-
const
|
|
77
|
-
if ((
|
|
78
|
-
return
|
|
76
|
+
const f = h(h({}, this.five.getCurrentState()), i), { panoIndex: t, mode: s } = f, d = b(s) ? this.getPanoIndexCache({ panoIndex: t, id: e.id }) : void 0;
|
|
77
|
+
if ((d == null ? void 0 : d.visible) !== void 0)
|
|
78
|
+
return d.visible;
|
|
79
79
|
{
|
|
80
|
-
const
|
|
81
|
-
var r,
|
|
82
|
-
const
|
|
83
|
-
if (typeof
|
|
84
|
-
return { value:
|
|
85
|
-
if (
|
|
86
|
-
return { value: !1, checkedList:
|
|
87
|
-
if (
|
|
88
|
-
return { value: !0, checkedList:
|
|
89
|
-
if (
|
|
90
|
-
const a = typeof
|
|
91
|
-
let
|
|
92
|
-
if (Array.isArray(a) ?
|
|
80
|
+
const o = [], u = (() => {
|
|
81
|
+
var r, l, v;
|
|
82
|
+
const n = (r = this.getTagConfig(e).visibleConfig) != null ? r : {};
|
|
83
|
+
if (typeof n == "function")
|
|
84
|
+
return { value: n(this.five, { tag: e, distance: this.getDistance(e) }), checkedList: o, reason: "config function result" };
|
|
85
|
+
if (n.keep === "hidden")
|
|
86
|
+
return { value: !1, checkedList: o, reason: "config.keep is hidden" };
|
|
87
|
+
if (n.keep === "visible")
|
|
88
|
+
return { value: !0, checkedList: o, reason: "config.keep is visible" };
|
|
89
|
+
if (n.visibleFiveMode !== void 0) {
|
|
90
|
+
const a = typeof n.visibleFiveMode == "function" ? n.visibleFiveMode(e) : n.visibleFiveMode;
|
|
91
|
+
let c = !1;
|
|
92
|
+
if (Array.isArray(a) ? c = a.includes(s) : a === "ModelLike" ? c = Z(s) : a === "PanoramaLike" ? c = !b(s) : a === "all" ? c = !0 : typeof a == "string" && (c = a === s), c === !1)
|
|
93
93
|
return {
|
|
94
94
|
value: !1,
|
|
95
|
-
checkedList:
|
|
95
|
+
checkedList: o,
|
|
96
96
|
reason: "current mode is not included in visibleFiveMode",
|
|
97
|
-
visibleFiveMode:
|
|
98
|
-
mode:
|
|
97
|
+
visibleFiveMode: n.visibleFiveMode,
|
|
98
|
+
mode: s
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
return { value: !1, checkedList:
|
|
103
|
-
if (b(
|
|
104
|
-
if (
|
|
101
|
+
if (n.followModelVisibility === !0 && (s === "Floorplan" || s === "Mapview") && this.getVisibleByFloorIndex(e) === !1)
|
|
102
|
+
return { value: !1, checkedList: o, reason: "followModelVisibility check failed" };
|
|
103
|
+
if (b(s) && n.visiblePanoIndex !== void 0 && n.visiblePanoIndex !== "all" && t !== void 0) {
|
|
104
|
+
if (o.push("visiblePanoIndex"), Array.isArray(n.visiblePanoIndex) && !n.visiblePanoIndex.includes(t))
|
|
105
105
|
return {
|
|
106
106
|
value: !1,
|
|
107
|
-
checkedList:
|
|
108
|
-
reason: `current panoIndex is not included in visiblePano. currentPanoIndex: ${t}, visiblePanoIndex: ${
|
|
107
|
+
checkedList: o,
|
|
108
|
+
reason: `current panoIndex is not included in visiblePano. currentPanoIndex: ${t}, visiblePanoIndex: ${n.visiblePanoIndex}`
|
|
109
109
|
};
|
|
110
|
-
if (
|
|
110
|
+
if (n.visiblePanoIndex === "current" && t !== ((l = e.fiveState) == null ? void 0 : l.panoIndex))
|
|
111
111
|
return {
|
|
112
112
|
value: !1,
|
|
113
|
-
checkedList:
|
|
113
|
+
checkedList: o,
|
|
114
114
|
reason: `current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${t}, tag.panoIndex: ${(v = e.fiveState) == null ? void 0 : v.panoIndex}`
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
117
|
+
if (n.visibleDistance !== void 0 && (o.push("visibleDistance"), n.visibleDistance !== "unLimited")) {
|
|
118
118
|
const a = this.getDistance(e);
|
|
119
|
-
if (
|
|
119
|
+
if (m(a, n.visibleDistance) === !1)
|
|
120
120
|
return {
|
|
121
121
|
value: !1,
|
|
122
|
-
checkedList:
|
|
123
|
-
reason: `distance is not in visibleDistance. distance: ${a}, visibleDistance: ${
|
|
122
|
+
checkedList: o,
|
|
123
|
+
reason: `distance is not in visibleDistance. distance: ${a}, visibleDistance: ${n.visibleDistance}`
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
if (b(
|
|
127
|
-
|
|
126
|
+
if (b(s) && n.angleRange && z(e)) {
|
|
127
|
+
o.push("angleRange");
|
|
128
128
|
const a = this.getAngle(e);
|
|
129
|
-
if (
|
|
130
|
-
return { value: !1, checkedList:
|
|
129
|
+
if (m(a, n.angleRange) === !1)
|
|
130
|
+
return { value: !1, checkedList: o, reason: `angle is not in angleRange. angle: ${a}, angleRange: ${n.angleRange}` };
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
132
|
+
if (n.intersectRaycaster !== !1 && (typeof n.intersectRaycaster != "object" || n.intersectRaycaster.enabled !== !1)) {
|
|
133
|
+
if (o.push("intersectRaycaster"), t === void 0)
|
|
134
134
|
return {
|
|
135
135
|
value: !1,
|
|
136
|
-
checkedList:
|
|
136
|
+
checkedList: o,
|
|
137
137
|
reason: `intersectRaycaster check failed: panoIndex is ${t}`
|
|
138
138
|
};
|
|
139
139
|
const a = this.getTagEnableByIntersect(e, t);
|
|
140
140
|
if (a.value === !1)
|
|
141
|
-
return Object.assign(a, { checkedList:
|
|
141
|
+
return Object.assign(a, { checkedList: o });
|
|
142
142
|
}
|
|
143
143
|
return {
|
|
144
144
|
value: !0,
|
|
145
|
-
checkedList:
|
|
145
|
+
checkedList: o,
|
|
146
146
|
reason: "all check passed"
|
|
147
147
|
};
|
|
148
148
|
})();
|
|
149
|
-
return
|
|
149
|
+
return d && (d.visible = u.value, d.__debug_visible_reason__ = u), u.value;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
@@ -159,22 +159,22 @@ class Je extends N {
|
|
|
159
159
|
if (t.unfolded !== void 0)
|
|
160
160
|
return t.unfolded;
|
|
161
161
|
{
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
162
|
+
const s = this.getTagConfig(e).unfoldedConfig;
|
|
163
|
+
if (!s)
|
|
164
164
|
return;
|
|
165
|
-
const
|
|
166
|
-
if (typeof
|
|
167
|
-
return
|
|
168
|
-
if (
|
|
165
|
+
const d = (() => {
|
|
166
|
+
if (typeof s == "function")
|
|
167
|
+
return s(this.five, { tag: e, distance: this.getDistance(e) });
|
|
168
|
+
if (s.keep === "folded")
|
|
169
169
|
return !1;
|
|
170
|
-
if (
|
|
170
|
+
if (s.keep === "unfolded")
|
|
171
171
|
return !0;
|
|
172
|
-
if (
|
|
172
|
+
if (s.unfoldDistance && m(this.getDistance(e), s.unfoldDistance) === !1)
|
|
173
173
|
return !1;
|
|
174
174
|
})();
|
|
175
|
-
t.unfolded =
|
|
176
|
-
const
|
|
177
|
-
return
|
|
175
|
+
t.unfolded = d;
|
|
176
|
+
const o = this.getUnfoldedByCamera(e);
|
|
177
|
+
return o !== void 0 ? o : t.unfolded;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
@@ -182,7 +182,7 @@ class Je extends N {
|
|
|
182
182
|
*/
|
|
183
183
|
getUnfoldedByCamera(e) {
|
|
184
184
|
return this.getCurrentVisibleState(e) ? (() => {
|
|
185
|
-
var
|
|
185
|
+
var s;
|
|
186
186
|
const t = this.getTagConfig(e).unfoldedConfig;
|
|
187
187
|
if (t) {
|
|
188
188
|
if (typeof t == "function")
|
|
@@ -194,25 +194,25 @@ class Je extends N {
|
|
|
194
194
|
if (t.autoUnfold === void 0 || t.autoUnfold === !1 || t.autoUnfold.enable === !1 || !t.autoUnfold.strategy)
|
|
195
195
|
return;
|
|
196
196
|
if (t.autoUnfold.strategy === "ScreenPostion") {
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
197
|
+
const d = this.getTagProject(e);
|
|
198
|
+
if (d && m(d.x, t.autoUnfold.autoUnfoldProjectX) === !1)
|
|
199
199
|
return !1;
|
|
200
200
|
}
|
|
201
201
|
if (t.autoUnfold.strategy === "MinimumDistance") {
|
|
202
202
|
const u = this.filterPointTag.filter((r) => this.getCurrentVisibleState(r)).filter((r) => {
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
203
|
+
const l = this.getTagProject(r);
|
|
204
|
+
if (!l)
|
|
205
205
|
return !1;
|
|
206
|
-
const { x: v, y: a, z:
|
|
207
|
-
return !(Math.abs(
|
|
208
|
-
}).map((r) => ({ tag: r, id: r.id, tagConfig: this.getTagConfig(r).unfoldedConfig })).filter(({ tag: r, tagConfig:
|
|
206
|
+
const { x: v, y: a, z: c } = l;
|
|
207
|
+
return !(Math.abs(c) > 1 || Math.abs(v) > 1 || Math.abs(a) > 1);
|
|
208
|
+
}).map((r) => ({ tag: r, id: r.id, tagConfig: this.getTagConfig(r).unfoldedConfig })).filter(({ tag: r, tagConfig: l }) => {
|
|
209
209
|
var v, a;
|
|
210
|
-
return !(typeof
|
|
211
|
-
}).map((r) => M(
|
|
212
|
-
const v =
|
|
213
|
-
return !(v &&
|
|
214
|
-
}).sort((r,
|
|
215
|
-
if (u === -1 || u <= ((
|
|
210
|
+
return !(typeof l == "function" || l.keep || l.autoUnfold === !1 || ((v = l.autoUnfold) == null ? void 0 : v.enable) === !1 || ((a = l.autoUnfold) == null ? void 0 : a.strategy) !== "MinimumDistance");
|
|
211
|
+
}).map((r) => M(h({}, r), { distance: this.getDistance(r.tag) })).filter(({ distance: r, tagConfig: l }) => {
|
|
212
|
+
const v = l.autoUnfold.distance;
|
|
213
|
+
return !(v && m(r, v) === !1);
|
|
214
|
+
}).sort((r, l) => r.distance - l.distance).findIndex((r) => r.id === e.id);
|
|
215
|
+
if (u === -1 || u <= ((s = t.autoUnfold.maxNumber) != null ? s : 1) - 1 === !1)
|
|
216
216
|
return !1;
|
|
217
217
|
}
|
|
218
218
|
return !0;
|
|
@@ -228,37 +228,18 @@ class Je extends N {
|
|
|
228
228
|
const i = this.getDistance(e);
|
|
229
229
|
return Math.round((1e4 - (i != null ? i : 0)) * 100);
|
|
230
230
|
}
|
|
231
|
-
/**
|
|
232
|
-
* @description: 一个点的标签
|
|
233
|
-
*/
|
|
234
|
-
setPointTagPosition() {
|
|
235
|
-
const e = this.filterPointTag;
|
|
236
|
-
e.length !== 0 && e.forEach((i) => {
|
|
237
|
-
var f;
|
|
238
|
-
const l = this.getCurrentVisibleState(i), t = (f = i.__Object__) != null ? f : {
|
|
239
|
-
timeoutId: void 0,
|
|
240
|
-
inAnimation: !0
|
|
241
|
-
};
|
|
242
|
-
if (i.__Object__ = t, !l && i.screenPosition ? (t.inAnimation = !0, t.timeoutId = setTimeout(() => {
|
|
243
|
-
this.getCurrentVisibleState(i) || (t.inAnimation = !1, i.screenPosition = null);
|
|
244
|
-
}, 1e3)) : t.timeoutId && (t.inAnimation = !1, clearTimeout(t.timeoutId)), !l && !t.inAnimation)
|
|
245
|
-
return;
|
|
246
|
-
const n = this.getTagProject(i);
|
|
247
|
-
n ? i.screenPosition = { leftPercent: (n.x + 1) / 2 * 100, topPercent: (-n.y + 1) / 2 * 100 } : i.screenPosition = null;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
231
|
setVisible(e) {
|
|
251
232
|
(e != null ? e : this.tags).forEach((i) => {
|
|
252
|
-
const
|
|
253
|
-
i.state && (i.state.visible =
|
|
233
|
+
const f = this.getVisible(i);
|
|
234
|
+
i.state && (i.state.visible = f);
|
|
254
235
|
});
|
|
255
236
|
}
|
|
256
237
|
setUnfoldedByPanoIndex() {
|
|
257
238
|
this.tags.forEach((e) => {
|
|
258
239
|
const i = this.getUnfoldedByPanoIndex(e);
|
|
259
240
|
if (e.state && (i !== void 0 && (e.state.unfolded = i), i && !e.state.visible)) {
|
|
260
|
-
const
|
|
261
|
-
typeof
|
|
241
|
+
const f = this.getTagConfig(e);
|
|
242
|
+
typeof f.unfoldedConfig == "object" && f.unfoldedConfig.autoFoldWhenHide !== !1 && (e.state.unfolded = !1);
|
|
262
243
|
}
|
|
263
244
|
});
|
|
264
245
|
}
|
|
@@ -266,59 +247,59 @@ class Je extends N {
|
|
|
266
247
|
* @description 一个点的标签
|
|
267
248
|
*/
|
|
268
249
|
getTagProject(e) {
|
|
269
|
-
const i =
|
|
250
|
+
const i = P(e);
|
|
270
251
|
if (!i)
|
|
271
252
|
return;
|
|
272
|
-
const { x:
|
|
273
|
-
if (!(
|
|
274
|
-
return { x:
|
|
253
|
+
const { x: f, y: t, z: s } = i.project(this.five.camera);
|
|
254
|
+
if (!(s > 1))
|
|
255
|
+
return { x: f, y: t, z: s };
|
|
275
256
|
}
|
|
276
257
|
/** 通过射线检测标签可用性 */
|
|
277
258
|
getTagEnableByIntersect(e, i) {
|
|
278
|
-
var
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
259
|
+
var n, r, l, v, a;
|
|
260
|
+
const f = R(R((n = this.getTagConfig(e).visibleConfig) != null ? n : {}).intersectRaycaster), t = i != null ? i : this.five.getCurrentState().panoIndex, s = b(this.five.getCurrentState().mode) ? this.getObserverPosition(t) : this.five.camera.position;
|
|
261
|
+
if (s === void 0)
|
|
281
262
|
return { value: !1, reason: { type: "startPosition is undefined", fivePanoIndex: t } };
|
|
282
|
-
const
|
|
263
|
+
const d = W(
|
|
283
264
|
(() => {
|
|
284
|
-
var
|
|
285
|
-
const
|
|
286
|
-
return
|
|
265
|
+
var g;
|
|
266
|
+
const c = (g = f.checkPoints) != null ? g : "center";
|
|
267
|
+
return c === "center" ? P(e) : c === "corner" ? O(e) : Array.isArray(c) ? c : [];
|
|
287
268
|
})()
|
|
288
269
|
);
|
|
289
|
-
let
|
|
290
|
-
for (const
|
|
291
|
-
const
|
|
292
|
-
I.set(
|
|
293
|
-
const
|
|
270
|
+
let o = 0, u = 0;
|
|
271
|
+
for (const c of d) {
|
|
272
|
+
const g = new U.Vector3().subVectors(c, s).normalize();
|
|
273
|
+
I.set(s, g);
|
|
274
|
+
const F = s.distanceTo(c), [y] = this.five.model.intersectRaycaster(I), x = (() => {
|
|
294
275
|
if (!D(e))
|
|
295
276
|
return;
|
|
296
|
-
const
|
|
297
|
-
var
|
|
298
|
-
return (
|
|
299
|
-
}).filter(H), [
|
|
300
|
-
return
|
|
301
|
-
})(),
|
|
302
|
-
Math.min((
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
277
|
+
const V = this.tags.filter(D).map((A) => {
|
|
278
|
+
var C;
|
|
279
|
+
return (C = A.model) == null ? void 0 : C.object;
|
|
280
|
+
}).filter(H), [B] = I.intersectObjects(V, !0);
|
|
281
|
+
return B;
|
|
282
|
+
})(), j = (r = f.distanceAccuracy) != null ? r : 0.01;
|
|
283
|
+
Math.min((l = y == null ? void 0 : y.distance) != null ? l : 1 / 0, (v = x == null ? void 0 : x.distance) != null ? v : 1 / 0) + j >= F ? o++ : u++;
|
|
284
|
+
const S = (a = f.needPassed) != null ? a : 1;
|
|
285
|
+
if (o >= S)
|
|
305
286
|
return { value: !0 };
|
|
306
287
|
}
|
|
307
288
|
return u === 0 ? { value: !0 } : {
|
|
308
289
|
value: !1,
|
|
309
290
|
reason: {
|
|
310
291
|
type: "intersectRaycaster check failed",
|
|
311
|
-
passedCount:
|
|
312
|
-
needPassed:
|
|
292
|
+
passedCount: o,
|
|
293
|
+
needPassed: f.needPassed
|
|
313
294
|
}
|
|
314
295
|
};
|
|
315
296
|
}
|
|
316
297
|
/** 检测是否匹配当前楼层 */
|
|
317
298
|
getVisibleByFloorIndex(e) {
|
|
318
|
-
var
|
|
299
|
+
var s, d, o, u, n, r, l;
|
|
319
300
|
let i = 0;
|
|
320
|
-
const
|
|
321
|
-
|
|
301
|
+
const f = (s = e.fiveState) == null ? void 0 : s.panoIndex;
|
|
302
|
+
f !== void 0 ? i = (d = this.work.observers[f]) == null ? void 0 : d.floorIndex : i = q(this.work, (l = (r = (u = (o = e.model) == null ? void 0 : o.object) == null ? void 0 : u.position) != null ? r : (n = e.mediaPlane) == null ? void 0 : n.position) != null ? l : P(e));
|
|
322
303
|
const t = this.five.model.shownFloor;
|
|
323
304
|
return t === null || t === i;
|
|
324
305
|
}
|
|
@@ -55,6 +55,10 @@ export declare abstract class TagRender extends TagComputer {
|
|
|
55
55
|
protected updateTagCss3DObjectMatrix<S extends 'Model' | 'Plane' = 'Model'>(tag: TagInstance<TagContentType, S>, model: Object3D): void;
|
|
56
56
|
/** 添加模型标签 */
|
|
57
57
|
protected addMediaModelTag(tags: Tag[]): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* @description: 一个点的标签
|
|
60
|
+
*/
|
|
61
|
+
protected setPointTagPosition(): void;
|
|
58
62
|
/**
|
|
59
63
|
* @description: 渲染单个点的标签
|
|
60
64
|
*/
|