@realsee/dnalogel 3.72.4-alpha.1 → 3.72.4-alpha.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/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 k = Object.prototype.hasOwnProperty, H = 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
|
+
k.call(h, t) && v(l, t, h[t]);
|
|
8
8
|
if (b)
|
|
9
9
|
for (var t of b(h))
|
|
10
|
-
|
|
10
|
+
H.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 = (a) => {
|
|
16
16
|
try {
|
|
17
|
-
r(t.next(
|
|
17
|
+
r(t.next(a));
|
|
18
18
|
} catch (d) {
|
|
19
19
|
i(d);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, n = (a) => {
|
|
22
22
|
try {
|
|
23
|
-
r(t.throw(
|
|
23
|
+
r(t.throw(a));
|
|
24
24
|
} catch (d) {
|
|
25
25
|
i(d);
|
|
26
26
|
}
|
|
27
|
-
}, r = (
|
|
27
|
+
}, r = (a) => a.done ? e(a.value) : Promise.resolve(a.value).then(s, n);
|
|
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 R } 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 a, 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, n = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : void 0, r = B(this.five, this.wrapper, this.floorIndex, n), a = Math.ceil(i * r), d = Math.ceil(s * r);
|
|
225
|
+
return this.size.width === a && this.size.height === d || (this.container.style.width = a + "px", this.container.style.height = d + "px", this.size = { width: a, 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, n;
|
|
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, (n = this.container) == null || n.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 n;
|
|
244
244
|
if (!this.state.enabled)
|
|
245
245
|
return;
|
|
246
|
-
if (!((
|
|
246
|
+
if (!((n = this.fiveUtil.model) != null && n.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, a;
|
|
261
261
|
this.showRejection = (u) => {
|
|
262
|
-
r = !0,
|
|
262
|
+
r = !0, a = u;
|
|
263
263
|
};
|
|
264
|
-
const [d] = yield
|
|
264
|
+
const [d] = yield R(V(this.five, this.showState, i.userAction));
|
|
265
265
|
if (d)
|
|
266
266
|
throw d;
|
|
267
267
|
if (r)
|
|
268
|
-
throw
|
|
268
|
+
throw a ? new Error(a) : 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, a = i.immediately ? 0 : $;
|
|
276
|
+
E(this.five, r, a), this.render(a), 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 i = this.five.models.find((n) => n.name === this.five.state.workCode).bounding.getCenter(new C.Vector3());
|
|
303
|
+
if (this.showState.offset = i, this.state.enabled === !1 || this.wrapper || !this.selector)
|
|
304
304
|
return;
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
305
|
+
const s = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
|
|
306
|
+
if (!s)
|
|
307
307
|
throw new Error("不正确的父容器选择器");
|
|
308
|
-
this.wrapper =
|
|
308
|
+
this.wrapper = s, s.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 = (a = e.i18n) == null ? void 0 : a.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"]) : {}, n = m(m({}, i.missingFloorConfig), s.missingFloorConfig), r = g(m(m({}, i), s), { missingFloorConfig: n });
|
|
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 n = t;
|
|
398
|
+
n && q(n.version) && console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");
|
|
399
|
+
const r = JSON.parse(JSON.stringify(t)), a = s(r) ? r.data : r, d = this.data;
|
|
400
|
+
this.data = yield A(a), 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, n = i.y - e.y;
|
|
405
|
+
this.data.floorDatas.forEach((r, a) => {
|
|
406
|
+
r.items = t[a].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) / n },
|
|
411
411
|
width: P / s,
|
|
412
|
-
height: x /
|
|
412
|
+
height: x / n,
|
|
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 n = { userAction: s };
|
|
446
|
+
t.visible ? this._show(n) : this._hide(n);
|
|
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, n = -(i.y - 1) / 2;
|
|
459
|
+
this.container.style.left = s * 100 + "%", this.container.style.top = n * 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, n = t.config ? g(m(m({}, i.config), t.config), { missingFloorConfig: s }) : i.config;
|
|
469
|
+
this.state = g(m(m({}, this.state), t), { config: n }), !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.4-alpha.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.72.4-alpha.2",
|
|
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",
|