@realsee/dnalogel 3.72.5-alpha.3 → 3.72.5-alpha.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/CHANGELOG.md +4 -0
- package/dist/Sculpt/Objects/Polygon/index.d.ts +5 -0
- package/dist/index.cjs.js +30 -30
- package/dist/index.js +602 -596
- package/dist/index.umd.js +25 -25
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +8 -8
- package/libs/PanoTagPlugin/controller/Tag/PointTag.js +78 -76
- package/libs/PanoTagPlugin/controller/index.js +1 -1
- package/libs/Sculpt/Objects/Polygon/index.d.ts +5 -0
- package/libs/Sculpt/Objects/Polygon/index.js +59 -55
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
var Q = Object.defineProperty, Y = Object.defineProperties;
|
|
2
2
|
var ee = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var w = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var R = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var T = Math.pow, V = (m, i, e) => i in m ? Q(m, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[i] = e, y = (m, i) => {
|
|
6
6
|
for (var e in i || (i = {}))
|
|
7
|
-
|
|
7
|
+
R.call(i, e) && V(m, e, i[e]);
|
|
8
8
|
if (w)
|
|
9
9
|
for (var e of w(i))
|
|
10
|
-
|
|
10
|
+
E.call(i, e) && V(m, e, i[e]);
|
|
11
11
|
return m;
|
|
12
12
|
}, S = (m, i) => Y(m, ee(i));
|
|
13
|
-
var
|
|
13
|
+
var O = (m, i) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var t in m)
|
|
16
|
-
|
|
16
|
+
R.call(m, t) && i.indexOf(t) < 0 && (e[t] = m[t]);
|
|
17
17
|
if (m != null && w)
|
|
18
18
|
for (var t of w(m))
|
|
19
|
-
i.indexOf(t) < 0 &&
|
|
19
|
+
i.indexOf(t) < 0 && E.call(m, t) && (e[t] = m[t]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
22
|
var a = (m, i, e) => (V(m, typeof i != "symbol" ? i + "" : i, e), e);
|
|
@@ -406,7 +406,7 @@ class Wi {
|
|
|
406
406
|
this.cache.clear();
|
|
407
407
|
}
|
|
408
408
|
updateVisible() {
|
|
409
|
-
this.enabled ? (this.state.visible = this.getVisible(), this.applyVisible()) : this.applyVisible(), this._updating = !1;
|
|
409
|
+
this.enabled ? (this.state.visible = this.getVisible(), this.applyVisible()) : this.applyVisible(), this.five.needsRender = !0, this._updating = !1;
|
|
410
410
|
}
|
|
411
411
|
updateZIndex() {
|
|
412
412
|
const i = this.getSquaredDistance();
|
|
@@ -512,7 +512,7 @@ class Wi {
|
|
|
512
512
|
if ((u == null ? void 0 : u.value) === !1)
|
|
513
513
|
return u;
|
|
514
514
|
if (n.followModelVisibility === !0 && ["poincare", "aerophoto", "sand"].includes(this.workUtil.fromType) && (o === "Floorplan" || o === "Mapview")) {
|
|
515
|
-
const p = this.computeVisibleByFloorIndex(), { value: v } = p, b =
|
|
515
|
+
const p = this.computeVisibleByFloorIndex(), { value: v } = p, b = O(p, ["value"]);
|
|
516
516
|
if (v === !1)
|
|
517
517
|
return y({ value: !1, checkedList: s, reason: "followModelVisibility check failed" }, b);
|
|
518
518
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BaseTag as
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var M = (p, h, t) => h in p ? I(p, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[h] = t;
|
|
3
|
+
var c = (p, h, t) => (M(p, typeof h != "symbol" ? h + "" : h, t), t);
|
|
4
|
+
import { BaseTag as U } from "./BaseTag.js";
|
|
5
5
|
import * as r from "three";
|
|
6
|
-
import { Line as
|
|
7
|
-
import { anyPositionToVector3 as
|
|
8
|
-
import { transformPosition as
|
|
6
|
+
import { Line as R } from "@realsee/five/line";
|
|
7
|
+
import { anyPositionToVector3 as g } from "../../../shared-utils/positionToVector3.js";
|
|
8
|
+
import { transformPosition as P } from "../../../shared-utils/five/transformPosition.js";
|
|
9
9
|
import "../../../shared-utils/Subscribe.js";
|
|
10
10
|
import "../../utils/tag/calculateTagConfig.js";
|
|
11
11
|
import "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -87,17 +87,17 @@ 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
|
|
90
|
+
const _ = new r.Vector2();
|
|
91
|
+
class Pi extends U {
|
|
92
92
|
constructor(t, e) {
|
|
93
|
-
var i,
|
|
93
|
+
var o, i, n, s, a;
|
|
94
94
|
super(t, e);
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
c(this, "__Object__");
|
|
96
|
+
c(this, "requestIdleCallbackId");
|
|
97
97
|
// icon 与线条端点的固定像素间距
|
|
98
|
-
|
|
98
|
+
c(this, "iconPixelGap", 10);
|
|
99
99
|
// 优化:重用临时对象,避免频繁创建
|
|
100
|
-
|
|
100
|
+
c(this, "_temp", {
|
|
101
101
|
lineStart: new r.Vector3(),
|
|
102
102
|
// 线条起点(project后会变成NDC)
|
|
103
103
|
iconPos: new r.Vector3(),
|
|
@@ -114,30 +114,30 @@ class di extends w {
|
|
|
114
114
|
// 射线投射器
|
|
115
115
|
});
|
|
116
116
|
// 用于变化检测的缓存值
|
|
117
|
-
|
|
117
|
+
c(this, "_lastUpdateCache", {
|
|
118
118
|
position: [0, 0, 0],
|
|
119
119
|
screenLeft: 0,
|
|
120
120
|
screenTop: 0,
|
|
121
121
|
scale: 1,
|
|
122
122
|
visible: !1
|
|
123
123
|
});
|
|
124
|
-
if ((
|
|
125
|
-
const
|
|
126
|
-
this.iconPixelGap = e.style.point.width *
|
|
124
|
+
if ((i = (o = e.style) == null ? void 0 : o.point) != null && i.width) {
|
|
125
|
+
const d = (a = (s = (n = e.style) == null ? void 0 : n.point) == null ? void 0 : s.scale) != null ? a : 1;
|
|
126
|
+
this.iconPixelGap = e.style.point.width * d * 1.4 / 2 + 2;
|
|
127
127
|
}
|
|
128
|
-
this.initialTagLine();
|
|
128
|
+
e.contentType === "Audio" && (this.iconPixelGap = 34 / 2 + 2), this.initialTagLine();
|
|
129
129
|
}
|
|
130
130
|
initialTagLine() {
|
|
131
|
-
var
|
|
131
|
+
var n, s, a;
|
|
132
132
|
const t = this.config;
|
|
133
|
-
if (!((
|
|
133
|
+
if (!this.five.renderer || !((n = t == null ? void 0 : t.tagNormalLineConfig) != null && n.enabled) || !this.normalLineLength)
|
|
134
134
|
return;
|
|
135
|
-
const e = this.five.renderer.getSize(
|
|
136
|
-
this.tagNormalLine = new
|
|
135
|
+
const e = this.five.renderer.getSize(_), o = this.five.renderer.getPixelRatio(), i = P(g(this.originPosition), this.plugin.workUtil.transform);
|
|
136
|
+
this.tagNormalLine = new R(new r.Vector3().fromArray(this.position), i), this.tagNormalLine.points.visible = !1, this.tagNormalLine.setMaterial({
|
|
137
137
|
color: new r.Vector3(1, 1, 1),
|
|
138
|
-
linewidth: (
|
|
138
|
+
linewidth: (a = (s = t == null ? void 0 : t.tagNormalLineConfig) == null ? void 0 : s.lineWidth) != null ? a : 1.2,
|
|
139
139
|
dashed: !1
|
|
140
|
-
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !
|
|
140
|
+
}), this.tagNormalLine.line.material.transparent = !0, this.tagNormalLine.line.material.depthWrite = !1, this.tagNormalLine.line.material.depthTest = !0, this.tagNormalLine.line.material.dashed = !1, this.tagNormalLine.line.renderOrder = 2, this.tagNormalLine.setResolution(e.width * o, e.height * o), this.tagNormalLine.visible = !1, this.tagNormalLine.name = `tagNormalLine-${this.id}`, this.plugin.group.add(this.tagNormalLine);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* @description 展开自己,收起其他标签
|
|
@@ -146,8 +146,8 @@ class di extends w {
|
|
|
146
146
|
if (this.isPopoverConfigEnabled())
|
|
147
147
|
return;
|
|
148
148
|
const t = this.can("fold"), e = this.can("unfold");
|
|
149
|
-
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((
|
|
150
|
-
|
|
149
|
+
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((o) => {
|
|
150
|
+
o.id !== this.id && o.fold();
|
|
151
151
|
}));
|
|
152
152
|
}
|
|
153
153
|
onClick(t) {
|
|
@@ -173,97 +173,99 @@ class di extends w {
|
|
|
173
173
|
setUnfold(t) {
|
|
174
174
|
if (this.isPopoverConfigEnabled())
|
|
175
175
|
return;
|
|
176
|
-
const e = this.can("fold"),
|
|
177
|
-
e &&
|
|
176
|
+
const e = this.can("fold"), o = this.can("unfold");
|
|
177
|
+
e && o && (this.state.unfolded = t, this.hooks.emit(t ? "unfolded" : "folded"), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
178
178
|
}
|
|
179
179
|
setPosition(t) {
|
|
180
180
|
this.originPosition = t, this.position = (() => {
|
|
181
181
|
const e = this.plugin.workUtil.transform;
|
|
182
|
-
let
|
|
182
|
+
let o = P(g(t), e).toArray();
|
|
183
183
|
if (this.normal && this.normalLineLength) {
|
|
184
|
-
const
|
|
185
|
-
|
|
184
|
+
const i = this.computeNormal();
|
|
185
|
+
o = new r.Vector3().fromArray(o).clone().add(i.clone().setLength(this.normalLineLength)).toArray();
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return o;
|
|
188
188
|
})(), this.cache.clear(), this._lastUpdateCache.position = [0, 0, 0], this.updateVisible(), this.updateScreenPosition(), this.updateZIndex(), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* 更新标签连线的位置,使其端点与icon保持固定像素距离
|
|
192
192
|
* 使用屏幕空间反投影方法,确保任意视角下都保持固定像素距离
|
|
193
193
|
*/
|
|
194
|
-
updateTagNormalLinePosition() {
|
|
195
|
-
var
|
|
194
|
+
updateTagNormalLinePosition(t) {
|
|
195
|
+
var L, x, C, N, S, T, D;
|
|
196
196
|
if (!this.screenPosition || !this.tagNormalLine)
|
|
197
197
|
return;
|
|
198
|
-
|
|
198
|
+
const { force: e = !1 } = t != null ? t : {};
|
|
199
|
+
if (!(e ? this.state.visible : this.currentVisible)) {
|
|
199
200
|
this.tagNormalLine.visible = !1;
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
|
-
const
|
|
203
|
-
if (!(this.visible !==
|
|
204
|
-
const
|
|
205
|
-
if (!
|
|
203
|
+
const i = this._lastUpdateCache;
|
|
204
|
+
if (!(this.visible !== i.visible)) {
|
|
205
|
+
const u = Math.abs(this.position[0] - i.position[0]) > 1e-3 || Math.abs(this.position[1] - i.position[1]) > 1e-3 || Math.abs(this.position[2] - i.position[2]) > 1e-3, E = Math.abs(((L = this.screenPosition.leftPx) != null ? L : 0) - i.screenLeft) > 0.5 || Math.abs(((x = this.screenPosition.topPx) != null ? x : 0) - i.screenTop) > 0.5 || Math.abs(((C = this.screenPosition.scale) != null ? C : 1) - i.scale) > 2e-3;
|
|
206
|
+
if (!u && !E)
|
|
206
207
|
return;
|
|
207
208
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
(this._temp.iconPos.
|
|
209
|
+
if (i.position = new r.Vector3().fromArray(this.position).toArray(), i.screenLeft = (N = this.screenPosition.leftPx) != null ? N : 0, i.screenTop = (S = this.screenPosition.topPx) != null ? S : 0, i.scale = (T = this.screenPosition.scale) != null ? T : 1, i.visible = this.visible, !this.five.renderer)
|
|
210
|
+
return;
|
|
211
|
+
const s = this.five.renderer.getSize(_), a = P(g(this.originPosition), this.plugin.workUtil.transform).toArray();
|
|
212
|
+
this._temp.lineStart.fromArray(a), this._temp.iconPos.fromArray(this.position), this._temp.lineStart.project(this.five.camera), this._temp.iconPos.project(this.five.camera), this._temp.screenDirPixel.set(
|
|
213
|
+
(this._temp.iconPos.x - this._temp.lineStart.x) * s.x / 2,
|
|
214
|
+
(this._temp.iconPos.y - this._temp.lineStart.y) * s.y / 2
|
|
213
215
|
);
|
|
214
|
-
const
|
|
216
|
+
const d = this._temp.screenDirPixel.length();
|
|
215
217
|
this._temp.screenDirPixel.normalize();
|
|
216
|
-
const
|
|
218
|
+
const m = this.iconPixelGap * ((D = this.screenPosition.scale) != null ? D : 1);
|
|
217
219
|
this._temp.targetNDC.set(
|
|
218
|
-
(this._temp.iconPos.x *
|
|
219
|
-
(this._temp.iconPos.y *
|
|
220
|
+
(this._temp.iconPos.x * s.x / 2 - this._temp.screenDirPixel.x * m) / (s.x / 2),
|
|
221
|
+
(this._temp.iconPos.y * s.y / 2 - this._temp.screenDirPixel.y * m) / (s.y / 2)
|
|
220
222
|
), this._temp.raycaster.setFromCamera(this._temp.targetNDC, this.five.camera);
|
|
221
|
-
const
|
|
222
|
-
this._temp.lineStart.fromArray(
|
|
223
|
-
const
|
|
224
|
-
let
|
|
225
|
-
Math.abs(
|
|
226
|
-
const
|
|
227
|
-
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) >
|
|
228
|
-
const
|
|
229
|
-
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos,
|
|
223
|
+
const l = this._temp.raycaster.ray;
|
|
224
|
+
this._temp.lineStart.fromArray(a), this._temp.iconPos.fromArray(this.position), this._temp.lineDir.copy(this._temp.iconPos).sub(this._temp.lineStart).normalize(), this._temp.lineEnd.copy(l.origin).sub(this._temp.lineStart);
|
|
225
|
+
const A = l.direction.dot(l.direction), f = l.direction.dot(this._temp.lineDir), y = this._temp.lineDir.dot(this._temp.lineDir), w = l.direction.dot(this._temp.lineEnd), V = this._temp.lineDir.dot(this._temp.lineEnd), v = A * y - f * f;
|
|
226
|
+
let b = 0;
|
|
227
|
+
Math.abs(v) > 1e-4 && (b = (f * V - y * w) / v), this._temp.lineEnd.copy(l.origin).add(l.direction.multiplyScalar(Math.max(0, b)));
|
|
228
|
+
const k = this._temp.lineStart.distanceTo(this._temp.iconPos);
|
|
229
|
+
if (this._temp.lineStart.distanceTo(this._temp.lineEnd) > k) {
|
|
230
|
+
const u = Math.max(0, 1 - m / d);
|
|
231
|
+
this._temp.lineEnd.copy(this._temp.lineStart).lerp(this._temp.iconPos, u);
|
|
230
232
|
}
|
|
231
233
|
this.tagNormalLine.setPoints(this._temp.lineStart, this._temp.lineEnd), this.tagNormalLine.visible = !0;
|
|
232
234
|
}
|
|
233
235
|
updateScreenPosition(t) {
|
|
234
|
-
var
|
|
236
|
+
var s;
|
|
235
237
|
if (this.stickType !== "2DPoint" && this.stickType !== "3DPoint")
|
|
236
238
|
return;
|
|
237
|
-
const { force: e = !1 } = t != null ? t : {},
|
|
239
|
+
const { force: e = !1 } = t != null ? t : {}, o = e ? this.state.visible : this.currentVisible, i = (s = this.__Object__) != null ? s : {
|
|
238
240
|
timeoutId: void 0,
|
|
239
241
|
inAnimation: !1
|
|
240
242
|
};
|
|
241
|
-
if (this.__Object__ =
|
|
243
|
+
if (this.__Object__ = i, !o && this.screenPosition ? (i.inAnimation = !0, i.timeoutId = setTimeout(() => {
|
|
242
244
|
requestAnimationFrame(() => {
|
|
243
|
-
this.currentVisible || (
|
|
245
|
+
this.currentVisible || (i.inAnimation = !1, this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
244
246
|
});
|
|
245
|
-
}, 1e3)) :
|
|
247
|
+
}, 1e3)) : i.timeoutId && (clearTimeout(i.timeoutId), i.inAnimation = !1, i.timeoutId = void 0), !o && !i.inAnimation)
|
|
246
248
|
return;
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
const
|
|
249
|
+
const n = this.computeTagProject();
|
|
250
|
+
if (n && this.five.renderer) {
|
|
251
|
+
const a = this.getDistance(void 0, 1), d = (() => {
|
|
250
252
|
if (!this.currentConfig.simulate3D)
|
|
251
253
|
return 1;
|
|
252
|
-
const
|
|
253
|
-
return Math.max(Math.min(1 -
|
|
254
|
-
})(),
|
|
254
|
+
const l = 2 * Math.tan(0.5 * this.five.camera.fov / 180 * Math.PI);
|
|
255
|
+
return Math.max(Math.min(1 - l * a / 40, 1), 0.7);
|
|
256
|
+
})(), m = this.five.renderer.getSize(_);
|
|
255
257
|
this.screenPosition = {
|
|
256
|
-
leftPx: (
|
|
257
|
-
topPx: (-
|
|
258
|
-
scale:
|
|
259
|
-
}, this.updateTagNormalLinePosition();
|
|
258
|
+
leftPx: (n.x + 1) / 2 * m.x,
|
|
259
|
+
topPx: (-n.y + 1) / 2 * m.y,
|
|
260
|
+
scale: d
|
|
261
|
+
}, this.updateTagNormalLinePosition({ force: t == null ? void 0 : t.force });
|
|
260
262
|
} else
|
|
261
263
|
this.screenPosition = null;
|
|
262
264
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
263
265
|
}
|
|
264
266
|
set(t, e = !0) {
|
|
265
|
-
var
|
|
266
|
-
super.set(t, e), this.normalLineLength = (
|
|
267
|
+
var o, i, n;
|
|
268
|
+
super.set(t, e), this.normalLineLength = (n = (i = (o = t.style) == null ? void 0 : o.point) == null ? void 0 : i.normalLen) != null ? n : 0, this._lastUpdateCache.position = [0, 0, 0], this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), t.position && this.setPosition(this.position);
|
|
267
269
|
}
|
|
268
270
|
setData(...t) {
|
|
269
271
|
super.setData(...t), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
@@ -292,5 +294,5 @@ class di extends w {
|
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
296
|
export {
|
|
295
|
-
|
|
297
|
+
Pi as PointTag
|
|
296
298
|
};
|
|
@@ -678,7 +678,7 @@ class _s extends R {
|
|
|
678
678
|
var e;
|
|
679
679
|
this.tags.length && (this.tags.forEach((t) => {
|
|
680
680
|
var i, o, n, s, r, a;
|
|
681
|
-
(i = t.tag3DContentSvelte) == null || i.dispose(), (n = (o = t.mediaPlane) == null ? void 0 : o.parent) == null || n.remove(t.mediaPlane), (a = (r = (s = t.model) == null ? void 0 : s.object) == null ? void 0 : r.parent) == null || a.remove(t.model.object);
|
|
681
|
+
(i = t.tag3DContentSvelte) == null || i.dispose(), (n = (o = t.mediaPlane) == null ? void 0 : o.parent) == null || n.remove(t.mediaPlane), (a = (r = (s = t.model) == null ? void 0 : s.object) == null ? void 0 : r.parent) == null || a.remove(t.model.object), this.group.remove(t.tagNormalLine);
|
|
682
682
|
}), this.tags = [], this.tagsLengthWillUpdate = !0, this.hooks.emit("tagsLengthChange"), (e = this.TagContainerSvelte) == null || e.$destroy(), this.TagContainerSvelte = void 0, this.disposeAllCSS3DContainer()), this.enabledModelTagSet.clear(), this.cache.clear();
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
@@ -14,6 +14,11 @@ export type PolygonCreateConfig = Partial<PolygonStyle & CreateLimitConfig & Pol
|
|
|
14
14
|
onPointPlaced?: (points: THREE.Vector3[]) => void;
|
|
15
15
|
onUndo?: () => void;
|
|
16
16
|
onRedo?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* @description 检测是否自相交,如果自交,禁止添加下一个点
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
experimental_self_intersect_check?: boolean;
|
|
17
22
|
};
|
|
18
23
|
export declare class Polygon extends BaseObject<PolygonImportData> {
|
|
19
24
|
readonly type = "Polygon";
|
|
@@ -2,39 +2,39 @@ var pt = Object.defineProperty, Pt = Object.defineProperties;
|
|
|
2
2
|
var yt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var it = Object.getOwnPropertySymbols;
|
|
4
4
|
var mt = Object.prototype.hasOwnProperty, ft = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var M = Math.pow, A = (
|
|
6
|
-
for (var t in
|
|
7
|
-
mt.call(
|
|
5
|
+
var M = Math.pow, A = (e, s, t) => s in e ? pt(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t, H = (e, s) => {
|
|
6
|
+
for (var t in s || (s = {}))
|
|
7
|
+
mt.call(s, t) && A(e, t, s[t]);
|
|
8
8
|
if (it)
|
|
9
|
-
for (var t of it(
|
|
10
|
-
ft.call(
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var C = (
|
|
14
|
-
var ot = (
|
|
9
|
+
for (var t of it(s))
|
|
10
|
+
ft.call(s, t) && A(e, t, s[t]);
|
|
11
|
+
return e;
|
|
12
|
+
}, I = (e, s) => Pt(e, yt(s));
|
|
13
|
+
var C = (e, s, t) => (A(e, typeof s != "symbol" ? s + "" : s, t), t);
|
|
14
|
+
var ot = (e, s, t) => new Promise((o, r) => {
|
|
15
15
|
var f = (u) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
w(t.next(u));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
r(h);
|
|
20
20
|
}
|
|
21
21
|
}, a = (u) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
w(t.throw(u));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
r(h);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, w = (u) => u.done ? o(u.value) : Promise.resolve(u.value).then(f, a);
|
|
28
|
+
w((t = t.apply(e, s)).next());
|
|
29
29
|
});
|
|
30
30
|
import { BaseObject as xt } from "../Base/index.js";
|
|
31
|
-
import * as
|
|
31
|
+
import * as v from "three";
|
|
32
32
|
import { PolylineMesh as nt } from "../../Meshes/Polyline.js";
|
|
33
33
|
import { AreaMesh as rt } from "../../Meshes/Area.js";
|
|
34
34
|
import { PolygonEditor as bt } from "./Editor.js";
|
|
35
35
|
import { vector3ToArray as Ct } from "../../../shared-utils/three/vector3ToArray.js";
|
|
36
|
-
import { withResolvers as
|
|
37
|
-
import { anyPositionToVector3 as
|
|
36
|
+
import { withResolvers as wt } from "../../../shared-utils/promise/withResolvers.js";
|
|
37
|
+
import { anyPositionToVector3 as Dt } from "../../../shared-utils/positionToVector3.js";
|
|
38
38
|
import { PointMesh as Ht } from "../../Meshes/Point.js";
|
|
39
39
|
class Rt extends xt {
|
|
40
40
|
constructor(t, o) {
|
|
@@ -48,7 +48,7 @@ class Rt extends xt {
|
|
|
48
48
|
C(this, "maxHistorySize", 50);
|
|
49
49
|
C(this, "_editor");
|
|
50
50
|
C(this, "creatingObject");
|
|
51
|
-
t && (this.areaMesh = new rt(
|
|
51
|
+
t && (this.areaMesh = new rt(H(H({}, t.style), t)), this.areaMesh.userData = (r = this.areaMesh.userData) != null ? r : {}, typeof this.areaMesh.userData.dragSelectPixelDistance != "number" && (this.areaMesh.userData.dragSelectPixelDistance = 10), this.add(this.areaMesh));
|
|
52
52
|
}
|
|
53
53
|
get editor() {
|
|
54
54
|
return this._editor || (this._editor = new bt(this)), this._editor;
|
|
@@ -59,7 +59,7 @@ class Rt extends xt {
|
|
|
59
59
|
typeof t == "function" && t(), this._editor && this._editor.updatePointMeshes();
|
|
60
60
|
}
|
|
61
61
|
get data() {
|
|
62
|
-
return this.updateMatrixWorld(),
|
|
62
|
+
return this.updateMatrixWorld(), I(H({}, this.baseData), {
|
|
63
63
|
points: Ct(this.applyObjectMatrixWorld(this.areaMesh.points)),
|
|
64
64
|
style: {
|
|
65
65
|
color: this.areaMesh.color.getHex(),
|
|
@@ -69,7 +69,7 @@ class Rt extends xt {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
setData(t) {
|
|
72
|
-
t.points && this.areaMesh.setPoints(this.applyObjectReversalMatrixWorld(t.points.map(
|
|
72
|
+
t.points && this.areaMesh.setPoints(this.applyObjectReversalMatrixWorld(t.points.map(Dt))), this.areaMesh.setStyle(t.style), this.updateCreationPointMeshes();
|
|
73
73
|
}
|
|
74
74
|
highlight() {
|
|
75
75
|
var t;
|
|
@@ -137,38 +137,38 @@ class Rt extends xt {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
function vt(
|
|
140
|
+
function vt(e, s, t) {
|
|
141
141
|
var L, N, $, G, J, K, Q, X, Z;
|
|
142
|
-
const { promise: o, resolve: r, reject: f } =
|
|
142
|
+
const { promise: o, resolve: r, reject: f } = wt(), a = e.parent;
|
|
143
143
|
if (!a) {
|
|
144
144
|
f(new Error("No container"));
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
let
|
|
150
|
-
u && h && h.model && h.model.bounding && typeof ((Z = h.model.bounding.max) == null ? void 0 : Z.y) == "number" && (
|
|
151
|
-
const P = new nt(
|
|
147
|
+
const w = (L = t == null ? void 0 : t.limit) != null ? L : "none", u = t == null ? void 0 : t.simpleMode, h = (K = (J = ($ = e.five) != null ? $ : (N = e.get) == null ? void 0 : N.call(e, "five")) != null ? J : (G = window.globalModules) == null ? void 0 : G.five) != null ? K : window.$five, T = (Q = t == null ? void 0 : t.autoClosePixelDistance) != null ? Q : 10;
|
|
148
|
+
e.userData = (X = e.userData) != null ? X : {}, e.userData.dragSelectPixelDistance = T;
|
|
149
|
+
let E = 0;
|
|
150
|
+
u && h && h.model && h.model.bounding && typeof ((Z = h.model.bounding.max) == null ? void 0 : Z.y) == "number" && (E = h.model.bounding.max.y + 1);
|
|
151
|
+
const P = new nt(e.style);
|
|
152
152
|
a == null || a.add(P);
|
|
153
|
-
const y = new nt(
|
|
153
|
+
const y = new nt(I(H({}, e.style), { dashed: !0, lengthEnable: !1 }));
|
|
154
154
|
a == null || a.add(y);
|
|
155
|
-
let
|
|
155
|
+
let j = [];
|
|
156
156
|
const lt = (i = n) => {
|
|
157
|
-
|
|
157
|
+
j.forEach((d, c) => {
|
|
158
158
|
const p = i[c];
|
|
159
159
|
p && d.position.copy(p);
|
|
160
160
|
});
|
|
161
161
|
};
|
|
162
|
-
function
|
|
162
|
+
function D() {
|
|
163
163
|
var d, c;
|
|
164
|
-
|
|
164
|
+
j.forEach((p) => {
|
|
165
165
|
var b;
|
|
166
166
|
return (b = p.parent) == null ? void 0 : b.remove(p);
|
|
167
167
|
});
|
|
168
|
-
const i = (c = (d =
|
|
169
|
-
|
|
168
|
+
const i = (c = (d = e.line) == null ? void 0 : d.style) != null ? c : e.style;
|
|
169
|
+
j = n.map((p, b) => {
|
|
170
170
|
var S, k;
|
|
171
|
-
const x = new Ht(
|
|
171
|
+
const x = new Ht(I(H({}, i), {
|
|
172
172
|
color: (S = i.pointColor) != null ? S : i.lineColor,
|
|
173
173
|
tip: void 0,
|
|
174
174
|
point: p
|
|
@@ -177,38 +177,42 @@ function vt(s, e, t) {
|
|
|
177
177
|
}), lt();
|
|
178
178
|
}
|
|
179
179
|
function V() {
|
|
180
|
-
|
|
180
|
+
j.forEach((i) => {
|
|
181
181
|
var d;
|
|
182
182
|
return (d = i.parent) == null ? void 0 : d.remove(i);
|
|
183
|
-
}),
|
|
183
|
+
}), j = [], e.userData && (delete e.userData.creationPointMeshes, delete e.userData.syncCreationPointMeshes, delete e.userData.disposeCreationPointMeshes);
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
s.enable(), u && s.setAdherePoints([]);
|
|
186
186
|
const n = [];
|
|
187
187
|
let l, m, R = !1, U;
|
|
188
|
-
const
|
|
188
|
+
const O = [], Y = () => n.length > 0, z = () => O.length > 0, at = () => {
|
|
189
189
|
var i;
|
|
190
|
-
Y() && (
|
|
190
|
+
Y() && (O.push(n.pop()), g(U), D(), (i = t == null ? void 0 : t.onUndo) == null || i.call(t), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render());
|
|
191
191
|
}, ht = () => {
|
|
192
192
|
var i;
|
|
193
|
-
z() && (n.push(
|
|
194
|
-
},
|
|
193
|
+
z() && (n.push(O.pop()), g(U), D(), (i = t == null ? void 0 : t.onRedo) == null || i.call(t), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render());
|
|
194
|
+
}, B = (i) => {
|
|
195
195
|
var c;
|
|
196
|
-
|
|
196
|
+
O.length = 0;
|
|
197
197
|
let d = n.length === 0 ? i.point : l.clone();
|
|
198
|
-
u && (d = d.clone().setY(
|
|
199
|
-
|
|
198
|
+
if (u && (d = d.clone().setY(E)), n.push(d), e.setPoints(n, { closed: !1 }), t != null && t.experimental_self_intersect_check && n.length > 2 && e.isBlank) {
|
|
199
|
+
n.pop(), e.setPoints(n, { closed: !1 }), D(), console.warn("[Polygon] 检测到自相交,无法添加该点");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
D(), (c = t == null ? void 0 : t.onPointPlaced) == null || c.call(t, n), R && (q(), r());
|
|
203
|
+
}, g = (i) => {
|
|
200
204
|
const d = () => {
|
|
201
|
-
P.setPoints([]), y.setPoints([]),
|
|
205
|
+
P.setPoints([]), y.setPoints([]), e.setPoints(n), s.pointSelectorHelper && s.pointSelectorHelper.magnifier && s.pointSelectorHelper.magnifier.render();
|
|
202
206
|
};
|
|
203
207
|
if (!i) {
|
|
204
|
-
d(),
|
|
208
|
+
d(), D();
|
|
205
209
|
return;
|
|
206
210
|
}
|
|
207
211
|
if (U = i, !(n != null && n.length))
|
|
208
212
|
return d();
|
|
209
213
|
const c = n.at(-1).clone();
|
|
210
|
-
if (n.length < 3 && (u ? (l = i.point.clone().setY(
|
|
211
|
-
u ? l = i.point.clone().setY(
|
|
214
|
+
if (n.length < 3 && (u ? (l = i.point.clone().setY(E), P.setPoints([c, l]), y.setPoints([])) : w === "none" ? (l = i.point, P.setPoints([c, l]), y.setPoints([])) : w === "xoz" ? (m = m != null ? m : new v.Plane().setFromNormalAndCoplanarPoint(new v.Vector3(0, 1, 0), n[0]), s.plane = m, l = m.projectPoint(i.point, new v.Vector3()), P.setPoints([c, l]), y.setPoints([l, i.point])) : w === "y" && (n.length === 1 ? (l = i.point, P.setPoints([c, l]), y.setPoints([])) : (m = m != null ? m : new v.Plane().setFromCoplanarPoints(n[0], n[1], new v.Vector3(0, 1, 0).add(n[0])), s.plane = m, l = m.projectPoint(i.point, new v.Vector3()), P.setPoints([c, l]), y.setPoints([l, i.point])))), n.length >= 3) {
|
|
215
|
+
u ? l = i.point.clone().setY(E) : l = e.projectPoint(i.point);
|
|
212
216
|
const p = n[0];
|
|
213
217
|
let b = !1;
|
|
214
218
|
if (typeof (t == null ? void 0 : t.autoClosePixelDistance) == "number") {
|
|
@@ -219,20 +223,20 @@ function vt(s, e, t) {
|
|
|
219
223
|
x: (st.x * 0.5 + 0.5) * S,
|
|
220
224
|
y: (1 - (st.y * 0.5 + 0.5)) * k
|
|
221
225
|
};
|
|
222
|
-
},
|
|
226
|
+
}, _ = W(p), tt = W(l), et = W(i.point), dt = Math.sqrt(M(_.x - tt.x, 2) + M(_.y - tt.y, 2)), ct = Math.sqrt(M(_.x - et.x, 2) + M(_.y - et.y, 2));
|
|
223
227
|
(dt < t.autoClosePixelDistance || ct < t.autoClosePixelDistance) && (b = !0);
|
|
224
228
|
}
|
|
225
229
|
} else
|
|
226
230
|
(p.distanceTo(l) < 0.2 || p.distanceTo(i.point) < 0.2) && (b = !0);
|
|
227
|
-
b ? (l = p, i.point.copy(p),
|
|
231
|
+
b ? (l = p, i.point.copy(p), s.pointSelectorHelper.updateWithIntersect(i, { emitEvent: !1 }), R = !0) : R = !1, P.setPoints([c, l]), y.setPoints([l, i.point]);
|
|
228
232
|
}
|
|
229
|
-
n.length >= 2 ? (
|
|
230
|
-
},
|
|
231
|
-
|
|
233
|
+
n.length >= 2 ? (e.setPoints([...n, l], { closed: !1 }), e.line.setPoints(e.points.slice(0, -1)), e.isBlank ? (s.cursorError = !0, P.setStyle({ lineColor: 16734553 }), y.setStyle({ lineColor: 16734553 })) : (s.cursorError = !1, P.setStyle({ lineColor: e.lineColor }), y.setStyle({ lineColor: e.lineColor }))) : e.setPoints([]), D();
|
|
234
|
+
}, q = () => {
|
|
235
|
+
s.off("select", B), s.off("intersectionUpdate", g), s.off("disable", F), s.plane = null, s.disable(), a == null || a.remove(P, y), V();
|
|
232
236
|
}, F = () => {
|
|
233
|
-
|
|
237
|
+
q(), a == null || a.remove(e, y, P), V(), f(new Error("Cancelled"));
|
|
234
238
|
};
|
|
235
|
-
return
|
|
239
|
+
return s.on("select", B), s.on("intersectionUpdate", g), s.on("disable", F), {
|
|
236
240
|
finished: o,
|
|
237
241
|
canUndo: Y,
|
|
238
242
|
canRedo: z,
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.72.5-alpha.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.72.5-alpha.5",
|
|
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",
|