@realsee/dnalogel 3.77.5 → 3.77.6

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +15 -11
  2. package/dist/PanoTagPlugin/controller/Tag/BaseTag.d.ts +5 -1
  3. package/dist/PanoTagPlugin/controller/Tag/BoxTag.d.ts +119 -0
  4. package/dist/PanoTagPlugin/controller/Tag/MaskTag.d.ts +257 -0
  5. package/dist/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +10 -0
  6. package/dist/PanoTagPlugin/controller/Tag/PolygonTag.d.ts +112 -0
  7. package/dist/PanoTagPlugin/controller/TagRender.d.ts +1 -1
  8. package/dist/PanoTagPlugin/controller/index.d.ts +55 -2
  9. package/dist/PanoTagPlugin/typings/controller.d.ts +10 -0
  10. package/dist/PanoTagPlugin/typings/tag/Tag.d.ts +8 -3
  11. package/dist/PanoTagPlugin/typings/tag/Utils.d.ts +50 -1
  12. package/dist/PanoTagPlugin/utils/sculptDataToBoxPosition.d.ts +6 -0
  13. package/dist/PanoTagPlugin/utils/tag/tagCheck.d.ts +6 -0
  14. package/dist/PanoTagPlugin/utils/tagPosition.d.ts +12 -3
  15. package/dist/index.cjs.js +178 -95
  16. package/dist/index.js +11346 -9788
  17. package/dist/index.umd.js +173 -90
  18. package/libs/CruisePlugin/Move.js +7 -2
  19. package/libs/CruisePlugin/Work.js +7 -2
  20. package/libs/CruisePlugin/index.js +11 -6
  21. package/libs/GuideLinePlugin/Controller.js +9 -4
  22. package/libs/GuideLinePlugin/GuideLineItem.js +7 -2
  23. package/libs/GuideLinePlugin/GuideLineModeItem.js +7 -2
  24. package/libs/GuideLinePlugin/index.js +11 -6
  25. package/libs/PanoTagPlugin/Components/TagItem.js +122 -122
  26. package/libs/PanoTagPlugin/controller/Tag/BaseTag.d.ts +5 -1
  27. package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +320 -289
  28. package/libs/PanoTagPlugin/controller/Tag/BoxTag.d.ts +119 -0
  29. package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +515 -0
  30. package/libs/PanoTagPlugin/controller/Tag/MaskTag.d.ts +257 -0
  31. package/libs/PanoTagPlugin/controller/Tag/MaskTag.js +815 -0
  32. package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +10 -0
  33. package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.js +94 -0
  34. package/libs/PanoTagPlugin/controller/Tag/PolygonTag.d.ts +112 -0
  35. package/libs/PanoTagPlugin/controller/Tag/PolygonTag.js +478 -0
  36. package/libs/PanoTagPlugin/controller/TagRender.d.ts +1 -1
  37. package/libs/PanoTagPlugin/controller/TagUtil.js +19 -17
  38. package/libs/PanoTagPlugin/controller/index.d.ts +55 -2
  39. package/libs/PanoTagPlugin/controller/index.js +261 -148
  40. package/libs/PanoTagPlugin/index.js +16 -11
  41. package/libs/PanoTagPlugin/typings/controller.d.ts +10 -0
  42. package/libs/PanoTagPlugin/typings/tag/Tag.d.ts +8 -3
  43. package/libs/PanoTagPlugin/typings/tag/Utils.d.ts +50 -1
  44. package/libs/PanoTagPlugin/utils/addDebugPoints.js +27 -13
  45. package/libs/PanoTagPlugin/utils/index.js +29 -26
  46. package/libs/PanoTagPlugin/utils/sculptDataToBoxPosition.d.ts +6 -0
  47. package/libs/PanoTagPlugin/utils/sculptDataToBoxPosition.js +18 -0
  48. package/libs/PanoTagPlugin/utils/tag/tagCheck.d.ts +6 -0
  49. package/libs/PanoTagPlugin/utils/tag/tagCheck.js +26 -14
  50. package/libs/PanoTagPlugin/utils/tagPosition.d.ts +12 -3
  51. package/libs/PanoTagPlugin/utils/tagPosition.js +49 -16
  52. package/libs/base/BasePlugin.js +1 -1
  53. package/libs/index.js +163 -158
  54. package/libs/shared-utils/logger.js +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ import type PanoTagPluginController from '..';
