dxfview 0.0.4-beta.2 → 0.0.4-beta.20

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.
@@ -0,0 +1,27 @@
1
+ import * as THREE from "three";
2
+ import { Drawable } from "./Drawable";
3
+ declare type SelectionBoxOptions = {
4
+ lineColor?: number[];
5
+ lineWidth?: number;
6
+ dashed?: boolean;
7
+ dashPattern?: number[];
8
+ };
9
+ /**
10
+ * Lightweight drawable for visualizing a world-space selection box.
11
+ * Kept independent from annotation classes to avoid editing/snap overhead.
12
+ */
13
+ export declare class SelectionBoxDrawable extends Drawable {
14
+ private min;
15
+ private max;
16
+ private dashed;
17
+ private dashPattern;
18
+ constructor(id: string, min: THREE.Vector3, max: THREE.Vector3, options?: SelectionBoxOptions);
19
+ update(min: THREE.Vector3, max: THREE.Vector3): void;
20
+ getClassType(): string;
21
+ getVertexes(): THREE.Vector3[];
22
+ getBounds(): THREE.Box3;
23
+ isPointInPath(p: THREE.Vector3): boolean;
24
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
25
+ drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
26
+ }
27
+ export {};
@@ -32,11 +32,11 @@ export declare class Offset {
32
32
  /**
33
33
  * Decides by the sign if it's a padding or a margin
34
34
  */
35
- offset(dist: number): Pair | Ring | Polygon | MultiPolygon;
35
+ offset(dist: number): MultiPolygon | Polygon | Ring | Pair;
36
36
  private offsetSegment;
37
37
  private margin;
38
38
  private padding;
39
- offsetLine(dist: number): Pair | Ring | Polygon | MultiPolygon;
39
+ offsetLine(dist: number): MultiPolygon | Polygon | Ring | Pair;
40
40
  /**
41
41
  * Just offsets lines, no fill
42
42
  */
@@ -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
  /**
@@ -445,7 +445,7 @@ export declare class MergeUtils {
445
445
  *
446
446
  * @returns 是否可以合并 - true表示两个对象兼容,可以合并
447
447
  */
448
- static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): any;
448
+ static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): boolean | undefined;
449
449
  /**
450
450
  * 检查网格是否为合并后的对象
451
451
  *
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 判断是否为utf-8
3
+ */
4
+ export declare function isUTF8(bytes: Uint8Array): boolean;