dxfview 0.0.4-beta.16 → 0.0.4-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dxfview.esm.min.js +3 -3
- package/dist/types/core/helpers/OSnapHelper.d.ts +30 -1
- package/dist/types/plugins/annotation/AnnotationPlugin.d.ts +39 -0
- package/dist/types/plugins/annotation/BaseAnnotation.d.ts +3 -1
- package/dist/types/plugins/annotation/BaseAnnotationDrawable.d.ts +2 -0
- package/dist/types/plugins/annotation/FreeDrawAnnotation.d.ts +1 -1
- package/dist/types/plugins/annotation/RectAnnotation.d.ts +1 -1
- package/dist/types/plugins/divide/FrameAnnotation.d.ts +1 -0
- package/package.json +92 -90
|
@@ -79,6 +79,7 @@ export declare class OSnapHelper {
|
|
|
79
79
|
protected activeOSnapType: OSnapType;
|
|
80
80
|
protected snapToleranceInWorldCoord: number;
|
|
81
81
|
protected intersectionLimit: number;
|
|
82
|
+
protected orthoModeEnabled: boolean;
|
|
82
83
|
/**
|
|
83
84
|
* OSnapType 的优先级,数值越小优先级越高。
|
|
84
85
|
* 在多种捕捉结果出现时,依据优先级与距离选择最终的捕捉点。
|
|
@@ -105,6 +106,28 @@ export declare class OSnapHelper {
|
|
|
105
106
|
getSnapTolerance(): number;
|
|
106
107
|
setIntersectionLimit(val: number): void;
|
|
107
108
|
getIntersectionLimit(): number;
|
|
109
|
+
/**
|
|
110
|
+
* 设置正交模式开关。
|
|
111
|
+
* 启用后,绘制的线条会被约束为水平或垂直方向。
|
|
112
|
+
* @param enabled 是否启用正交模式
|
|
113
|
+
*/
|
|
114
|
+
setOrthoModeEnabled(enabled: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* 获取正交模式是否启用。
|
|
117
|
+
*/
|
|
118
|
+
isOrthoModeEnabled(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 获取当前激活的捕捉类型。
|
|
121
|
+
* 用于判断是否应用正交约束(例如,垂足捕捉时不应用正交约束)。
|
|
122
|
+
*/
|
|
123
|
+
getActiveOSnapType(): OSnapType;
|
|
124
|
+
/**
|
|
125
|
+
* 应用正交约束:根据参考点将当前位置约束为水平或垂直方向(90° 的倍数:0°、90°、180°、270°)。
|
|
126
|
+
* @param currentPosition 当前鼠标位置(世界坐标)
|
|
127
|
+
* @param referencePosition 参考点位置(通常是上一个点击的位置)
|
|
128
|
+
* @returns 应用正交约束后的位置
|
|
129
|
+
*/
|
|
130
|
+
applyOrthoConstraint(currentPosition: THREE.Vector3, referencePosition: THREE.Vector3): THREE.Vector3;
|
|
108
131
|
/**
|
|
109
132
|
* Gets osnap marker line color.
|
|
110
133
|
* @returns rgb/rgba number array, each value is between 0 and 1. e.g. [0.92, 0.95, 0.96].
|
|
@@ -140,9 +163,10 @@ export declare class OSnapHelper {
|
|
|
140
163
|
* @param intersections The raycaster intersections, must have been sorted by distance.
|
|
141
164
|
* @param is3d If it is a 3d or 2d viewer.
|
|
142
165
|
* @param lastMouseDownPosition Used in order to to get foot of perpendicular.
|
|
166
|
+
* @param mousePositionOverride Optional mouse world position (useful for 2d to avoid ray hit drift).
|
|
143
167
|
* @returns Target snap point if any
|
|
144
168
|
*/
|
|
145
|
-
handleSnap(rayCasterResult: THREE.Intersection[], is3d: boolean, lastMouseDownPosition?: THREE.Vector3): THREE.Vector3 | undefined;
|
|
169
|
+
handleSnap(rayCasterResult: THREE.Intersection[], is3d: boolean, lastMouseDownPosition?: THREE.Vector3, mousePositionOverride?: THREE.Vector3): THREE.Vector3 | undefined;
|
|
146
170
|
/**
|
|
147
171
|
* Tries to find a proper snap point and display corresponding marker.
|
|
148
172
|
* @param mousePosition Mouse position in world coordinate.
|
|
@@ -157,6 +181,11 @@ export declare class OSnapHelper {
|
|
|
157
181
|
private getSnapInfo;
|
|
158
182
|
private getOsnapInfoListFromMesh;
|
|
159
183
|
private getOsnapInfoFromSegment;
|
|
184
|
+
/**
|
|
185
|
+
* 根据 intersection.index 获取具体线段并计算捕捉信息
|
|
186
|
+
* 这是解决捕捉漏掉/偏差问题的核心方法
|
|
187
|
+
*/
|
|
188
|
+
private getOsnapInfoFromIntersectionIndex;
|
|
160
189
|
private getOsnapInfoListFromLine;
|
|
161
190
|
private getOsnapInfoListFromPoint;
|
|
162
191
|
/**
|
|
@@ -17,6 +17,10 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
17
17
|
private additionMode;
|
|
18
18
|
private mobileTouchHelper?;
|
|
19
19
|
private selectedMaskColor?;
|
|
20
|
+
private snapObjects;
|
|
21
|
+
private snapObjectsDirty;
|
|
22
|
+
private pendingSnapDrawableIds;
|
|
23
|
+
private snapLineMaterial?;
|
|
20
24
|
private readonly partitionLabels;
|
|
21
25
|
constructor(viewer: BaseViewer);
|
|
22
26
|
getDrawableList(): {
|
|
@@ -27,6 +31,12 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
27
31
|
}[];
|
|
28
32
|
getDrawableDatas(): AnnotationData[];
|
|
29
33
|
setDrawableDatas(datas: AnnotationData[]): void;
|
|
34
|
+
getSnapObjects(excludeId?: string): THREE.Object3D[];
|
|
35
|
+
invalidateSnapObjects(): void;
|
|
36
|
+
private rebuildSnapObjects;
|
|
37
|
+
private disposeSnapObjects;
|
|
38
|
+
private getSnapLineMaterial;
|
|
39
|
+
private collectDrawableSegments;
|
|
30
40
|
getAigcJson(): {
|
|
31
41
|
properties: {
|
|
32
42
|
uuid: number;
|
|
@@ -92,6 +102,16 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
92
102
|
* We should call this once camera's zoom, fov or position/target changed, etc.
|
|
93
103
|
*/
|
|
94
104
|
private updateSnapTolerance;
|
|
105
|
+
/**
|
|
106
|
+
* 设置正交模式开关。
|
|
107
|
+
* 启用后,绘制标注的线条会被约束为水平或垂直方向。
|
|
108
|
+
* @param enabled 是否启用正交模式
|
|
109
|
+
*/
|
|
110
|
+
setOrthoModeEnabled(enabled: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* 获取正交模式是否启用。
|
|
113
|
+
*/
|
|
114
|
+
isOrthoModeEnabled(): boolean;
|
|
95
115
|
/**
|
|
96
116
|
*
|
|
97
117
|
* @param {AnnotationModeType} type
|
|
@@ -158,6 +178,11 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
158
178
|
* 用于工具栏撤回按钮调用
|
|
159
179
|
*/
|
|
160
180
|
undo(): void;
|
|
181
|
+
/**
|
|
182
|
+
* 公开的重做方法,和 Ctrl+Y 的逻辑一致
|
|
183
|
+
* 用于工具栏重做按钮调用
|
|
184
|
+
*/
|
|
185
|
+
redo(): void;
|
|
161
186
|
/**
|
|
162
187
|
*
|
|
163
188
|
* @param {AnnotationData[]} dataArray
|
|
@@ -207,6 +232,20 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
207
232
|
* @description Unselects an annotation.
|
|
208
233
|
*/
|
|
209
234
|
unselect(renderEnabled?: boolean): void;
|
|
235
|
+
/**
|
|
236
|
+
* 批量吸附世界坐标点到DXF图形
|
|
237
|
+
* 使用标准的OSnapHelper进行吸附,和正常标注绘制时的吸附逻辑完全一致
|
|
238
|
+
*
|
|
239
|
+
* @param worldPoints 世界坐标点数组
|
|
240
|
+
* @param excludeId 排除的标注ID(避免吸附到自己)
|
|
241
|
+
* @returns 吸附后的世界坐标点数组
|
|
242
|
+
*/
|
|
243
|
+
snapWorldPoints(worldPoints: THREE.Vector3[], excludeId?: string): THREE.Vector3[];
|
|
244
|
+
/**
|
|
245
|
+
* 停用吸附标记
|
|
246
|
+
* 在AI识别吸附完成后调用,清除视觉反馈标记
|
|
247
|
+
*/
|
|
248
|
+
deactivateSnap(): void;
|
|
210
249
|
/**
|
|
211
250
|
* @description Destroy annotation plugin
|
|
212
251
|
*/
|
|
@@ -3,7 +3,7 @@ import type { BaseAnnotationDrawable } from "./BaseAnnotationDrawable";
|
|
|
3
3
|
import { AnnotationModeType } from "./BaseAnnotationDrawable";
|
|
4
4
|
import { Tooltip } from "../../components/tool-tip";
|
|
5
5
|
import { DrawableList } from "../../core/canvas/DrawableList";
|
|
6
|
-
import type
|
|
6
|
+
import { type MobileTouchHelperDrawable, type OSnapHelper } from "../../core/helpers";
|
|
7
7
|
import { EventInfo, InputManager } from "../../core/input/InputManager";
|
|
8
8
|
import { Event } from "../../core/utils";
|
|
9
9
|
import type { BaseViewer } from "../../core/viewers";
|
|
@@ -142,5 +142,7 @@ export declare abstract class BaseAnnotation extends Event<AnnotationEvents> {
|
|
|
142
142
|
* @param e 事件信息(包含屏幕坐标)
|
|
143
143
|
*/
|
|
144
144
|
getIntersections: (e: EventInfo) => THREE.Intersection[];
|
|
145
|
+
private getAnnotationSnapObjects;
|
|
146
|
+
protected getMouseWorldPosition(e: EventInfo): THREE.Vector3 | undefined;
|
|
145
147
|
}
|
|
146
148
|
export {};
|
|
@@ -142,10 +142,12 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
|
|
|
142
142
|
* 获取与场景的交点列表(用于吸附)
|
|
143
143
|
*/
|
|
144
144
|
getIntersections(e: EventInfo): THREE.Intersection[];
|
|
145
|
+
private getAnnotationSnapObjects;
|
|
145
146
|
/**
|
|
146
147
|
* 处理鼠标移动时的吸附逻辑
|
|
147
148
|
*/
|
|
148
149
|
handleSnapOnMove(e: EventInfo): THREE.Vector3 | undefined;
|
|
150
|
+
private getMouseWorldPosition;
|
|
149
151
|
/**
|
|
150
152
|
* 激活射线检测器(用于吸附)
|
|
151
153
|
*/
|
|
@@ -2,7 +2,7 @@ import * as THREE from "three";
|
|
|
2
2
|
import { BaseAnnotation } from "./BaseAnnotation";
|
|
3
3
|
import { BaseAnnotationDrawable } from "./BaseAnnotationDrawable";
|
|
4
4
|
import { DrawableList } from "../../core/canvas/DrawableList";
|
|
5
|
-
import type
|
|
5
|
+
import { type OSnapHelper } from "../../core/helpers";
|
|
6
6
|
import { EventInfo, InputManager } from "../../core/input/InputManager";
|
|
7
7
|
import type { BaseViewer } from "../../core/viewers";
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@ import * as THREE from "three";
|
|
|
2
2
|
import { BaseAnnotation } from "./BaseAnnotation";
|
|
3
3
|
import { AnnotationModeType, BaseAnnotationDrawable } from "./BaseAnnotationDrawable";
|
|
4
4
|
import type { DrawableList } from "../../core/canvas/DrawableList";
|
|
5
|
-
import type
|
|
5
|
+
import { type OSnapHelper } from "../../core/helpers";
|
|
6
6
|
import type { EventInfo, InputManager } from "../../core/input/InputManager";
|
|
7
7
|
import type { BaseViewer } from "../../core/viewers";
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,90 +1,92 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dxfview",
|
|
3
|
-
"version": "0.0.4-beta.
|
|
4
|
-
"homepage": "",
|
|
5
|
-
"module": "dist/dxfview.esm.min.js",
|
|
6
|
-
"main": "dist/dxfview.esm.min.js",
|
|
7
|
-
"types": "dist/types/index.d.ts",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"clean": "rimraf dist build",
|
|
11
|
-
"build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
|
|
12
|
-
"build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
|
|
13
|
-
"build:datatype": "tsc && tsc-alias",
|
|
14
|
-
"build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
|
|
15
|
-
"build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
|
|
16
|
-
"build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
|
|
17
|
-
"demo": "npm run build:dev && node demo/index.cjs",
|
|
18
|
-
"start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
|
|
19
|
-
"lint": "eslint src --ext ts",
|
|
20
|
-
"lint-fix": "npm run lint -- --fix",
|
|
21
|
-
"docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"/dist"
|
|
25
|
-
],
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git"
|
|
28
|
-
},
|
|
29
|
-
"author": "dxfview",
|
|
30
|
-
"license": "UNLICENSED",
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@noble/ed25519": "^2.0.0",
|
|
33
|
-
"@noble/hashes": "^1.4.0",
|
|
34
|
-
"@types/concaveman": "^1.1.3",
|
|
35
|
-
"@types/lodash": "^4.14.165",
|
|
36
|
-
"@types/resize-observer-browser": "^0.1.7",
|
|
37
|
-
"2d-polygon-boolean": "^1.0.1",
|
|
38
|
-
"2d-polygon-self-intersections": "^1.3.1",
|
|
39
|
-
"camera-controls": "^1.37.4",
|
|
40
|
-
"clipper-lib": "^6.4.2",
|
|
41
|
-
"concaveman": "^1.2.1",
|
|
42
|
-
"core-js": "^3.27.1",
|
|
43
|
-
"disable-devtool": "^0.3.9",
|
|
44
|
-
"i18next": "^21.6.0",
|
|
45
|
-
"intl-pluralrules": "^1.3.1",
|
|
46
|
-
"javascript-obfuscator": "^4.1.1",
|
|
47
|
-
"js-base64": "^3.7.2",
|
|
48
|
-
"jsbi": "^4.3.0",
|
|
49
|
-
"lodash": "^4.17.20",
|
|
50
|
-
"loglevel": "^1.8.0",
|
|
51
|
-
"mitt": "^3.0.0",
|
|
52
|
-
"opentype.js": "^1.3.4",
|
|
53
|
-
"poly-extrude": "^0.2.0",
|
|
54
|
-
"polybooljs": "^1.2.0",
|
|
55
|
-
"polygon-clipping": "^0.15.3",
|
|
56
|
-
"regenerator-runtime": "^0.13.11",
|
|
57
|
-
"screenfull": "^6.0.0",
|
|
58
|
-
"stream": "^0.0.2",
|
|
59
|
-
"three": "^0.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"@
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/
|
|
66
|
-
"@types/
|
|
67
|
-
"@types/
|
|
68
|
-
"@
|
|
69
|
-
"@typescript-eslint/
|
|
70
|
-
"
|
|
71
|
-
"esbuild": "^0.
|
|
72
|
-
"esbuild-plugin-
|
|
73
|
-
"
|
|
74
|
-
"eslint": "^8.
|
|
75
|
-
"eslint-
|
|
76
|
-
"eslint-import
|
|
77
|
-
"eslint-plugin-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dxfview",
|
|
3
|
+
"version": "0.0.4-beta.18",
|
|
4
|
+
"homepage": "",
|
|
5
|
+
"module": "dist/dxfview.esm.min.js",
|
|
6
|
+
"main": "dist/dxfview.esm.min.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf dist build",
|
|
11
|
+
"build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
|
|
12
|
+
"build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
|
|
13
|
+
"build:datatype": "tsc && tsc-alias",
|
|
14
|
+
"build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
|
|
15
|
+
"build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
|
|
16
|
+
"build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
|
|
17
|
+
"demo": "npm run build:dev && node demo/index.cjs",
|
|
18
|
+
"start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
|
|
19
|
+
"lint": "eslint src --ext ts",
|
|
20
|
+
"lint-fix": "npm run lint -- --fix",
|
|
21
|
+
"docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"/dist"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git"
|
|
28
|
+
},
|
|
29
|
+
"author": "dxfview",
|
|
30
|
+
"license": "UNLICENSED",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@noble/ed25519": "^2.0.0",
|
|
33
|
+
"@noble/hashes": "^1.4.0",
|
|
34
|
+
"@types/concaveman": "^1.1.3",
|
|
35
|
+
"@types/lodash": "^4.14.165",
|
|
36
|
+
"@types/resize-observer-browser": "^0.1.7",
|
|
37
|
+
"2d-polygon-boolean": "^1.0.1",
|
|
38
|
+
"2d-polygon-self-intersections": "^1.3.1",
|
|
39
|
+
"camera-controls": "^1.37.4",
|
|
40
|
+
"clipper-lib": "^6.4.2",
|
|
41
|
+
"concaveman": "^1.2.1",
|
|
42
|
+
"core-js": "^3.27.1",
|
|
43
|
+
"disable-devtool": "^0.3.9",
|
|
44
|
+
"i18next": "^21.6.0",
|
|
45
|
+
"intl-pluralrules": "^1.3.1",
|
|
46
|
+
"javascript-obfuscator": "^4.1.1",
|
|
47
|
+
"js-base64": "^3.7.2",
|
|
48
|
+
"jsbi": "^4.3.0",
|
|
49
|
+
"lodash": "^4.17.20",
|
|
50
|
+
"loglevel": "^1.8.0",
|
|
51
|
+
"mitt": "^3.0.0",
|
|
52
|
+
"opentype.js": "^1.3.4",
|
|
53
|
+
"poly-extrude": "^0.2.0",
|
|
54
|
+
"polybooljs": "^1.2.0",
|
|
55
|
+
"polygon-clipping": "^0.15.3",
|
|
56
|
+
"regenerator-runtime": "^0.13.11",
|
|
57
|
+
"screenfull": "^6.0.0",
|
|
58
|
+
"stream": "^0.0.2",
|
|
59
|
+
"three-mesh-bvh": "^0.5.21"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
|
63
|
+
"@types/eslint": "^8.21.1",
|
|
64
|
+
"@types/node": "^18.11.19",
|
|
65
|
+
"@types/resize-observer-browser": "^0.1.7",
|
|
66
|
+
"@types/sha256": "^0.2.0",
|
|
67
|
+
"@types/three": "^0.155.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
69
|
+
"@typescript-eslint/parser": "^5.47.1",
|
|
70
|
+
"esbuild": "^0.16.17",
|
|
71
|
+
"esbuild-plugin-inline-worker": "^0.1.1",
|
|
72
|
+
"esbuild-plugin-sass": "^1.0.1",
|
|
73
|
+
"eslint": "^8.15.0",
|
|
74
|
+
"eslint-config-prettier": "^8.5.0",
|
|
75
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
76
|
+
"eslint-plugin-import": "2.26.0",
|
|
77
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
78
|
+
"express": "^4.17.1",
|
|
79
|
+
"live-server": "^1.2.2",
|
|
80
|
+
"prettier": "^2.5.1",
|
|
81
|
+
"rimraf": "^3.0.2",
|
|
82
|
+
"sha256": "^0.2.0",
|
|
83
|
+
"terser": "^5.16.2",
|
|
84
|
+
"ts-node": "^10.9.1",
|
|
85
|
+
"tsc-alias": "^1.8.2",
|
|
86
|
+
"typedoc": "^0.22.12",
|
|
87
|
+
"typescript": "^4.5.2"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"three": ">=0.155.0 <0.170.0"
|
|
91
|
+
}
|
|
92
|
+
}
|