2
+ import type { TagContentType, Tag as TagData, TagInstance, ArrayPosition, TagClickParams } from '../..';
3
+ import { BaseTag } from './BaseTag';
4
+ import * as THREE from 'three';
5
+ import type { PartialObjectDeep } from '../../../typings/typings';
6
+ import type { Tag } from '../..';
7
+ import { Box } from '../../../Sculpt/Objects/Box';
8
+ export type BoxTagInterface<C extends TagContentType = TagContentType> = TagInstance<C, '3DBox'>;
9
+ /**
10
+ * 3DBox 类型的标签
11
+ * 使用 Sculpt Box 进行渲染,避免复杂的坐标转换
12
+ */
13
+ export declare class BoxTag<C extends TagContentType = TagContentType> extends BaseTag<C, '3DBox'> {
14
+ boxShape?: Box;
15
+ private tagStyle?;
16
+ private clickEventDispose?;
17
+ private domClickDispose?;
18
+ screenPosition: {
19
+ leftPx: number;
20
+ topPx: number;
21
+ scale: number;
22
+ } | null;
23
+ constructor(plugin: PanoTagPluginController, tagData: TagData);
24
+ /**
25
+ * 获取 Box 样式配置(合并用户配置和默认值)
26
+ */
27
+ private getBoxStyle;
28
+ /**
29
+ * 更新 Box 样式
30
+ */
31
+ private updateBoxStyle;
32
+ /**
33
+ * 更新标签数据
34
+ */
35
+ set(tag: PartialObjectDeep<Tag<C, '3DBox'>>, deepMerge?: boolean): void;
36
+ /**
37
+ * 设置标签数据
38
+ */
39
+ setData(...data: Parameters<InstanceType<typeof BaseTag<C, '3DBox'>>['setData']>): void;
40
+ /**
41
+ * 获取盒子的中心点
42
+ */
43
+ getCenter(): ArrayPosition;
44
+ /**
45
+ * 获取盒子的8个角点坐标
46
+ */
47
+ getCorners(): THREE.Vector3[];
48
+ /**
49
+ * 计算盒子的法向量
50
+ */
51
+ computeNormal(): THREE.Vector3;
52
+ /**
53
+ * 初始化 Sculpt Box
54
+ */
55
+ private initializeSculptBox;
56
+ /**
57
+ * 设置点击事件
58
+ */
59
+ private setupClickEvents;
60
+ /**
61
+ * 清理点击事件
62
+ */
63
+ private cleanupClickEvents;
64
+ /**
65
+ * 更新 Sculpt Box 的数据
66
+ */
67
+ private updateSculptBox;
68
+ /**
69
+ * 启用编辑器
70
+ * 用于编辑已存在的 Box
71
+ */
72
+ editorEnable(): Promise<void>;
73
+ /**
74
+ * 禁用编辑器
75
+ */
76
+ editorDisable(): void;
77
+ /**
78
+ * 从 Sculpt Box 同步 position 到 BoxTag
79
+ */
80
+ private syncBoxPositionFromSculpt;
81
+ /**
82
+ * 将 BoxPosition 转换为 Sculpt 需要的数据格式
83
+ */
84
+ private boxPositionToSculptData;
85
+ /**
86
+ * @description 点击事件处理
87
+ */
88
+ onClick(params: Pick<TagClickParams, 'target'>): void;
89
+ /**
90
+ * @description 展开自己,收起其他标签
91
+ */
92
+ unfoldAndFoldOthers(): void;
93
+ /**
94
+ * 展开标签详情
95
+ */
96
+ unfold(): void;
97
+ /**
98
+ * 折叠标签详情
99
+ */
100
+ fold(): void;
101
+ /**
102
+ * 设置展开/折叠状态
103
+ */
104
+ setUnfold(unfolded: boolean): void;
105
+ /**
106
+ * 更新屏幕位置(用于在 2D UI 中显示内容)
107
+ * 显示在 Box 最右侧的顶点位置
108
+ */
109
+ updateScreenPosition(): void;
110
+ get centerPosition(): THREE.Vector3;
111
+ /**
112
+ * 应用可见性变化
113
+ */
114
+ applyVisible(): void;
115
+ /**
116
+ * 销毁标签
117
+ */
118
+ dispose(): void;
119
+ }
@@ -0,0 +1,515 @@
1
+ var P = Object.defineProperty;
2
+ var b = Object.getOwnPropertySymbols;
3
+ var E = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
4
+ var S = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t, y = (a, n) => {
5
+ for (var t in n || (n = {}))
6
+ E.call(n, t) && S(a, t, n[t]);
7
+ if (b)
8
+ for (var t of b(n))
9
+ B.call(n, t) && S(a, t, n[t]);
10
+ return a;
11
+ };
12
+ var f = (a, n, t) => (S(a, typeof n != "symbol" ? n + "" : n, t), t);
13
+ var g = (a, n, t) => new Promise((i, o) => {
14
+ var e = (p) => {
15
+ try {
16
+ l(t.next(p));
17
+ } catch (h) {
18
+ o(h);
19
+ }
20
+ }, s = (p) => {
21
+ try {
22
+ l(t.throw(p));
23
+ } catch (h) {
24
+ o(h);
25
+ }
26
+ }, l = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(e, s);
27
+ l((t = t.apply(a, n)).next());
28
+ });
29
+ import { BaseTag as z } from "./BaseTag.js";
30
+ import * as r from "three";
31
+ import { Sculpt as T } from "../../../Sculpt/index.js";
32
+ import { Box as D } from "../../../Sculpt/Objects/Box/index.js";
33
+ import "../../../shared-utils/tag.js";
34
+ import "../../../vendor/hammerjs/hammer.js";
35
+ import "../../../shared-utils/three/PointSelector/index.js";
36
+ import "../../../shared-utils/three/CSS3DRenderer/index.js";
37
+ import "../../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
38
+ import { anyPositionToVector3 as u } from "../../../shared-utils/positionToVector3.js";
39
+ import "@realsee/five/line";
40
+ import "../../../shared-utils/three/core/Five_LineMaterial2.js";
41
+ import "../../../shared-utils/three/core/Sphere.js";
42
+ import "../../../shared-utils/three/blink.js";
43
+ import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
44
+ import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
45
+ import "../../../vendor/earcut/src/earcut.js";
46
+ import { transformPosition as x } from "../../../shared-utils/five/transformPosition.js";
47
+ import { uuid as M } from "../../../shared-utils/uuid.js";
48
+ import "../../../shared-utils/five/FivePuppet.js";
49
+ import { getBoxCorners as A, applyMatrixToPoints as F } from "../../utils/tagPosition.js";
50
+ import { sculptDataToBoxPosition as U } from "../../utils/sculptDataToBoxPosition.js";
51
+ import "../../../shared-utils/Subscribe.js";
52
+ import "../../utils/tag/calculateTagConfig.js";
53
+ import "../../../vendor/object-assign-deep/objectAssignDeep.js";
54
+ import "../../../shared-utils/typescript/entries.js";
55
+ import "../../utils/tag/adaptConfig.js";
56
+ import "../../typings/tag/TagConfig.js";
57
+ import "@realsee/five";
58
+ import "../../../shared-utils/five/mode.js";
59
+ import "../../utils/tag/format.js";
60
+ import "../../../shared-utils/url/defaultUrls.js";
61
+ import "../../../shared-utils/three/centerPoint.js";
62
+ import "../../../shared-utils/util.js";
63
+ import "../../../shared-utils/isNil.js";
64
+ import "../../../shared-utils/vectorToCoordinate.js";
65
+ import "../../../shared-utils/formatRad.js";
66
+ import "../../../shared-utils/five/lookPoint.js";
67
+ import "../../../shared-utils/Utils/FiveUtil.js";
68
+ import "../../../shared-utils/Utils/BaseUtil.js";
69
+ import "../../../shared-utils/Utils/WorkUtil.js";
70
+ import "../../../shared-utils/five/getFiveModel.js";
71
+ import "../../utils/checkRange.js";
72
+ import "../../utils/tag/tagCheck.js";
73
+ import "../../../shared-utils/url/getUrl.js";
74
+ import "../../../shared-utils/five/getFloorIndex.js";
75
+ import "../../../shared-utils/safeObj.js";
76
+ import "../../utils/Cache.js";
77
+ import "../../../shared-utils/three/temp.js";
78
+ import "../../../shared-utils/three/core/Raycaster.js";
79
+ import "../../../shared-utils/promise/withResolvers.js";
80
+ import "../../../shared-utils/five/vector3ToScreen.js";
81
+ import "../../../shared-utils/dom/resizeObserver.js";
82
+ import "../../../shared-utils/five/fiveEveryReadyListener.js";
83
+ import "../../../shared-utils/throttle.js";
84
+ import "../../../shared-utils/five/fiveModelLoad.js";
85
+ import "../../../shared-utils/three/PointSelector/utils/PointSelectorHelper.js";
86
+ import "../../../shared-utils/three/Magnifier.js";
87
+ import "../../../shared-utils/three/PointSelector/utils/PointHelper.js";
88
+ import "../../../shared-utils/three/Assets/index.js";
89
+ import "../../../CSS3DRenderPlugin/utils/three/CSS3DObject.js";
90
+ import "../../../shared-utils/even.js";
91
+ import "../../../shared-utils/CSS3DRender/OpacityMesh.js";
92
+ import "../../../shared-utils/three/getObjectVisible.js";
93
+ import "../../../shared-utils/three/PointSelector/utils/html.js";
94
+ import "../../../shared-utils/CSS3DRender/index.js";
95
+ import "../../../shared-utils/CSS3DRender/CSS3DRenderer.js";
96
+ import "../../../shared-utils/createResizeObserver.js";
97
+ import "../../../shared-utils/three/PointSelector/utils/PointHelper2.js";
98
+ import "../../../Sculpt/Meshes/Line.js";
99
+ import "../../../Sculpt/typings/style.js";
100
+ import "../../../shared-utils/three/IObject3D.js";
101
+ import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
102
+ import "../../../shared-utils/three/applyObjectMatrixWorld.js";
103
+ import "../../../shared-utils/three/core/LineGeometry.js";
104
+ import "../../../shared-utils/three/core/LineMaterial.js";
105
+ import "../../../shared-utils/three/core/Line2.js";
106
+ import "../../../shared-utils/three/core/LineMaterial2.js";
107
+ import "../../../Sculpt/utils/unit.js";
108
+ import "../../../Sculpt/utils/renderDom.js";
109
+ import "../../../CSS3DRenderPlugin/utils/three/CSS3DSprite.js";
110
+ import "../../../shared-utils/isTouchDevice.js";
111
+ import "../../../shared-utils/five/getPosition.js";
112
+ import "../../../shared-utils/five/getRaycasterByNdcPosition.js";
113
+ import "../../../shared-utils/three/PointSelector/utils/contents.js";
114
+ import "../../../Sculpt/utils/three/rayOnLine.js";
115
+ import "../../../vendor/animejs/lib/anime.es.js";
116
+ import "../../../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
117
+ import "../../../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
118
+ import "../../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
119
+ import "../../../Sculpt/utils/Modules/Global.js";
120
+ import "../../../Sculpt/utils/Modules/Cursor.js";
121
+ import "../../../Sculpt/utils/Modules/DeleteButtonBgBorder.js";
122
+ import "../../../Sculpt/utils/Modules/DeleteIconSVG.js";
123
+ import "../../../Object3DHelperPlugin/Controller.js";
124
+ import "../../../base/BasePlugin.js";
125
+ import "../../../shared-utils/Object3DHelper/Helper/MoveHelper.js";
126
+ import "../../../shared-utils/Object3DHelper/Base/BaseHelper.js";
127
+ import "../../../shared-utils/Object3DHelper/utils/setObjectQuaternion.js";
128
+ import "../../../shared-utils/three/boundingBox.js";
129
+ import "../../../shared-utils/Object3DHelper/Helper/Objects/ArrowGroup.js";
130
+ import "../../../shared-utils/Object3DHelper/utils/direction.js";
131
+ import "../../../shared-utils/Object3DHelper/Constants/RenderOrder.js";
132
+ import "../../../shared-utils/Object3DHelper/Helper/Objects/CenterHandle.js";
133
+ import "../../../shared-utils/Object3DHelper/Constants/color.js";
134
+ import "../../../shared-utils/Object3DHelper/utils/calculateScaleByCamera.js";
135
+ import "../../../shared-utils/Object3DHelper/utils/getPoseFromCamera.js";
136
+ import "../../../shared-utils/clamp.js";
137
+ import "../../../shared-utils/Object3DHelper/utils/getOrthographicCameraDirection.js";
138
+ import "../../../shared-utils/Object3DHelper/Helper/RotateHelper.js";
139
+ import "../../../shared-utils/Object3DHelper/Helper/HTML/tipsDom.js";
140
+ import "../../../shared-utils/Object3DHelper/Helper/HTML/utils/createElement.js";
141
+ import "../../../shared-utils/Object3DHelper/Helper/CSS3DScaleHelper.js";
142
+ import "../../../shared-utils/Object3DHelper/Helper/HTML/rectangleScaleDom.js";
143
+ import "../../../shared-utils/Object3DHelper/utils/cameraHooks.js";
144
+ import "../../../shared-utils/Object3DHelper/Helper/BoundingBoxHelper.js";
145
+ import "../../../shared-utils/Object3DHelper/Controller/MoveController.js";
146
+ import "../../../shared-utils/Object3DHelper/Base/BaseController.js";
147
+ import "../../../shared-utils/Object3DHelper/utils/solidGuide.js";
148
+ import "../../../shared-utils/Object3DHelper/utils/getMouseRaycaster.js";
149
+ import "../../../shared-utils/Object3DHelper/utils/calculateThreeMouse.js";
150
+ import "../../../Object3DHelperPlugin/FiveControllerWrapper.js";
151
+ import "../../../shared-utils/Object3DHelper/index.js";
152
+ import "../../../shared-utils/Object3DHelper/Controller/RotateController.js";
153
+ import "../../../shared-utils/math/rad2Deg.js";
154
+ import "../../../shared-utils/math/deg2Rad.js";
155
+ import "../../../shared-utils/Object3DHelper/Controller/CSS3DScaleController.js";
156
+ import "../../../shared-utils/Object3DHelper/Controller/RectangleScaleController.js";
157
+ import "../../../shared-utils/three/vectorIsEqual.js";
158
+ import "../../../shared-utils/Object3DHelper/Controller/BoundingBoxController.js";
159
+ import "../../../shared-utils/Object3DHelper/Helper/ScaleHelper.js";
160
+ import "../../../shared-utils/Object3DHelper/Controller/ScaleController.js";
161
+ import "../../../shared-utils/three/getNormal.js";
162
+ import "../../../shared-utils/threex/domevents/index.js";
163
+ import "../../../shared-utils/five/FiveDomEvents.js";
164
+ import "../../../shared-utils/five/calculateThreeMouse.js";
165
+ import "../../../shared-utils/three/recurveFindObject.js";
166
+ import "../../../Sculpt/Objects/Polyline/index.js";
167
+ import "../../../Sculpt/Meshes/Polyline.js";
168
+ import "../../../Sculpt/Meshes/LineWithDots.js";
169
+ import "../../../Sculpt/Meshes/Point.js";
170
+ import "../../../shared-utils/three/closeVectors.js";
171
+ import "../../../Sculpt/Objects/Base/index.js";
172
+ import "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
173
+ import "../../../Sculpt/Objects/Polyline/Editor.js";
174
+ import "../../../Sculpt/Objects/Line/Editor.js";
175
+ import "../../../Sculpt/Objects/Base/Editor.js";
176
+ import "../../../shared-utils/three/vector3ToArray.js";
177
+ import "../../../Sculpt/Objects/Point/index.js";
178
+ import "../../../Sculpt/Objects/Point/Editor.js";
179
+ import "../../../Sculpt/Objects/Polygon/index.js";
180
+ import "../../../Sculpt/Meshes/Area.js";
181
+ import "../../../Sculpt/Meshes/PolygonWithEdge.js";
182
+ import "../../../Sculpt/Meshes/Polygon.js";
183
+ import "../../../shared-utils/three/generatePolygonGeometry.js";
184
+ import "../../../shared-utils/three/earcut3D.js";
185
+ import "../../../PanoMeasurePlugin/utils/isIntersecting.js";
186
+ import "../../../Sculpt/utils/three/ColoredMesh.js";
187
+ import "../../../shared-utils/three/geometryUtil.js";
188
+ import "../../../Sculpt/Objects/Polygon/Editor.js";
189
+ import "../../../Sculpt/Objects/Prism/index.js";
190
+ import "../../../Sculpt/Meshes/Prism.js";
191
+ import "../../../shared-utils/three/core/PrismGeometry.js";
192
+ import "../../../shared-utils/three/core/polygonVertex.js";
193
+ import "../../../shared-utils/three/core/PrismAnimationGeometry.js";
194
+ import "../../../Sculpt/Editors/PrismMeshEditor.js";
195
+ import "../../../Sculpt/Objects/Rectangle/index.js";
196
+ import "../../../Sculpt/Editors/RectangleMeshEditor.js";
197
+ import "../../../Sculpt/Meshes/Rectangle.js";
198
+ import "../../../Sculpt/utils/three/RectangleGeometry.js";
199
+ import "../../../Sculpt/Meshes/RectangleWithEdge.js";
200
+ import "../../../Sculpt/utils/sortPositionsByCameraPosition.js";
201
+ import "../../../Sculpt/Objects/Circle/index.js";
202
+ import "../../../Sculpt/Editors/CircleMeshEditor.js";
203
+ import "../../../Sculpt/Meshes/CircleWithEdge.js";
204
+ import "../../../Sculpt/Meshes/Circle.js";
205
+ import "../../../Sculpt/utils/radiusToSegments.js";
206
+ import "../../../Sculpt/Objects/Cylinder/index.js";
207
+ import "../../../Sculpt/Meshes/Cylinder.js";
208
+ import "../../../Sculpt/Editors/CylinderMeshEditor.js";
209
+ import "../../../shared-utils/forReverseEach.js";
210
+ import "../../../Sculpt/Objects/Line/index.js";
211
+ import "../../../Sculpt/Editors/BoxMeshEditor.js";
212
+ import "../../../Sculpt/Meshes/Box.js";
213
+ class se extends z {
214
+ constructor(t, i) {
215
+ super(t, i);
216
+ f(this, "tagStyle");
217
+ f(this, "clickEventDispose");
218
+ f(this, "domClickDispose");
219
+ f(this, "screenPosition", null);
220
+ this.tagStyle = i.style, this.initializeSculptBox(), this.updateVisible();
221
+ }
222
+ /**
223
+ * 获取 Box 样式配置(合并用户配置和默认值)
224
+ */
225
+ getBoxStyle() {
226
+ var i, o, e, s;
227
+ const t = ((i = this.tagStyle) == null ? void 0 : i.boxOrPolygon) || {};
228
+ return {
229
+ color: (o = t.color) != null ? o : 16777215,
230
+ opacity: (e = t.opacity) != null ? e : 0.4,
231
+ lineColor: (s = t.color) != null ? s : 16777215,
232
+ lineWidth: 1
233
+ };
234
+ }
235
+ /**
236
+ * 更新 Box 样式
237
+ */
238
+ updateBoxStyle() {
239
+ if (!this.boxShape || !this.boxShape.boxMesh)
240
+ return;
241
+ const t = this.getBoxStyle();
242
+ this.boxShape.boxMesh.setStyle(t);
243
+ }
244
+ /**
245
+ * 更新标签数据
246
+ */
247
+ set(t, i = !0) {
248
+ super.set(t, i), t.style && (this.tagStyle = y(y({}, this.tagStyle), t.style)), t.position && (this.boxShape ? this.updateSculptBox() : this.initializeSculptBox()), t.style && this.boxShape && this.updateBoxStyle();
249
+ }
250
+ /**
251
+ * 设置标签数据
252
+ */
253
+ setData(...t) {
254
+ super.setData(...t);
255
+ }
256
+ /**
257
+ * 获取盒子的中心点
258
+ */
259
+ getCenter() {
260
+ const t = this.position;
261
+ if (!(t != null && t.start) || !(t != null && t.end))
262
+ return [0, 0, 0];
263
+ const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, p = new r.Vector3(e, s, l);
264
+ return x(p, this.workUtil.transform).toArray();
265
+ }
266
+ /**
267
+ * 获取盒子的8个角点坐标
268
+ */
269
+ getCorners() {
270
+ if (this.boxShape) {
271
+ const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = new r.Vector3().subVectors(
272
+ u(t.heightPoint),
273
+ i[0]
274
+ ), e = i.map((s) => s.clone().add(o));
275
+ return [...i, ...e];
276
+ }
277
+ return [];
278
+ }
279
+ /**
280
+ * 计算盒子的法向量
281
+ */
282
+ computeNormal() {
283
+ const t = this.position;
284
+ if (!t.rotation)
285
+ return new r.Vector3(0, 1, 0);
286
+ const i = new r.Euler().fromArray(t.rotation), o = new r.Vector3(0, 1, 0);
287
+ return o.applyEuler(i), o;
288
+ }
289
+ /**
290
+ * 初始化 Sculpt Box
291
+ */
292
+ initializeSculptBox() {
293
+ if (this.boxShape)
294
+ return;
295
+ const t = this.position;
296
+ if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
297
+ return;
298
+ const i = new T(this.five, void 0, {
299
+ magnifier: null
300
+ });
301
+ i.clear(), i.group.removeFromParent();
302
+ const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), s = new D(
303
+ {
304
+ id: M(),
305
+ type: "Box",
306
+ points: o.bottomPoints,
307
+ heightPoint: o.heightPoint,
308
+ style: e
309
+ },
310
+ {
311
+ defaultAction: !1,
312
+ occlusionVisibility: !1
313
+ // occlusionMode: 'translucence' as any,
314
+ }
315
+ );
316
+ s.visible = this.visible, this.plugin.imagePlaneGroup.add(s), this.boxShape = s, s.editor.hooks.on("objectUpdate", () => {
317
+ this.syncBoxPositionFromSculpt();
318
+ }), s.editor.disable(), this.setupClickEvents();
319
+ }
320
+ /**
321
+ * 设置点击事件
322
+ */
323
+ setupClickEvents() {
324
+ var i;
325
+ if (!this.boxShape || !this.boxShape.boxMesh || this.config.clickable === !1) {
326
+ console.warn(
327
+ `[BoxTag ${this.id}] Cannot setup click events: boxShape=${!!this.boxShape}, boxMesh=${!!((i = this.boxShape) != null && i.boxMesh)}, clickable=${this.config.clickable}`
328
+ );
329
+ return;
330
+ }
331
+ this.cleanupClickEvents();
332
+ const t = (o) => {
333
+ this.plugin.hooks.emit("click", { event: o, target: "TagBoxModel", tag: this });
334
+ };
335
+ requestAnimationFrame(() => {
336
+ if (!this.boxShape || !this.plugin.domEvents) {
337
+ console.warn(`[BoxTag ${this.id}] Cannot bind click events: boxShape or domEvents not available`);
338
+ return;
339
+ }
340
+ this.clickEventDispose = this.addObjectClickHandler(this, this.boxShape, t);
341
+ });
342
+ }
343
+ /**
344
+ * 清理点击事件
345
+ */
346
+ cleanupClickEvents() {
347
+ this.clickEventDispose && (this.clickEventDispose(), this.clickEventDispose = void 0);
348
+ }
349
+ /**
350
+ * 更新 Sculpt Box 的数据
351
+ */
352
+ updateSculptBox() {
353
+ if (!this.boxShape)
354
+ return;
355
+ const t = this.position;
356
+ if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
357
+ return;
358
+ const i = this.boxPositionToSculptData(t);
359
+ this.boxShape.setData({
360
+ points: i.bottomPoints.map((o) => o.toArray()),
361
+ heightPoint: i.heightPoint.toArray()
362
+ }), this.setupClickEvents();
363
+ }
364
+ /**
365
+ * 启用编辑器
366
+ * 用于编辑已存在的 Box
367
+ */
368
+ editorEnable() {
369
+ return g(this, null, function* () {
370
+ if (!this.position) {
371
+ console.warn("[BoxTag] Cannot enable editor without position. Call startDrawing() first.");
372
+ return;
373
+ }
374
+ this.boxShape || this.initializeSculptBox(), this.boxShape && (this.boxShape.visible = !0, this.boxShape.editor.enable());
375
+ });
376
+ }
377
+ /**
378
+ * 禁用编辑器
379
+ */
380
+ editorDisable() {
381
+ this.boxShape && this.boxShape.editor.disable();
382
+ }
383
+ /**
384
+ * 从 Sculpt Box 同步 position 到 BoxTag
385
+ */
386
+ syncBoxPositionFromSculpt() {
387
+ if (!this.boxShape)
388
+ return;
389
+ const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = u(t.heightPoint), e = U(i, o);
390
+ this.position = e, this.hooks.emit("positionChanged", e);
391
+ }
392
+ /**
393
+ * 将 BoxPosition 转换为 Sculpt 需要的数据格式
394
+ */
395
+ boxPositionToSculptData(t) {
396
+ const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), p = new r.Matrix4().makeRotationFromEuler(e), h = [
397
+ new r.Vector3(-0.5, -0.5, -0.5),
398
+ new r.Vector3(0.5, -0.5, -0.5),
399
+ new r.Vector3(0.5, -0.5, 0.5),
400
+ new r.Vector3(-0.5, -0.5, 0.5)
401
+ ], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
402
+ const C = V.clone().multiply(c).applyMatrix4(p).add(s);
403
+ return x(C, m);
404
+ }), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
405
+ return { bottomPoints: v, heightPoint: k };
406
+ }
407
+ /**
408
+ * @description 点击事件处理
409
+ */
410
+ onClick(t) {
411
+ t.target === "TagBoxModel" && this.unfoldAndFoldOthers();
412
+ }
413
+ /**
414
+ * @description 展开自己,收起其他标签
415
+ */
416
+ unfoldAndFoldOthers() {
417
+ if (this.isPopoverConfigEnabled())
418
+ return;
419
+ const t = this.can("fold"), i = this.can("unfold");
420
+ t && i && (this.state.unfolded = !this.state.unfolded, this.manuallyOperated = !0, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), this.state.unfolded && this.plugin.tags.forEach((o) => {
421
+ o.id !== this.id && o.fold();
422
+ }));
423
+ }
424
+ /**
425
+ * 展开标签详情
426
+ */
427
+ unfold() {
428
+ this.isPopoverConfigEnabled() || this.setUnfold(!0);
429
+ }
430
+ /**
431
+ * 折叠标签详情
432
+ */
433
+ fold() {
434
+ this.isPopoverConfigEnabled() || this.setUnfold(!1);
435
+ }
436
+ /**
437
+ * 设置展开/折叠状态
438
+ */
439
+ setUnfold(t) {
440
+ if (this.isPopoverConfigEnabled())
441
+ return;
442
+ const i = this.can("fold"), o = this.can("unfold");
443
+ i && o && (this.state.unfolded = t, this.hooks.emit(t ? "unfolded" : "folded"), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
444
+ }
445
+ /**
446
+ * 更新屏幕位置(用于在 2D UI 中显示内容)
447
+ * 显示在 Box 最右侧的顶点位置
448
+ */
449
+ updateScreenPosition() {
450
+ if (!this.currentVisible) {
451
+ this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
452
+ return;
453
+ }
454
+ const i = this.position;
455
+ if (!(i != null && i.start) || !(i != null && i.end)) {
456
+ this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
457
+ return;
458
+ }
459
+ const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), s = new r.Euler().fromArray(i.rotation), l = [
460
+ new r.Vector3(o.x, o.y, o.z),
461
+ new r.Vector3(e.x, o.y, o.z),
462
+ new r.Vector3(o.x, e.y, o.z),
463
+ new r.Vector3(e.x, e.y, o.z),
464
+ new r.Vector3(o.x, o.y, e.z),
465
+ new r.Vector3(e.x, o.y, e.z),
466
+ new r.Vector3(o.x, e.y, e.z),
467
+ new r.Vector3(e.x, e.y, e.z)
468
+ ], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
469
+ l.forEach((m) => {
470
+ m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
471
+ });
472
+ let d = l[0];
473
+ l.forEach((m) => {
474
+ m.x > d.x && (d = m);
475
+ });
476
+ const c = d.clone().project(this.five.camera);
477
+ if (c.x < -1 || c.x > 1 || c.y < -1 || c.y > 1 || c.z < 0 || c.z > 1)
478
+ this.screenPosition = null;
479
+ else if (this.five.renderer) {
480
+ const m = this.five.renderer.getSize(new r.Vector2());
481
+ this.screenPosition = {
482
+ leftPx: (c.x + 1) / 2 * m.x,
483
+ topPx: (-c.y + 1) / 2 * m.y,
484
+ scale: 1
485
+ };
486
+ }
487
+ this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
488
+ }
489
+ get centerPosition() {
490
+ const t = A(this.position, this.workUtil.transform), i = F(t, this.matrix);
491
+ let o = i[0];
492
+ return i.forEach((e) => {
493
+ e.x > o.x && (o = e);
494
+ }), o;
495
+ }
496
+ /**
497
+ * 应用可见性变化
498
+ */
499
+ applyVisible() {
500
+ var t;
501
+ this.boxShape && (this.plugin.imagePlaneGroup.children.includes(this.boxShape) || (console.warn(`[BoxTag ${this.id}] applyVisible: boxShape not in imagePlaneGroup, re-adding...`, {
502
+ boxShapeParent: ((t = this.boxShape.parent) == null ? void 0 : t.name) || "null",
503
+ imagePlaneGroupChildren: this.plugin.imagePlaneGroup.children.length
504
+ }), this.boxShape.parent && this.boxShape.parent.remove(this.boxShape), this.plugin.imagePlaneGroup.add(this.boxShape)), this.boxShape.visible = this.visible), this.updateScreenPosition();
505
+ }
506
+ /**
507
+ * 销毁标签
508
+ */
509
+ dispose() {
510
+ this.cleanupClickEvents(), this.domClickDispose && (this.domClickDispose(), this.domClickDispose = void 0), this.boxShape && (this.boxShape.removeFromParent(), this.boxShape = void 0);
511
+ }
512
+ }
513
+ export {
514
+ se as BoxTag
515
+ };