@realsee/dnalogel 3.77.5 → 3.77.7
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 +17 -11
- package/dist/PanoTagPlugin/controller/Tag/BaseTag.d.ts +5 -1
- package/dist/PanoTagPlugin/controller/Tag/BoxTag.d.ts +119 -0
- package/dist/PanoTagPlugin/controller/Tag/MaskTag.d.ts +257 -0
- package/dist/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +10 -0
- package/dist/PanoTagPlugin/controller/Tag/PolygonTag.d.ts +112 -0
- package/dist/PanoTagPlugin/controller/TagRender.d.ts +1 -1
- package/dist/PanoTagPlugin/controller/index.d.ts +55 -2
- package/dist/PanoTagPlugin/typings/controller.d.ts +10 -0
- package/dist/PanoTagPlugin/typings/tag/Tag.d.ts +8 -3
- package/dist/PanoTagPlugin/typings/tag/Utils.d.ts +50 -1
- package/dist/PanoTagPlugin/utils/sculptDataToBoxPosition.d.ts +6 -0
- package/dist/PanoTagPlugin/utils/tag/tagCheck.d.ts +6 -0
- package/dist/PanoTagPlugin/utils/tagPosition.d.ts +12 -3
- package/dist/Sculpt/Meshes/Line.d.ts +4 -0
- package/dist/index.cjs.js +178 -95
- package/dist/index.js +11378 -9801
- package/dist/index.umd.js +173 -90
- package/dist/shared-utils/five/getFiveFromParentChain.d.ts +7 -0
- package/libs/AreaMakerPlugin/Controller.js +3 -2
- package/libs/AreaMakerPlugin/index.js +3 -2
- package/libs/AreaMakerPlugin/utils/Item.js +3 -2
- package/libs/CSS3DRenderPlugin/Controller.js +3 -2
- package/libs/CSS3DRenderPlugin/index.js +6 -5
- package/libs/CSS3DRenderPlugin/utils/three/CSS3DObject.js +39 -38
- package/libs/CSS3DRenderPlugin/utils/three/CSS3DRender.js +10 -9
- package/libs/CruisePlugin/BaseController.js +5 -4
- package/libs/CruisePlugin/Move.js +8 -2
- package/libs/CruisePlugin/Work.js +8 -2
- package/libs/CruisePlugin/index.js +12 -6
- package/libs/CurrentPanoImagePlugin/Controller.js +15 -14
- package/libs/CurrentPanoImagePlugin/index.js +4 -3
- package/libs/GuideLinePlugin/Controller.js +10 -4
- package/libs/GuideLinePlugin/GuideLineItem.js +8 -2
- package/libs/GuideLinePlugin/GuideLineModeItem.js +8 -2
- package/libs/GuideLinePlugin/index.js +12 -6
- package/libs/MeasurePlugin/Controller.js +11 -10
- package/libs/MeasurePlugin/index.js +5 -4
- package/libs/MeasurePlugin/utils/MeasureMesh.js +3 -2
- package/libs/ModelChassisCompassPlugin/Plugin.js +4 -3
- package/libs/ModelChassisCompassPlugin/index.js +1 -0
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +6 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +1 -0
- package/libs/ModelMakerPlugin/Controller.js +3 -2
- package/libs/ModelMakerPlugin/index.js +3 -2
- package/libs/ModelMakerPlugin/item/baseItem.js +3 -2
- package/libs/ModelMakerPlugin/item/boxItem.js +3 -2
- package/libs/ModelMakerPlugin/item/polygonItem.js +3 -2
- package/libs/ModelMakerPlugin/item/prismItem.js +3 -2
- package/libs/ModelTVVideoPlugin/Plugin.js +4 -3
- package/libs/ModelTVVideoPlugin/index.js +3 -2
- package/libs/ModelViewPlugin/Plugin.js +20 -19
- package/libs/ModelViewPlugin/index.js +1 -0
- package/libs/Object3DHelperPlugin/Controller.js +3 -2
- package/libs/Object3DHelperPlugin/index.js +6 -5
- package/libs/PanoCompassPlugin/Controller.js +3 -2
- package/libs/PanoCompassPlugin/index.js +4 -3
- package/libs/PanoDoorLabelPlugin/Controller.js +24 -23
- package/libs/PanoDoorLabelPlugin/index.js +4 -3
- package/libs/PanoMeasurePlugin/Components/Controller0.js +3 -2
- package/libs/PanoMeasurePlugin/Components/Controller1.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/EditController.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/index.js +3 -2
- package/libs/PanoMeasurePlugin/Model/area.js +3 -2
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +1 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +16 -15
- package/libs/PanoMeasurePlugin/index.js +14 -13
- package/libs/PanoMeasurePlugin/utils/dom/areaDom.js +3 -2
- package/libs/PanoRulerProPlugin/Controller.js +3 -2
- package/libs/PanoRulerProPlugin/RulerItems.js +42 -41
- package/libs/PanoRulerProPlugin/index.js +4 -3
- package/libs/PanoSpatialTagPlugin/Plugin.js +34 -33
- package/libs/PanoSpatialTagPlugin/index.js +1 -0
- package/libs/PanoTagPlugin/Components/Common/TagPoint.js +3 -2
- package/libs/PanoTagPlugin/Components/Common/TagPopover/PopoverContent.js +3 -2
- package/libs/PanoTagPlugin/Components/Common/TagPopover/TagPopoverToolBar.js +3 -2
- package/libs/PanoTagPlugin/Components/Common/TagPopover/index.js +3 -2
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +3 -2
- package/libs/PanoTagPlugin/Components/Tag/index.js +3 -2
- package/libs/PanoTagPlugin/Components/TagContainer.js +3 -2
- package/libs/PanoTagPlugin/Components/TagItem.js +125 -124
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.d.ts +5 -1
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +321 -289
- package/libs/PanoTagPlugin/controller/Tag/BoxTag.d.ts +119 -0
- package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +516 -0
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.d.ts +257 -0
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.js +816 -0
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +10 -0
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.js +94 -0
- package/libs/PanoTagPlugin/controller/Tag/ModelTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PointTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PolygonTag.d.ts +112 -0
- package/libs/PanoTagPlugin/controller/Tag/PolygonTag.js +479 -0
- package/libs/PanoTagPlugin/controller/TagRender.d.ts +1 -1
- package/libs/PanoTagPlugin/controller/TagRender.js +3 -2
- package/libs/PanoTagPlugin/controller/TagUtil.js +22 -19
- package/libs/PanoTagPlugin/controller/index.d.ts +55 -2
- package/libs/PanoTagPlugin/controller/index.js +243 -129
- package/libs/PanoTagPlugin/index.js +17 -11
- package/libs/PanoTagPlugin/typings/controller.d.ts +10 -0
- package/libs/PanoTagPlugin/typings/tag/Tag.d.ts +8 -3
- package/libs/PanoTagPlugin/typings/tag/Utils.d.ts +50 -1
- package/libs/PanoTagPlugin/utils/addDebugPoints.js +27 -13
- package/libs/PanoTagPlugin/utils/index.js +29 -26
- package/libs/PanoTagPlugin/utils/sculptDataToBoxPosition.d.ts +6 -0
- package/libs/PanoTagPlugin/utils/sculptDataToBoxPosition.js +18 -0
- package/libs/PanoTagPlugin/utils/tag/calculateTagConfig.js +3 -2
- package/libs/PanoTagPlugin/utils/tag/format.js +3 -2
- package/libs/PanoTagPlugin/utils/tag/tagCheck.d.ts +6 -0
- package/libs/PanoTagPlugin/utils/tag/tagCheck.js +26 -14
- package/libs/PanoTagPlugin/utils/tagPosition.d.ts +12 -3
- package/libs/PanoTagPlugin/utils/tagPosition.js +49 -16
- package/libs/PanoVideoPlugin/Controller.js +9 -8
- package/libs/PanoVideoPlugin/VideoMeshController.js +3 -2
- package/libs/PanoVideoPlugin/index.js +6 -5
- package/libs/PipelinePlugin/Controller.js +3 -2
- package/libs/PipelinePlugin/index.js +4 -3
- package/libs/PipelinePlugin/utils/Objects/FlowPipe.js +3 -2
- package/libs/PipelinePlugin/utils/Objects/HighlightPipe.js +3 -2
- package/libs/PipelinePlugin/utils/Objects/Pipe.js +1 -0
- package/libs/Sculpt/Meshes/Line.d.ts +4 -0
- package/libs/Sculpt/Meshes/Line.js +85 -76
- package/libs/Sculpt/Meshes/Point.js +28 -28
- package/libs/Sculpt/Meshes/Polygon.js +43 -43
- package/libs/Sculpt/index.js +1 -1
- package/libs/Sculpt/utils/Modules/Cursor.js +7 -7
- package/libs/base/BasePlugin.js +1 -1
- package/libs/floorplan/FloorplanGuidePlugin/Controller.js +3 -2
- package/libs/floorplan/FloorplanGuidePlugin/index.js +4 -3
- package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/MapviewFloorplanPlugin/index.js +4 -3
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/ModelFloorplanPlugin/index.js +4 -3
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +4 -3
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/TopviewFloorplanPlugin/index.js +4 -3
- package/libs/index.js +164 -158
- package/libs/shared-utils/five/getFiveFromParentChain.d.ts +7 -0
- package/libs/shared-utils/five/getFiveFromParentChain.js +15 -0
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/utils/PointHelper2.js +1 -0
- 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,516 @@
|
|
|
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/five/getFiveFromParentChain.js";
|
|
104
|
+
import "../../../shared-utils/three/core/LineGeometry.js";
|
|
105
|
+
import "../../../shared-utils/three/core/LineMaterial.js";
|
|
106
|
+
import "../../../shared-utils/three/core/Line2.js";
|
|
107
|
+
import "../../../shared-utils/three/core/LineMaterial2.js";
|
|
108
|
+
import "../../../Sculpt/utils/unit.js";
|
|
109
|
+
import "../../../Sculpt/utils/renderDom.js";
|
|
110
|
+
import "../../../CSS3DRenderPlugin/utils/three/CSS3DSprite.js";
|
|
111
|
+
import "../../../shared-utils/isTouchDevice.js";
|
|
112
|
+
import "../../../shared-utils/five/getPosition.js";
|
|
113
|
+
import "../../../shared-utils/five/getRaycasterByNdcPosition.js";
|
|
114
|
+
import "../../../shared-utils/three/PointSelector/utils/contents.js";
|
|
115
|
+
import "../../../Sculpt/utils/three/rayOnLine.js";
|
|
116
|
+
import "../../../vendor/animejs/lib/anime.es.js";
|
|
117
|
+
import "../../../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
|
|
118
|
+
import "../../../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
|
|
119
|
+
import "../../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
120
|
+
import "../../../Sculpt/utils/Modules/Global.js";
|
|
121
|
+
import "../../../Sculpt/utils/Modules/Cursor.js";
|
|
122
|
+
import "../../../Sculpt/utils/Modules/DeleteButtonBgBorder.js";
|
|
123
|
+
import "../../../Sculpt/utils/Modules/DeleteIconSVG.js";
|
|
124
|
+
import "../../../Object3DHelperPlugin/Controller.js";
|
|
125
|
+
import "../../../base/BasePlugin.js";
|
|
126
|
+
import "../../../shared-utils/Object3DHelper/Helper/MoveHelper.js";
|
|
127
|
+
import "../../../shared-utils/Object3DHelper/Base/BaseHelper.js";
|
|
128
|
+
import "../../../shared-utils/Object3DHelper/utils/setObjectQuaternion.js";
|
|
129
|
+
import "../../../shared-utils/three/boundingBox.js";
|
|
130
|
+
import "../../../shared-utils/Object3DHelper/Helper/Objects/ArrowGroup.js";
|
|
131
|
+
import "../../../shared-utils/Object3DHelper/utils/direction.js";
|
|
132
|
+
import "../../../shared-utils/Object3DHelper/Constants/RenderOrder.js";
|
|
133
|
+
import "../../../shared-utils/Object3DHelper/Helper/Objects/CenterHandle.js";
|
|
134
|
+
import "../../../shared-utils/Object3DHelper/Constants/color.js";
|
|
135
|
+
import "../../../shared-utils/Object3DHelper/utils/calculateScaleByCamera.js";
|
|
136
|
+
import "../../../shared-utils/Object3DHelper/utils/getPoseFromCamera.js";
|
|
137
|
+
import "../../../shared-utils/clamp.js";
|
|
138
|
+
import "../../../shared-utils/Object3DHelper/utils/getOrthographicCameraDirection.js";
|
|
139
|
+
import "../../../shared-utils/Object3DHelper/Helper/RotateHelper.js";
|
|
140
|
+
import "../../../shared-utils/Object3DHelper/Helper/HTML/tipsDom.js";
|
|
141
|
+
import "../../../shared-utils/Object3DHelper/Helper/HTML/utils/createElement.js";
|
|
142
|
+
import "../../../shared-utils/Object3DHelper/Helper/CSS3DScaleHelper.js";
|
|
143
|
+
import "../../../shared-utils/Object3DHelper/Helper/HTML/rectangleScaleDom.js";
|
|
144
|
+
import "../../../shared-utils/Object3DHelper/utils/cameraHooks.js";
|
|
145
|
+
import "../../../shared-utils/Object3DHelper/Helper/BoundingBoxHelper.js";
|
|
146
|
+
import "../../../shared-utils/Object3DHelper/Controller/MoveController.js";
|
|
147
|
+
import "../../../shared-utils/Object3DHelper/Base/BaseController.js";
|
|
148
|
+
import "../../../shared-utils/Object3DHelper/utils/solidGuide.js";
|
|
149
|
+
import "../../../shared-utils/Object3DHelper/utils/getMouseRaycaster.js";
|
|
150
|
+
import "../../../shared-utils/Object3DHelper/utils/calculateThreeMouse.js";
|
|
151
|
+
import "../../../Object3DHelperPlugin/FiveControllerWrapper.js";
|
|
152
|
+
import "../../../shared-utils/Object3DHelper/index.js";
|
|
153
|
+
import "../../../shared-utils/Object3DHelper/Controller/RotateController.js";
|
|
154
|
+
import "../../../shared-utils/math/rad2Deg.js";
|
|
155
|
+
import "../../../shared-utils/math/deg2Rad.js";
|
|
156
|
+
import "../../../shared-utils/Object3DHelper/Controller/CSS3DScaleController.js";
|
|
157
|
+
import "../../../shared-utils/Object3DHelper/Controller/RectangleScaleController.js";
|
|
158
|
+
import "../../../shared-utils/three/vectorIsEqual.js";
|
|
159
|
+
import "../../../shared-utils/Object3DHelper/Controller/BoundingBoxController.js";
|
|
160
|
+
import "../../../shared-utils/Object3DHelper/Helper/ScaleHelper.js";
|
|
161
|
+
import "../../../shared-utils/Object3DHelper/Controller/ScaleController.js";
|
|
162
|
+
import "../../../shared-utils/three/getNormal.js";
|
|
163
|
+
import "../../../shared-utils/threex/domevents/index.js";
|
|
164
|
+
import "../../../shared-utils/five/FiveDomEvents.js";
|
|
165
|
+
import "../../../shared-utils/five/calculateThreeMouse.js";
|
|
166
|
+
import "../../../shared-utils/three/recurveFindObject.js";
|
|
167
|
+
import "../../../Sculpt/Objects/Polyline/index.js";
|
|
168
|
+
import "../../../Sculpt/Meshes/Polyline.js";
|
|
169
|
+
import "../../../Sculpt/Meshes/LineWithDots.js";
|
|
170
|
+
import "../../../Sculpt/Meshes/Point.js";
|
|
171
|
+
import "../../../shared-utils/three/closeVectors.js";
|
|
172
|
+
import "../../../Sculpt/Objects/Base/index.js";
|
|
173
|
+
import "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
|
|
174
|
+
import "../../../Sculpt/Objects/Polyline/Editor.js";
|
|
175
|
+
import "../../../Sculpt/Objects/Line/Editor.js";
|
|
176
|
+
import "../../../Sculpt/Objects/Base/Editor.js";
|
|
177
|
+
import "../../../shared-utils/three/vector3ToArray.js";
|
|
178
|
+
import "../../../Sculpt/Objects/Point/index.js";
|
|
179
|
+
import "../../../Sculpt/Objects/Point/Editor.js";
|
|
180
|
+
import "../../../Sculpt/Objects/Polygon/index.js";
|
|
181
|
+
import "../../../Sculpt/Meshes/Area.js";
|
|
182
|
+
import "../../../Sculpt/Meshes/PolygonWithEdge.js";
|
|
183
|
+
import "../../../Sculpt/Meshes/Polygon.js";
|
|
184
|
+
import "../../../shared-utils/three/generatePolygonGeometry.js";
|
|
185
|
+
import "../../../shared-utils/three/earcut3D.js";
|
|
186
|
+
import "../../../PanoMeasurePlugin/utils/isIntersecting.js";
|
|
187
|
+
import "../../../Sculpt/utils/three/ColoredMesh.js";
|
|
188
|
+
import "../../../shared-utils/three/geometryUtil.js";
|
|
189
|
+
import "../../../Sculpt/Objects/Polygon/Editor.js";
|
|
190
|
+
import "../../../Sculpt/Objects/Prism/index.js";
|
|
191
|
+
import "../../../Sculpt/Meshes/Prism.js";
|
|
192
|
+
import "../../../shared-utils/three/core/PrismGeometry.js";
|
|
193
|
+
import "../../../shared-utils/three/core/polygonVertex.js";
|
|
194
|
+
import "../../../shared-utils/three/core/PrismAnimationGeometry.js";
|
|
195
|
+
import "../../../Sculpt/Editors/PrismMeshEditor.js";
|
|
196
|
+
import "../../../Sculpt/Objects/Rectangle/index.js";
|
|
197
|
+
import "../../../Sculpt/Editors/RectangleMeshEditor.js";
|
|
198
|
+
import "../../../Sculpt/Meshes/Rectangle.js";
|
|
199
|
+
import "../../../Sculpt/utils/three/RectangleGeometry.js";
|
|
200
|
+
import "../../../Sculpt/Meshes/RectangleWithEdge.js";
|
|
201
|
+
import "../../../Sculpt/utils/sortPositionsByCameraPosition.js";
|
|
202
|
+
import "../../../Sculpt/Objects/Circle/index.js";
|
|
203
|
+
import "../../../Sculpt/Editors/CircleMeshEditor.js";
|
|
204
|
+
import "../../../Sculpt/Meshes/CircleWithEdge.js";
|
|
205
|
+
import "../../../Sculpt/Meshes/Circle.js";
|
|
206
|
+
import "../../../Sculpt/utils/radiusToSegments.js";
|
|
207
|
+
import "../../../Sculpt/Objects/Cylinder/index.js";
|
|
208
|
+
import "../../../Sculpt/Meshes/Cylinder.js";
|
|
209
|
+
import "../../../Sculpt/Editors/CylinderMeshEditor.js";
|
|
210
|
+
import "../../../shared-utils/forReverseEach.js";
|
|
211
|
+
import "../../../Sculpt/Objects/Line/index.js";
|
|
212
|
+
import "../../../Sculpt/Editors/BoxMeshEditor.js";
|
|
213
|
+
import "../../../Sculpt/Meshes/Box.js";
|
|
214
|
+
class ne extends z {
|
|
215
|
+
constructor(t, i) {
|
|
216
|
+
super(t, i);
|
|
217
|
+
f(this, "tagStyle");
|
|
218
|
+
f(this, "clickEventDispose");
|
|
219
|
+
f(this, "domClickDispose");
|
|
220
|
+
f(this, "screenPosition", null);
|
|
221
|
+
this.tagStyle = i.style, this.initializeSculptBox(), this.updateVisible();
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 获取 Box 样式配置(合并用户配置和默认值)
|
|
225
|
+
*/
|
|
226
|
+
getBoxStyle() {
|
|
227
|
+
var i, o, e, s;
|
|
228
|
+
const t = ((i = this.tagStyle) == null ? void 0 : i.boxOrPolygon) || {};
|
|
229
|
+
return {
|
|
230
|
+
color: (o = t.color) != null ? o : 16777215,
|
|
231
|
+
opacity: (e = t.opacity) != null ? e : 0.4,
|
|
232
|
+
lineColor: (s = t.color) != null ? s : 16777215,
|
|
233
|
+
lineWidth: 1
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* 更新 Box 样式
|
|
238
|
+
*/
|
|
239
|
+
updateBoxStyle() {
|
|
240
|
+
if (!this.boxShape || !this.boxShape.boxMesh)
|
|
241
|
+
return;
|
|
242
|
+
const t = this.getBoxStyle();
|
|
243
|
+
this.boxShape.boxMesh.setStyle(t);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* 更新标签数据
|
|
247
|
+
*/
|
|
248
|
+
set(t, i = !0) {
|
|
249
|
+
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();
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* 设置标签数据
|
|
253
|
+
*/
|
|
254
|
+
setData(...t) {
|
|
255
|
+
super.setData(...t);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* 获取盒子的中心点
|
|
259
|
+
*/
|
|
260
|
+
getCenter() {
|
|
261
|
+
const t = this.position;
|
|
262
|
+
if (!(t != null && t.start) || !(t != null && t.end))
|
|
263
|
+
return [0, 0, 0];
|
|
264
|
+
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);
|
|
265
|
+
return x(p, this.workUtil.transform).toArray();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* 获取盒子的8个角点坐标
|
|
269
|
+
*/
|
|
270
|
+
getCorners() {
|
|
271
|
+
if (this.boxShape) {
|
|
272
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = new r.Vector3().subVectors(
|
|
273
|
+
u(t.heightPoint),
|
|
274
|
+
i[0]
|
|
275
|
+
), e = i.map((s) => s.clone().add(o));
|
|
276
|
+
return [...i, ...e];
|
|
277
|
+
}
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 计算盒子的法向量
|
|
282
|
+
*/
|
|
283
|
+
computeNormal() {
|
|
284
|
+
const t = this.position;
|
|
285
|
+
if (!t.rotation)
|
|
286
|
+
return new r.Vector3(0, 1, 0);
|
|
287
|
+
const i = new r.Euler().fromArray(t.rotation), o = new r.Vector3(0, 1, 0);
|
|
288
|
+
return o.applyEuler(i), o;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* 初始化 Sculpt Box
|
|
292
|
+
*/
|
|
293
|
+
initializeSculptBox() {
|
|
294
|
+
if (this.boxShape)
|
|
295
|
+
return;
|
|
296
|
+
const t = this.position;
|
|
297
|
+
if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
|
|
298
|
+
return;
|
|
299
|
+
const i = new T(this.five, void 0, {
|
|
300
|
+
magnifier: null
|
|
301
|
+
});
|
|
302
|
+
i.clear(), i.group.removeFromParent();
|
|
303
|
+
const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), s = new D(
|
|
304
|
+
{
|
|
305
|
+
id: M(),
|
|
306
|
+
type: "Box",
|
|
307
|
+
points: o.bottomPoints,
|
|
308
|
+
heightPoint: o.heightPoint,
|
|
309
|
+
style: e
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
defaultAction: !1,
|
|
313
|
+
occlusionVisibility: !1
|
|
314
|
+
// occlusionMode: 'translucence' as any,
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
s.visible = this.visible, this.plugin.imagePlaneGroup.add(s), this.boxShape = s, s.editor.hooks.on("objectUpdate", () => {
|
|
318
|
+
this.syncBoxPositionFromSculpt();
|
|
319
|
+
}), s.editor.disable(), this.setupClickEvents();
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* 设置点击事件
|
|
323
|
+
*/
|
|
324
|
+
setupClickEvents() {
|
|
325
|
+
var i;
|
|
326
|
+
if (!this.boxShape || !this.boxShape.boxMesh || this.config.clickable === !1) {
|
|
327
|
+
console.warn(
|
|
328
|
+
`[BoxTag ${this.id}] Cannot setup click events: boxShape=${!!this.boxShape}, boxMesh=${!!((i = this.boxShape) != null && i.boxMesh)}, clickable=${this.config.clickable}`
|
|
329
|
+
);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
this.cleanupClickEvents();
|
|
333
|
+
const t = (o) => {
|
|
334
|
+
this.plugin.hooks.emit("click", { event: o, target: "TagBoxModel", tag: this });
|
|
335
|
+
};
|
|
336
|
+
requestAnimationFrame(() => {
|
|
337
|
+
if (!this.boxShape || !this.plugin.domEvents) {
|
|
338
|
+
console.warn(`[BoxTag ${this.id}] Cannot bind click events: boxShape or domEvents not available`);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.clickEventDispose = this.addObjectClickHandler(this, this.boxShape, t);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 清理点击事件
|
|
346
|
+
*/
|
|
347
|
+
cleanupClickEvents() {
|
|
348
|
+
this.clickEventDispose && (this.clickEventDispose(), this.clickEventDispose = void 0);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* 更新 Sculpt Box 的数据
|
|
352
|
+
*/
|
|
353
|
+
updateSculptBox() {
|
|
354
|
+
if (!this.boxShape)
|
|
355
|
+
return;
|
|
356
|
+
const t = this.position;
|
|
357
|
+
if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
|
|
358
|
+
return;
|
|
359
|
+
const i = this.boxPositionToSculptData(t);
|
|
360
|
+
this.boxShape.setData({
|
|
361
|
+
points: i.bottomPoints.map((o) => o.toArray()),
|
|
362
|
+
heightPoint: i.heightPoint.toArray()
|
|
363
|
+
}), this.setupClickEvents();
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* 启用编辑器
|
|
367
|
+
* 用于编辑已存在的 Box
|
|
368
|
+
*/
|
|
369
|
+
editorEnable() {
|
|
370
|
+
return g(this, null, function* () {
|
|
371
|
+
if (!this.position) {
|
|
372
|
+
console.warn("[BoxTag] Cannot enable editor without position. Call startDrawing() first.");
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.boxShape || this.initializeSculptBox(), this.boxShape && (this.boxShape.visible = !0, this.boxShape.editor.enable());
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* 禁用编辑器
|
|
380
|
+
*/
|
|
381
|
+
editorDisable() {
|
|
382
|
+
this.boxShape && this.boxShape.editor.disable();
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* 从 Sculpt Box 同步 position 到 BoxTag
|
|
386
|
+
*/
|
|
387
|
+
syncBoxPositionFromSculpt() {
|
|
388
|
+
if (!this.boxShape)
|
|
389
|
+
return;
|
|
390
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = u(t.heightPoint), e = U(i, o);
|
|
391
|
+
this.position = e, this.hooks.emit("positionChanged", e);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* 将 BoxPosition 转换为 Sculpt 需要的数据格式
|
|
395
|
+
*/
|
|
396
|
+
boxPositionToSculptData(t) {
|
|
397
|
+
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 = [
|
|
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
|
+
new r.Vector3(-0.5, -0.5, 0.5)
|
|
402
|
+
], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
|
|
403
|
+
const C = V.clone().multiply(c).applyMatrix4(p).add(s);
|
|
404
|
+
return x(C, m);
|
|
405
|
+
}), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
|
|
406
|
+
return { bottomPoints: v, heightPoint: k };
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @description 点击事件处理
|
|
410
|
+
*/
|
|
411
|
+
onClick(t) {
|
|
412
|
+
t.target === "TagBoxModel" && this.unfoldAndFoldOthers();
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* @description 展开自己,收起其他标签
|
|
416
|
+
*/
|
|
417
|
+
unfoldAndFoldOthers() {
|
|
418
|
+
if (this.isPopoverConfigEnabled())
|
|
419
|
+
return;
|
|
420
|
+
const t = this.can("fold"), i = this.can("unfold");
|
|
421
|
+
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) => {
|
|
422
|
+
o.id !== this.id && o.fold();
|
|
423
|
+
}));
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* 展开标签详情
|
|
427
|
+
*/
|
|
428
|
+
unfold() {
|
|
429
|
+
this.isPopoverConfigEnabled() || this.setUnfold(!0);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* 折叠标签详情
|
|
433
|
+
*/
|
|
434
|
+
fold() {
|
|
435
|
+
this.isPopoverConfigEnabled() || this.setUnfold(!1);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* 设置展开/折叠状态
|
|
439
|
+
*/
|
|
440
|
+
setUnfold(t) {
|
|
441
|
+
if (this.isPopoverConfigEnabled())
|
|
442
|
+
return;
|
|
443
|
+
const i = this.can("fold"), o = this.can("unfold");
|
|
444
|
+
i && o && (this.state.unfolded = t, this.hooks.emit(t ? "unfolded" : "folded"), this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }));
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* 更新屏幕位置(用于在 2D UI 中显示内容)
|
|
448
|
+
* 显示在 Box 最右侧的顶点位置
|
|
449
|
+
*/
|
|
450
|
+
updateScreenPosition() {
|
|
451
|
+
if (!this.currentVisible) {
|
|
452
|
+
this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
const i = this.position;
|
|
456
|
+
if (!(i != null && i.start) || !(i != null && i.end)) {
|
|
457
|
+
this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), s = new r.Euler().fromArray(i.rotation), l = [
|
|
461
|
+
new r.Vector3(o.x, o.y, o.z),
|
|
462
|
+
new r.Vector3(e.x, o.y, o.z),
|
|
463
|
+
new r.Vector3(o.x, e.y, o.z),
|
|
464
|
+
new r.Vector3(e.x, e.y, o.z),
|
|
465
|
+
new r.Vector3(o.x, o.y, e.z),
|
|
466
|
+
new r.Vector3(e.x, o.y, e.z),
|
|
467
|
+
new r.Vector3(o.x, e.y, e.z),
|
|
468
|
+
new r.Vector3(e.x, e.y, e.z)
|
|
469
|
+
], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
|
|
470
|
+
l.forEach((m) => {
|
|
471
|
+
m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
|
|
472
|
+
});
|
|
473
|
+
let d = l[0];
|
|
474
|
+
l.forEach((m) => {
|
|
475
|
+
m.x > d.x && (d = m);
|
|
476
|
+
});
|
|
477
|
+
const c = d.clone().project(this.five.camera);
|
|
478
|
+
if (c.x < -1 || c.x > 1 || c.y < -1 || c.y > 1 || c.z < 0 || c.z > 1)
|
|
479
|
+
this.screenPosition = null;
|
|
480
|
+
else if (this.five.renderer) {
|
|
481
|
+
const m = this.five.renderer.getSize(new r.Vector2());
|
|
482
|
+
this.screenPosition = {
|
|
483
|
+
leftPx: (c.x + 1) / 2 * m.x,
|
|
484
|
+
topPx: (-c.y + 1) / 2 * m.y,
|
|
485
|
+
scale: 1
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
489
|
+
}
|
|
490
|
+
get centerPosition() {
|
|
491
|
+
const t = A(this.position, this.workUtil.transform), i = F(t, this.matrix);
|
|
492
|
+
let o = i[0];
|
|
493
|
+
return i.forEach((e) => {
|
|
494
|
+
e.x > o.x && (o = e);
|
|
495
|
+
}), o;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 应用可见性变化
|
|
499
|
+
*/
|
|
500
|
+
applyVisible() {
|
|
501
|
+
var t;
|
|
502
|
+
this.boxShape && (this.plugin.imagePlaneGroup.children.includes(this.boxShape) || (console.warn(`[BoxTag ${this.id}] applyVisible: boxShape not in imagePlaneGroup, re-adding...`, {
|
|
503
|
+
boxShapeParent: ((t = this.boxShape.parent) == null ? void 0 : t.name) || "null",
|
|
504
|
+
imagePlaneGroupChildren: this.plugin.imagePlaneGroup.children.length
|
|
505
|
+
}), this.boxShape.parent && this.boxShape.parent.remove(this.boxShape), this.plugin.imagePlaneGroup.add(this.boxShape)), this.boxShape.visible = this.visible), this.updateScreenPosition();
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* 销毁标签
|
|
509
|
+
*/
|
|
510
|
+
dispose() {
|
|
511
|
+
this.cleanupClickEvents(), this.domClickDispose && (this.domClickDispose(), this.domClickDispose = void 0), this.boxShape && (this.boxShape.removeFromParent(), this.boxShape = void 0);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
export {
|
|
515
|
+
ne as BoxTag
|
|
516
|
+
};
|