dxfview 0.0.4-beta.17 → 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.
@@ -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].
@@ -158,6 +181,11 @@ export declare class OSnapHelper {
158
181
  private getSnapInfo;
159
182
  private getOsnapInfoListFromMesh;
160
183
  private getOsnapInfoFromSegment;
184
+ /**
185
+ * 根据 intersection.index 获取具体线段并计算捕捉信息
186
+ * 这是解决捕捉漏掉/偏差问题的核心方法
187
+ */
188
+ private getOsnapInfoFromIntersectionIndex;
161
189
  private getOsnapInfoListFromLine;
162
190
  private getOsnapInfoListFromPoint;
163
191
  /**
@@ -102,6 +102,16 @@ export declare class AnnotationPlugin extends Plugin {
102
102
  * We should call this once camera's zoom, fov or position/target changed, etc.
103
103
  */
104
104
  private updateSnapTolerance;
105
+ /**
106
+ * 设置正交模式开关。
107
+ * 启用后,绘制标注的线条会被约束为水平或垂直方向。
108
+ * @param enabled 是否启用正交模式
109
+ */
110
+ setOrthoModeEnabled(enabled: boolean): void;
111
+ /**
112
+ * 获取正交模式是否启用。
113
+ */
114
+ isOrthoModeEnabled(): boolean;
105
115
  /**
106
116
  *
107
117
  * @param {AnnotationModeType} type
@@ -222,6 +232,20 @@ export declare class AnnotationPlugin extends Plugin {
222
232
  * @description Unselects an annotation.
223
233
  */
224
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;
225
249
  /**
226
250
  * @description Destroy annotation plugin
227
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 { MobileTouchHelperDrawable, OSnapHelper } from "../../core/helpers";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxfview",
3
- "version": "0.0.4-beta.17",
3
+ "version": "0.0.4-beta.18",
4
4
  "homepage": "",
5
5
  "module": "dist/dxfview.esm.min.js",
6
6
  "main": "dist/dxfview.esm.min.js",
@@ -84,8 +84,7 @@
84
84
  "ts-node": "^10.9.1",
85
85
  "tsc-alias": "^1.8.2",
86
86
  "typedoc": "^0.22.12",
87
- "typescript": "^4.5.2",
88
- "three": "^0.155.0"
87
+ "typescript": "^4.5.2"
89
88
  },
90
89
  "peerDependencies": {
91
90
  "three": ">=0.155.0 <0.170.0"