rm-build-dxf 0.1.261 → 0.1.263
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/package.json +1 -1
- package/src/EventInput.js +1 -1
- package/src/build.js +1 -1
- package/src/components/NumberEditor.vue.d.ts +1 -1
- package/src/dxf-system/build.d.ts +11 -0
- package/src/dxf-system/plugins/editor/Command/ClippingLine.d.ts +1 -0
- package/src/dxf-system/plugins/editor/Command/Command.d.ts +1 -0
- package/src/dxf-system/plugins/editor/Command/DefaultCommand/SelectRender.d.ts +8 -5
- package/src/dxf-system/plugins/editor/Command/DrawBezierCurveLine.d.ts +48 -0
- package/src/dxf-system/plugins/editor/Command/DrawByWindow.d.ts +1 -0
- package/src/dxf-system/plugins/editor/Command/DrawDoorLine.d.ts +1 -0
- package/src/dxf-system/plugins/editor/Command/DrawHole.d.ts +12 -1
- package/src/dxf-system/plugins/editor/Command/DrawWindow.d.ts +1 -0
- package/src/dxf-system/plugins/editor/Command/Preview.d.ts +1 -1
- package/src/dxf-system/plugins/editor/Command/Sever.d.ts +8 -0
- package/src/dxf-system/plugins/editor/DrawingManager.d.ts +6 -6
- package/src/dxf-system/plugins/editor/pages/{ContextualToolbar.vue.d.ts → ContextualToolbar/ContextualToolbar.vue.d.ts} +4 -2
- package/src/dxf-system/plugins/editor/pages/components/PropertySelectPopup.vue.d.ts +3 -3
- package/src/dxf-system/plugins/editor/ui-service/DragControlPoint.d.ts +6 -2
- package/src/dxf-system/plugins/editor/ui-service/LineSelector.d.ts +2 -2
- package/src/dxf-system/plugins/editor/ui-service/PointerFollowMove.d.ts +4 -4
- package/src/dxf-system/plugins/editor/ui-service/SnapController.d.ts +22 -4
- package/src/dxf-system/plugins/editor/utils/CombQueryTool.d.ts +74 -0
- package/src/dxf-system/plugins/editor/utils/ContextualToolbarObject3D.d.ts +574 -26
- package/src/dxf-system/plugins/editor/utils/LineShape.d.ts +8 -0
- package/src/dxf-system/plugins/editor/utils/Wall2D.d.ts +2 -1
- package/src/dxf-system/type.d.ts +13 -1
- package/src/dxf-system/utils/BezierCurveKernel.d.ts +136 -0
- package/src/dxf-system/utils/DimensionLine.d.ts +1 -0
- package/src/dxf-system/utils/WallGroupManager.d.ts +2 -2
- package/src/dxf-system/utils/WallHole.d.ts +11 -10
- package/src/dxf-system/utils/cad/DxfDataPlugin.d.ts +16 -0
- package/src/dxf-system/utils/line-pipeline/builtin/double-wall-alignment.d.ts +1 -1
- package/src/dxf-system/utils/line-pipeline/builtin/split-collinear-walls-and-beams.d.ts +1 -1
- package/src/dxf-system/utils/tools.d.ts +1 -0
- package/src/i18n/locales/en.d.ts +4 -0
- package/src/i18n/locales/zh-CN.d.ts +4 -0
- package/src/i18n/locales/zh-TW.d.ts +4 -0
- package/src/index.css +1 -1
- package/src/index.js +1 -1
- package/src/index3.js +1 -1
- package/src/utils/algorithms/Box2.d.ts +9 -2
- package/src/utils/algorithms/LineSegment.d.ts +7 -1
- package/src/utils/algorithms/LineSegmentSpatialHash.d.ts +4 -2
- package/src/utils/algorithms/LineSegmentUtils.d.ts +2 -0
- package/src/utils/algorithms/Map.d.ts +1 -1
- package/src/utils/algorithms/Point.d.ts +4 -0
- package/src/utils/algorithms/Polygon.d.ts +4 -0
- package/src/utils/algorithms/cubicBezierCurve.d.ts +25 -0
- package/src/utils/three-object-3d/LineAlignmentGuide.d.ts +1 -0
- package/src/utils/three-object-3d/Lines.d.ts +2 -0
- package/src/utils/three-object-3d/Vector3Pool.d.ts +16 -0
- package/src/utils/tools/Heartbeat.d.ts +25 -0
|
@@ -20,8 +20,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
20
20
|
onMin?: ((...args: any[]) => any) | undefined;
|
|
21
21
|
onMax?: ((...args: any[]) => any) | undefined;
|
|
22
22
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
23
|
-
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
24
23
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
24
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
showCancel: boolean;
|
|
27
27
|
showMax: boolean;
|
|
@@ -100,6 +100,17 @@ export declare function getFileAll(groundBuildMode?: GroundBuildMode, dxfSystem?
|
|
|
100
100
|
* @returns
|
|
101
101
|
*/
|
|
102
102
|
export declare function getGlobalDxfSystem(): DxfSystem | null;
|
|
103
|
+
/** 获取全局DxfSystem
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
export declare function openGlobalDxfSystemPreview(opt: {
|
|
107
|
+
perspectiveCamera?: THREE.PerspectiveCamera;
|
|
108
|
+
callBackFun?: () => void;
|
|
109
|
+
}): Promise<void>;
|
|
110
|
+
/** 获取全局DxfSystem
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
export declare function exitGlobalDxfSystemPreview(): Promise<void>;
|
|
103
114
|
/** 检测原始数据线段一侧是否属于环
|
|
104
115
|
* @param lineData
|
|
105
116
|
* @param startIndex
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { BufferGeometry, Group,
|
|
1
|
+
import { BufferGeometry, Group, Mesh, MeshBasicMaterial } from 'three';
|
|
2
2
|
import { SelectEntity } from './type';
|
|
3
|
+
import { BezierCurveKernel } from '../../../../utils/BezierCurveKernel';
|
|
3
4
|
export declare class SelectRender {
|
|
5
|
+
bezierCurveLineHelper: BezierCurveKernel;
|
|
4
6
|
container: Group<import('three').Object3DEventMap>;
|
|
5
7
|
private _timer;
|
|
6
|
-
wall3D: Mesh<BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
wall3D: Mesh<BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, MeshBasicMaterial, import('three').Object3DEventMap>;
|
|
9
|
+
cubicBezierWall3D: Mesh<BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, MeshBasicMaterial, import('three').Object3DEventMap>;
|
|
10
|
+
hole3D: Mesh<BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, MeshBasicMaterial, import('three').Object3DEventMap>;
|
|
11
|
+
pillar3D: Mesh<BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, MeshBasicMaterial, import('three').Object3DEventMap>;
|
|
12
|
+
constructor(bezierCurveLineHelper?: BezierCurveKernel);
|
|
10
13
|
private compute;
|
|
11
14
|
render(selects: SelectEntity[], delay?: boolean): void;
|
|
12
15
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Point } from '../../../../utils/algorithms/Point';
|
|
2
|
+
import { LineSegment } from '../../../../utils/algorithms/LineSegment';
|
|
3
|
+
import { Command } from './Command.tsx';
|
|
4
|
+
import { ComponentContainer } from '../../../../utils/ecs';
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
export declare class DrawBezierCurveLine extends Command<{
|
|
7
|
+
pointerMove: {
|
|
8
|
+
point: THREE.Vector3;
|
|
9
|
+
};
|
|
10
|
+
appendLine: {
|
|
11
|
+
points: THREE.Vector3[];
|
|
12
|
+
};
|
|
13
|
+
}> {
|
|
14
|
+
static name: string;
|
|
15
|
+
container: THREE.Group<THREE.Object3DEventMap>;
|
|
16
|
+
withdrawalKeys: string[];
|
|
17
|
+
static shortcutKeys: string[];
|
|
18
|
+
static commandName: string;
|
|
19
|
+
minCount: number;
|
|
20
|
+
onAddFromParent(parent: ComponentContainer): void;
|
|
21
|
+
/**
|
|
22
|
+
* 移动端需要选择一个点, 用来创建拖拽点
|
|
23
|
+
*/
|
|
24
|
+
selectFirstPoint(next: any): Promise<void>;
|
|
25
|
+
cubicBezierCurve(next: any, point?: Point): Promise<void>;
|
|
26
|
+
/** 创建
|
|
27
|
+
* @param onClick
|
|
28
|
+
*/
|
|
29
|
+
drawLine(next: any, point?: Point): Promise<void>;
|
|
30
|
+
/** 结束, 汇总结果
|
|
31
|
+
* @param points
|
|
32
|
+
*/
|
|
33
|
+
protected end(next: any, { points }: {
|
|
34
|
+
points: Point[];
|
|
35
|
+
}): void;
|
|
36
|
+
/** 执行完成
|
|
37
|
+
*/
|
|
38
|
+
protected onCompleted(lines: LineSegment[]): void;
|
|
39
|
+
/** 回滚操作
|
|
40
|
+
* @param data
|
|
41
|
+
*/
|
|
42
|
+
protected onRollback(lines: LineSegment[]): LineSegment<Record<string, any>, any>[];
|
|
43
|
+
/** 撤回回滚
|
|
44
|
+
* @param lines
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
protected onRevokeRollback(lines: LineSegment[]): LineSegment<Record<string, any>, any>[];
|
|
48
|
+
}
|
|
@@ -32,6 +32,7 @@ export declare class DrawHole extends Command<{
|
|
|
32
32
|
showEditWidth: boolean;
|
|
33
33
|
showEditHeight: boolean;
|
|
34
34
|
showEditGroundClearance: boolean;
|
|
35
|
+
cubicBezier: boolean;
|
|
35
36
|
showConfirm: import('vue').Ref<boolean, boolean>;
|
|
36
37
|
onAddFromParent(parent: ComponentContainer): void;
|
|
37
38
|
editWidth(): Promise<void>;
|
|
@@ -41,12 +42,22 @@ export declare class DrawHole extends Command<{
|
|
|
41
42
|
* 移动端需要选择一个点, 用来创建拖拽点
|
|
42
43
|
*/
|
|
43
44
|
selectFirstPoint(next: any): Promise<void>;
|
|
45
|
+
/** 更新墙壁信息
|
|
46
|
+
* @param wall
|
|
47
|
+
*/
|
|
48
|
+
private updateWall;
|
|
49
|
+
/** 更新状态
|
|
50
|
+
* @param param0
|
|
51
|
+
*/
|
|
44
52
|
private updateState;
|
|
53
|
+
/** 注册尺寸变化处理
|
|
54
|
+
* @param param0
|
|
55
|
+
*/
|
|
45
56
|
private registerSizeModifier;
|
|
46
57
|
/** 选择开始点
|
|
47
58
|
* @param next
|
|
48
59
|
*/
|
|
49
|
-
|
|
60
|
+
draw(next: any, point?: Point): Promise<void>;
|
|
50
61
|
/** 结束处理
|
|
51
62
|
* @param next
|
|
52
63
|
* @param data
|
|
@@ -26,7 +26,7 @@ export declare class Preview extends Command<{
|
|
|
26
26
|
/** 开启预览
|
|
27
27
|
* @param perspectiveCamera
|
|
28
28
|
*/
|
|
29
|
-
preview(perspectiveCamera
|
|
29
|
+
preview(perspectiveCamera?: THREE.PerspectiveCamera): Promise<void>;
|
|
30
30
|
/** 开始
|
|
31
31
|
* @param next
|
|
32
32
|
* @param opt
|
|
@@ -9,11 +9,19 @@ export type SeverData = {
|
|
|
9
9
|
target: LineSegment<LineUserData>;
|
|
10
10
|
position: Point;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* 裁断
|
|
14
|
+
*/
|
|
12
15
|
export declare class Sever extends Command<{}> {
|
|
13
16
|
static name: string;
|
|
14
17
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
15
18
|
static commandName: string;
|
|
16
19
|
onAddFromParent(parent: ComponentContainer): void;
|
|
20
|
+
severCubicBezierWall(line: LineSegment<LineUserData>, point: Point): void | {
|
|
21
|
+
type: string;
|
|
22
|
+
newLines: LineSegment<LineUserData, any>[];
|
|
23
|
+
target: LineSegment<LineUserData, any>;
|
|
24
|
+
};
|
|
17
25
|
severWall(line: LineSegment, point: Point): {
|
|
18
26
|
type: string;
|
|
19
27
|
newLines: LineSegment<Record<string, any>, any>[];
|
|
@@ -2,12 +2,12 @@ import { LineSegment } from '../../../utils/algorithms/LineSegment';
|
|
|
2
2
|
import { Component } from '../../../utils/ecs';
|
|
3
3
|
import { Variable } from '../../components/Variable';
|
|
4
4
|
import { EventInput, Renderer } from '../renderer/components';
|
|
5
|
-
import { PointSpatialHash } from '../../../utils/algorithms/PointSpatialHash';
|
|
6
5
|
import { EditorView } from './EditorView';
|
|
7
|
-
import { Quadtree } from '../../../utils/algorithms/Quadtree';
|
|
8
6
|
import { DxfLineModel } from '../model3d/components';
|
|
9
7
|
import { LineUserData, OriginalDataItem } from '../../type';
|
|
10
8
|
import { Dxf } from '../../components/Dxf';
|
|
9
|
+
import { CombQueryTool } from './utils/CombQueryTool';
|
|
10
|
+
import { BezierCurveKernel } from '../../utils/BezierCurveKernel';
|
|
11
11
|
import * as THREE from "three";
|
|
12
12
|
export type AdsorptionResult = {
|
|
13
13
|
point: THREE.Vector3;
|
|
@@ -29,9 +29,9 @@ export declare class DrawingManager extends Component<{
|
|
|
29
29
|
static name: string;
|
|
30
30
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
31
31
|
lines: LineSegment<LineUserData>[];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
combQueryTool: CombQueryTool;
|
|
33
|
+
bezierCurveLineHelper: BezierCurveKernel;
|
|
34
|
+
constructor();
|
|
35
35
|
onAddFromParent(): void;
|
|
36
36
|
private updatedMode;
|
|
37
37
|
/** 重新设置数据
|
|
@@ -53,7 +53,7 @@ export declare class DrawingManager extends Component<{
|
|
|
53
53
|
/** 移除线段
|
|
54
54
|
* @param line
|
|
55
55
|
*/
|
|
56
|
-
removeLine(line: LineSegment<LineUserData>, needdraw?: boolean, event?: boolean): void;
|
|
56
|
+
removeLine(line: LineSegment<LineUserData>, needdraw?: boolean, event?: boolean, updateBox2?: boolean): void;
|
|
57
57
|
/**
|
|
58
58
|
* 删除
|
|
59
59
|
* @param lines
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { SelectEntity } from '
|
|
3
|
-
import { CopyData } from '
|
|
2
|
+
import { SelectEntity } from '../../Command/DefaultCommand/type.ts';
|
|
3
|
+
import { CopyData } from '../../utils/ContextualToolbarObject3D.ts';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
entity: Ref<SelectEntity>;
|
|
6
6
|
copyData: Ref<CopyData>;
|
|
7
7
|
};
|
|
8
8
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
9
|
copy: (...args: any[]) => void;
|
|
10
|
+
cubicBezier: (...args: any[]) => void;
|
|
10
11
|
change: (...args: any[]) => void;
|
|
11
12
|
paste: (...args: any[]) => void;
|
|
12
13
|
delete: (...args: any[]) => void;
|
|
@@ -17,6 +18,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
17
18
|
reverseDirection: (...args: any[]) => void;
|
|
18
19
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
20
|
onCopy?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
onCubicBezier?: ((...args: any[]) => any) | undefined;
|
|
20
22
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
21
23
|
onPaste?: ((...args: any[]) => any) | undefined;
|
|
22
24
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
@@ -7,10 +7,10 @@ declare const _default: <T = string>(__VLS_props: NonNullable<Awaited<typeof __V
|
|
|
7
7
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
8
8
|
readonly onCancel?: (() => any) | undefined;
|
|
9
9
|
readonly onChange?: ((value: T | T[]) => any) | undefined;
|
|
10
|
-
readonly onConfirm?: ((value: T | T[]) => any) | undefined;
|
|
11
10
|
readonly "onUpdate:modelValue"?: ((value: T | T[]) => any) | undefined;
|
|
11
|
+
readonly onConfirm?: ((value: T | T[]) => any) | undefined;
|
|
12
12
|
readonly "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
13
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChange" | "
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue" | "onConfirm" | "onCancel" | "onUpdate:visible"> & {
|
|
14
14
|
visible: boolean;
|
|
15
15
|
options: PropertyOption<T>[];
|
|
16
16
|
modelValue?: T | T[];
|
|
@@ -23,7 +23,7 @@ declare const _default: <T = string>(__VLS_props: NonNullable<Awaited<typeof __V
|
|
|
23
23
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: {};
|
|
26
|
-
emit: ((evt: "cancel") => void) & ((evt: "change", value: T | T[]) => void) & ((evt: "
|
|
26
|
+
emit: ((evt: "cancel") => void) & ((evt: "change", value: T | T[]) => void) & ((evt: "update:modelValue", value: T | T[]) => void) & ((evt: "confirm", value: T | T[]) => void) & ((evt: "update:visible", visible: boolean) => void);
|
|
27
27
|
}>) => import('vue').VNode & {
|
|
28
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
29
|
};
|
|
@@ -6,7 +6,9 @@ import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
|
|
|
6
6
|
type Option = {
|
|
7
7
|
auxiliaryLine?: boolean;
|
|
8
8
|
style?: Properties;
|
|
9
|
+
activeStyle?: Properties;
|
|
9
10
|
size?: number;
|
|
11
|
+
cross?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export declare class DragControlPoint {
|
|
12
14
|
editor: EditorView;
|
|
@@ -23,6 +25,10 @@ export declare class DragControlPoint {
|
|
|
23
25
|
onContextmenu?: (e: PointerEvent) => void;
|
|
24
26
|
private point;
|
|
25
27
|
opt: Option;
|
|
28
|
+
activeStyle: Properties;
|
|
29
|
+
idleStyle: Properties;
|
|
30
|
+
get visible(): boolean;
|
|
31
|
+
set visible(b: boolean);
|
|
26
32
|
constructor(point: Point, editor: EditorView, opt?: Option);
|
|
27
33
|
object3D?: CSS2DObject;
|
|
28
34
|
/**
|
|
@@ -38,8 +44,6 @@ export declare class DragControlPoint {
|
|
|
38
44
|
*/
|
|
39
45
|
createView(): {
|
|
40
46
|
object3D: CSS2DObject;
|
|
41
|
-
defaultWidth: string;
|
|
42
|
-
background: string;
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* 销毁, 注销所有事件监听,标记为已结束,释放资源
|
|
@@ -2,7 +2,7 @@ import { LineSegment } from '../../../../utils/algorithms/LineSegment';
|
|
|
2
2
|
import { EditorView } from '../EditorView';
|
|
3
3
|
import { Point } from '../../../../utils/algorithms/Point';
|
|
4
4
|
import { PointerFollowMove, MobileTrigger } from './PointerFollowMove';
|
|
5
|
-
import {
|
|
5
|
+
import { SnapControllerQuadtreeType } from './SnapController';
|
|
6
6
|
/**
|
|
7
7
|
* 线段选择器
|
|
8
8
|
* 通过鼠标吸附交互,让用户从场景中选取一条符合类型要求的线段(墙线、洞口、门窗等)
|
|
@@ -17,7 +17,7 @@ export declare class LineSelector extends PointerFollowMove {
|
|
|
17
17
|
* @param mobileTrigger 移动端触发方式
|
|
18
18
|
* @param quadtree
|
|
19
19
|
*/
|
|
20
|
-
constructor(editor: EditorView, point?: Point | null, mobileTrigger?: MobileTrigger, quadtree?:
|
|
20
|
+
constructor(editor: EditorView, point?: Point | null, mobileTrigger?: MobileTrigger, quadtree?: SnapControllerQuadtreeType);
|
|
21
21
|
setEmptySpace(_: boolean): this;
|
|
22
22
|
/**
|
|
23
23
|
* 异步获取一条符合当前类型筛选的线段
|
|
@@ -2,8 +2,7 @@ import { LineSegment } from '../../../../utils/algorithms/LineSegment';
|
|
|
2
2
|
import { EditorView } from '../EditorView';
|
|
3
3
|
import { Point } from '../../../../utils/algorithms/Point';
|
|
4
4
|
import { DragControlPoint } from './DragControlPoint';
|
|
5
|
-
import { SnapController } from './SnapController';
|
|
6
|
-
import { Quadtree } from '../../../../utils';
|
|
5
|
+
import { SnapController, SnapControllerQuadtreeType } from './SnapController';
|
|
7
6
|
/** 吸附线段类型:全部 / 墙体 / 洞口 / 通道入口 / 门 / 窗 */
|
|
8
7
|
export type LineType = ("wall" | "balconyRailing" | "hole" | "passageEntrance" | "door" | "window")[] | "all" | "none";
|
|
9
8
|
export type MobileTrigger = "dragControlPoint" | "pointerdown";
|
|
@@ -14,6 +13,7 @@ export declare class PointerFollowMove {
|
|
|
14
13
|
snapController: SnapController;
|
|
15
14
|
protected editor: EditorView;
|
|
16
15
|
protected currentSelectLine: LineSegment | null;
|
|
16
|
+
protected currentSelectDirction: Point | null;
|
|
17
17
|
protected pos: Point | null;
|
|
18
18
|
private snapType;
|
|
19
19
|
private snapRadius;
|
|
@@ -26,10 +26,10 @@ export declare class PointerFollowMove {
|
|
|
26
26
|
/** 是否暂停 */
|
|
27
27
|
get paused(): boolean;
|
|
28
28
|
/** 鼠标移动时的回调,参数为当前吸附到的线段(可能为 null)以及完整的吸附结果 */
|
|
29
|
-
onPointerMove?: (point: Point | null, line: LineSegment | null) => void;
|
|
29
|
+
onPointerMove?: (point: Point | null, line: LineSegment | null, direction?: Point | null) => void;
|
|
30
30
|
onMobileStart?: (point: Point) => void;
|
|
31
31
|
onMobileEnd?: (point: Point) => void;
|
|
32
|
-
constructor(editor: EditorView, point?: Point | null, mobileTrigger?: MobileTrigger, quadtree?:
|
|
32
|
+
constructor(editor: EditorView, point?: Point | null, mobileTrigger?: MobileTrigger, quadtree?: SnapControllerQuadtreeType);
|
|
33
33
|
dragControlPoint?: DragControlPoint;
|
|
34
34
|
/**
|
|
35
35
|
* 初始化:监听编辑器的鼠标位置变化事件
|
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
import { LineSegment, Point, Quadtree } from '../../../../utils';
|
|
2
2
|
import { EditorView } from '../EditorView';
|
|
3
|
+
import { CombQueryTool } from '../utils/CombQueryTool';
|
|
4
|
+
import { LineSegmentSpatialHash } from '../../../../utils/algorithms/LineSegmentSpatialHash';
|
|
3
5
|
export type SnapResult = {
|
|
4
6
|
point: Point;
|
|
5
7
|
find: boolean;
|
|
6
8
|
mode: string;
|
|
7
9
|
line: LineSegment<Record<string, any>>;
|
|
10
|
+
direction: Point;
|
|
8
11
|
} | {
|
|
9
12
|
point: Point;
|
|
10
13
|
find: boolean;
|
|
11
14
|
line: undefined;
|
|
12
15
|
mode: undefined;
|
|
16
|
+
direction: undefined;
|
|
13
17
|
};
|
|
18
|
+
export type SnapControllerQuadtreeType = LineSegment[] | LineSegmentSpatialHash | Quadtree | CombQueryTool;
|
|
14
19
|
/**
|
|
15
20
|
* 实现吸附类
|
|
16
21
|
*/
|
|
17
22
|
export declare class SnapController {
|
|
18
23
|
editor: EditorView;
|
|
19
|
-
quadtree: Quadtree;
|
|
24
|
+
quadtree: Quadtree | LineSegmentSpatialHash | CombQueryTool;
|
|
20
25
|
radius: number;
|
|
21
|
-
outQuadtree
|
|
22
|
-
constructor(editor: EditorView,
|
|
23
|
-
addLine(line: LineSegment):
|
|
26
|
+
private outQuadtree;
|
|
27
|
+
constructor(editor: EditorView, quadtree: SnapControllerQuadtreeType, radius?: number);
|
|
28
|
+
addLine(line: LineSegment): false | undefined;
|
|
24
29
|
removeLine(line: LineSegment): void;
|
|
30
|
+
queryLineByPoint(point: Point, radius: number): {
|
|
31
|
+
target: LineSegment;
|
|
32
|
+
belonging: LineSegment<import('../../../type').LineUserData>;
|
|
33
|
+
}[] | {
|
|
34
|
+
target: LineSegment<Record<string, any>, any>;
|
|
35
|
+
belonging: LineSegment<Record<string, any>, any>;
|
|
36
|
+
}[];
|
|
37
|
+
queryResult: {
|
|
38
|
+
point: Point;
|
|
39
|
+
line: LineSegment | LineSegment;
|
|
40
|
+
targetLine: LineSegment;
|
|
41
|
+
direction: Point;
|
|
42
|
+
}[];
|
|
25
43
|
snap(point: Point, radius?: number): SnapResult;
|
|
26
44
|
/**
|
|
27
45
|
* 释放资源
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LineUserData } from '../../../type';
|
|
2
|
+
import { Box2, LineSegment, Point, PointSpatialHash } from '../../../../utils';
|
|
3
|
+
import { LineSegmentSpatialHash } from '../../../../utils/algorithms/LineSegmentSpatialHash';
|
|
4
|
+
import { BezierCurveKernel } from '../../../utils/BezierCurveKernel';
|
|
5
|
+
export type LineQuadtree = {
|
|
6
|
+
box2: Box2;
|
|
7
|
+
quadtree: LineSegmentSpatialHash;
|
|
8
|
+
belonging?: LineSegment<LineUserData> | Set<LineSegment<LineUserData>>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 组合查询器
|
|
12
|
+
*
|
|
13
|
+
* 普通线段共用一个空间哈希结构,贝塞尔曲线单独建立空间哈希结构,
|
|
14
|
+
* 同时维护端点的空间哈希,用于点查询。
|
|
15
|
+
*/
|
|
16
|
+
export declare class CombQueryTool {
|
|
17
|
+
bezierCurveLineHelper: BezierCurveKernel;
|
|
18
|
+
lineQuadtreeMap: Map<string | LineSegment, LineQuadtree>;
|
|
19
|
+
pointQuadtree: PointSpatialHash;
|
|
20
|
+
constructor(bezierCurveLineHelper?: BezierCurveKernel);
|
|
21
|
+
/**
|
|
22
|
+
* 将贝塞尔曲线离散为线段,并建立独立的空间哈希结构。
|
|
23
|
+
*/
|
|
24
|
+
private addCubicBezierLine;
|
|
25
|
+
/**
|
|
26
|
+
* 插入线段。
|
|
27
|
+
* 贝塞尔曲线单独索引,普通线段共用索引。
|
|
28
|
+
*/
|
|
29
|
+
insert(line: LineSegment<LineUserData>): void;
|
|
30
|
+
/** 批量插入线段。 */
|
|
31
|
+
inserts(lines: LineSegment<LineUserData>[]): void;
|
|
32
|
+
/**
|
|
33
|
+
* 移除线段。
|
|
34
|
+
* updateBox2 为 true 时,重新计算普通线段索引的包围盒。
|
|
35
|
+
*/
|
|
36
|
+
remove(line: LineSegment<LineUserData>, updateBox2?: boolean): void;
|
|
37
|
+
/** 批量移除线段,仅在最后一次移除时重新计算包围盒。 */
|
|
38
|
+
removes(lines: LineSegment<LineUserData>[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* 更新线段的空间索引。
|
|
41
|
+
* updateBox2 为 true 时,重新计算普通线段索引的包围盒。
|
|
42
|
+
*/
|
|
43
|
+
update(line: LineSegment<LineUserData>, updateBox2?: boolean): void;
|
|
44
|
+
/** 批量更新线段,仅在最后一次更新时重新计算包围盒。 */
|
|
45
|
+
updates(lines: LineSegment<LineUserData>[]): void;
|
|
46
|
+
/** 清空所有线段索引和端点索引。 */
|
|
47
|
+
clear(): void;
|
|
48
|
+
/**
|
|
49
|
+
* 查询指定位置附近的线段。
|
|
50
|
+
* target 为实际参与空间查询的线段,belonging 为所属原始线段。
|
|
51
|
+
*/
|
|
52
|
+
queryLineByPoint(pos: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
}, radius?: number): {
|
|
56
|
+
target: LineSegment;
|
|
57
|
+
belonging: LineSegment<LineUserData>;
|
|
58
|
+
}[];
|
|
59
|
+
/** 查询指定位置附近的端点,可通过 radius 指定圆形查询范围。 */
|
|
60
|
+
private _point;
|
|
61
|
+
queryPointByPoint(pos: Point | {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}, radius?: number): import('../../../../utils').ResultList<Record<string, any>>;
|
|
65
|
+
/** 查询包围盒范围内的线段,并返回其所属的原始线段。 */
|
|
66
|
+
queryLineByBox(box: Box2): LineSegment<LineUserData, any>[];
|
|
67
|
+
/** 查询与指定线段相交范围内的线段,保留实际线段与所属原始线段的对应关系。 */
|
|
68
|
+
queryLineByLine(line: LineSegment): {
|
|
69
|
+
target: LineSegment;
|
|
70
|
+
belonging: LineSegment<LineUserData>;
|
|
71
|
+
}[];
|
|
72
|
+
/** 根据线段数组创建组合查询器并完成初始化。 */
|
|
73
|
+
static from(lines: LineSegment[]): CombQueryTool;
|
|
74
|
+
}
|