build-dxf 0.0.19 → 0.0.20-1
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/README.md +30 -0
- package/package.json +1 -3
- package/src/build.d.ts +23 -1
- package/src/build.js +74 -29
- package/src/index.css +625 -1
- package/src/index.js +4 -2
- package/src/index2.js +7 -3667
- package/src/index3.js +748 -288
- package/src/pages/Editor.vue.d.ts +3 -1
- package/src/selectLocalFile.js +443 -21
- package/src/utils/ComponentManager/Component.d.ts +1 -0
- package/src/utils/ComponentManager/ComponentManager.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +9 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +7 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +7 -0
- package/src/utils/DxfSystem/plugin/Editor/index.d.ts +8 -1
- package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +5 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +28 -6
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts +2 -1
- package/src/utils/Quadtree/LineSegment.d.ts +1 -1
- package/src/components/Editor.vue.d.ts +0 -26
- package/src/pages/Editor02.vue.d.ts +0 -4
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
dom: HTMLDivElement;
|
|
3
|
+
}, HTMLDivElement>;
|
|
2
4
|
export default _default;
|
package/src/selectLocalFile.js
CHANGED
|
@@ -1,5 +1,205 @@
|
|
|
1
|
-
import { getCurrentInstance, inject, ref, computed, unref, shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, onMounted, nextTick, isRef, warn, provide, defineComponent, createElementBlock, openBlock, mergeProps, renderSlot, createElementVNode, watch, toRef, onUnmounted, useSlots, Text, createBlock, resolveDynamicComponent, withCtx, createCommentVNode, Fragment, normalizeClass, reactive, toRaw, withDirectives, withModifiers, vModelCheckbox, createTextVNode, toDisplayString, normalizeStyle, toRefs } from "vue";
|
|
2
1
|
import * as THREE from "three";
|
|
2
|
+
import { Vector2 } from "three";
|
|
3
|
+
import { CSS3DObject, CSS3DSprite, CSS3DRenderer } from "three/addons/renderers/CSS3DRenderer.js";
|
|
4
|
+
import { CSS2DObject, CSS2DRenderer } from "three/addons/renderers/CSS2DRenderer.js";
|
|
5
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
6
|
+
import * as TWEEN from "@tweenjs/tween.js";
|
|
7
|
+
import { C as Component, P as Point, V as Variable } from "./build.js";
|
|
8
|
+
import { getCurrentInstance, inject, ref, computed, unref, shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, onMounted, nextTick, isRef, warn, provide, defineComponent, createElementBlock, openBlock, mergeProps, renderSlot, createElementVNode, watch, toRef, onUnmounted, useSlots, Text, createBlock, resolveDynamicComponent, withCtx, createCommentVNode, Fragment, normalizeClass, reactive, toRaw, withDirectives, withModifiers, vModelCheckbox, createTextVNode, toDisplayString, normalizeStyle, toRefs } from "vue";
|
|
9
|
+
THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
|
|
10
|
+
class Renderer extends Component {
|
|
11
|
+
static name = "Renderer";
|
|
12
|
+
static CSS2DObject = CSS2DObject;
|
|
13
|
+
static CSS3DObject = CSS3DObject;
|
|
14
|
+
static CSS3DSprite = CSS3DSprite;
|
|
15
|
+
static Group = THREE.Group;
|
|
16
|
+
static Object3D = THREE.Object3D;
|
|
17
|
+
static Mesh = THREE.Mesh;
|
|
18
|
+
static Line = THREE.Line;
|
|
19
|
+
static LineSegments = THREE.LineSegments;
|
|
20
|
+
static Points = THREE.Points;
|
|
21
|
+
scene;
|
|
22
|
+
camera;
|
|
23
|
+
renderer;
|
|
24
|
+
orbitControls;
|
|
25
|
+
resizeObserver;
|
|
26
|
+
description;
|
|
27
|
+
html2DRenderer;
|
|
28
|
+
html3DRenderer;
|
|
29
|
+
container = new THREE.Group();
|
|
30
|
+
onUpdate;
|
|
31
|
+
onResize;
|
|
32
|
+
tweenTaskList = [];
|
|
33
|
+
constructor(description) {
|
|
34
|
+
super();
|
|
35
|
+
this.description = description;
|
|
36
|
+
const {
|
|
37
|
+
scene = new THREE.Scene(),
|
|
38
|
+
camera = new THREE.PerspectiveCamera(45, 1, 0.01, 1e3)
|
|
39
|
+
} = description;
|
|
40
|
+
this.camera = camera;
|
|
41
|
+
this.scene = scene;
|
|
42
|
+
scene.add(this.container);
|
|
43
|
+
this.renderer = new THREE.WebGLRenderer({
|
|
44
|
+
canvas: this.description.canvas,
|
|
45
|
+
antialias: true
|
|
46
|
+
});
|
|
47
|
+
this.renderer.setPixelRatio(window.devicePixelRatio);
|
|
48
|
+
if (description.htmlRenderer) {
|
|
49
|
+
if (description.htmlRenderer["2d"]) {
|
|
50
|
+
this.html2DRenderer = new CSS2DRenderer();
|
|
51
|
+
Object.assign(this.html2DRenderer.domElement.style, { position: "absolute", left: "0px", top: "0px" });
|
|
52
|
+
description.htmlRenderer["2d"].appendChild(this.html2DRenderer.domElement);
|
|
53
|
+
}
|
|
54
|
+
if (description.htmlRenderer["3d"]) {
|
|
55
|
+
this.html3DRenderer = new CSS3DRenderer();
|
|
56
|
+
Object.assign(this.html3DRenderer.domElement.style, { position: "absolute", left: "0px", top: "0px" });
|
|
57
|
+
description.htmlRenderer["3d"].appendChild(this.html3DRenderer.domElement);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (description.orbitControls) {
|
|
61
|
+
this.orbitControls = new OrbitControls(this.camera, description.orbitControls.domElement);
|
|
62
|
+
Object.assign(this.orbitControls, description.orbitControls);
|
|
63
|
+
}
|
|
64
|
+
if (this.description.resizeObserver) {
|
|
65
|
+
const dom = this.description.resizeObserver;
|
|
66
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
67
|
+
const camera2 = this.camera;
|
|
68
|
+
const { width, height } = dom.getBoundingClientRect();
|
|
69
|
+
this.renderer.setSize(width, height);
|
|
70
|
+
if (this.html2DRenderer) this.html2DRenderer.setSize(width, height);
|
|
71
|
+
if (this.html3DRenderer) this.html3DRenderer.setSize(width, height);
|
|
72
|
+
if (camera2 instanceof THREE.PerspectiveCamera) {
|
|
73
|
+
camera2.aspect = width / height;
|
|
74
|
+
} else if (camera2 instanceof THREE.OrthographicCamera) {
|
|
75
|
+
camera2.left = -width * 0.5;
|
|
76
|
+
camera2.right = width * 0.5;
|
|
77
|
+
camera2.top = height * 0.5;
|
|
78
|
+
camera2.bottom = -height * 0.5;
|
|
79
|
+
}
|
|
80
|
+
camera2.updateProjectionMatrix();
|
|
81
|
+
this.onResize && this.onResize(width, height);
|
|
82
|
+
this.dispatchEvent({ type: "resize", width, height });
|
|
83
|
+
});
|
|
84
|
+
this.resizeObserver.observe(dom);
|
|
85
|
+
}
|
|
86
|
+
this.renderer.setAnimationLoop(() => {
|
|
87
|
+
if (this.html2DRenderer) this.html2DRenderer.render(this.scene, this.camera);
|
|
88
|
+
if (this.html3DRenderer) this.html3DRenderer.render(this.scene, this.camera);
|
|
89
|
+
this.renderer.render(this.scene, this.camera);
|
|
90
|
+
if (this.orbitControls && this.orbitControls.enabled) this.orbitControls.update();
|
|
91
|
+
this.tweenTaskList.forEach((tween) => tween.update());
|
|
92
|
+
this.onUpdate && this.onUpdate();
|
|
93
|
+
this.parent?.components.forEach((c) => c.dispatchEvent({ type: "update" }));
|
|
94
|
+
});
|
|
95
|
+
this.scene.add(new THREE.AmbientLight(16777215, 0.5));
|
|
96
|
+
this.scene.background = new THREE.Color(3355443);
|
|
97
|
+
const directLight = new THREE.DirectionalLight(16777215, 4);
|
|
98
|
+
directLight.position.set(100, -100, 100);
|
|
99
|
+
this.scene.add(directLight);
|
|
100
|
+
camera.position.set(10, 10, 10);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 世界坐标转屏幕坐标
|
|
104
|
+
* @param worldPosition
|
|
105
|
+
* @param camera
|
|
106
|
+
* @param renderer
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
worldToScreenPosition(worldPosition) {
|
|
110
|
+
const vector = new THREE.Vector3();
|
|
111
|
+
vector.copy(worldPosition);
|
|
112
|
+
vector.project(this.camera);
|
|
113
|
+
const x = (vector.x * 0.5 + 0.5) * this.renderer.domElement.clientWidth;
|
|
114
|
+
const z = (-vector.z * 0.5 + 0.5) * this.renderer.domElement.clientHeight;
|
|
115
|
+
return new THREE.Vector2(x, z);
|
|
116
|
+
}
|
|
117
|
+
cameraPositionRecord = [];
|
|
118
|
+
/**
|
|
119
|
+
* 相机
|
|
120
|
+
* @param position
|
|
121
|
+
* @param lookAt
|
|
122
|
+
* @param onEnd
|
|
123
|
+
*/
|
|
124
|
+
cameraTo(position, lookAt, onEnd) {
|
|
125
|
+
this.cameraPositionRecord.push([
|
|
126
|
+
this.camera.position.clone(),
|
|
127
|
+
this.camera.quaternion.clone()
|
|
128
|
+
]);
|
|
129
|
+
const tween = new TWEEN.Tween(this.camera.position);
|
|
130
|
+
tween.to(position, 600);
|
|
131
|
+
tween.start();
|
|
132
|
+
tween.onUpdate(() => {
|
|
133
|
+
this.camera.lookAt(lookAt);
|
|
134
|
+
});
|
|
135
|
+
tween.onComplete(() => {
|
|
136
|
+
const i = this.tweenTaskList.indexOf(tween);
|
|
137
|
+
this.tweenTaskList.splice(i, 1);
|
|
138
|
+
onEnd && onEnd();
|
|
139
|
+
});
|
|
140
|
+
this.tweenTaskList.push(tween);
|
|
141
|
+
}
|
|
142
|
+
cameraBack() {
|
|
143
|
+
if (this.cameraPositionRecord.length) {
|
|
144
|
+
const [pos, quat] = this.cameraPositionRecord.pop();
|
|
145
|
+
this.camera.position.copy(pos);
|
|
146
|
+
this.camera.quaternion.copy(quat);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 创建点
|
|
151
|
+
* @param pos
|
|
152
|
+
*/
|
|
153
|
+
createPointMesh(pos, size = 0.02, parameters, parent = this.container) {
|
|
154
|
+
const box = new THREE.Mesh(
|
|
155
|
+
new THREE.SphereGeometry(size),
|
|
156
|
+
new THREE.MeshBasicMaterial(parameters)
|
|
157
|
+
);
|
|
158
|
+
if (pos instanceof Point) box.position.set(pos.x, pos.y, 0);
|
|
159
|
+
else if (pos instanceof THREE.Vector3) box.position.copy(pos);
|
|
160
|
+
parent.add(box);
|
|
161
|
+
return box;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 创建文本
|
|
165
|
+
* @param text
|
|
166
|
+
* @param pos
|
|
167
|
+
* @param style
|
|
168
|
+
*/
|
|
169
|
+
createText(text, pos, style, parent = this.container) {
|
|
170
|
+
const div = document.createElement("div");
|
|
171
|
+
div.innerHTML = text;
|
|
172
|
+
div.style.pointerEvents = "none";
|
|
173
|
+
Object.assign(div.style, { fontSize: "10px", color: "#ffffff", ...style });
|
|
174
|
+
const css2DObject = new Renderer.CSS2DObject(div);
|
|
175
|
+
if (pos instanceof Point) css2DObject.position.set(pos.x, pos.y, 0);
|
|
176
|
+
else if (pos instanceof THREE.Vector3) css2DObject.position.copy(pos);
|
|
177
|
+
parent.add(css2DObject);
|
|
178
|
+
return css2DObject;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 创建几何缓冲区
|
|
182
|
+
* @param map
|
|
183
|
+
* @param count
|
|
184
|
+
*/
|
|
185
|
+
createLineSegments(map, count, parameters, parent = this.container) {
|
|
186
|
+
const geometry = new THREE.BufferGeometry();
|
|
187
|
+
Object.keys(map).forEach((key) => {
|
|
188
|
+
const value = map[key];
|
|
189
|
+
geometry.setAttribute(key, new THREE.BufferAttribute(new Float32Array(value), value.length / count));
|
|
190
|
+
});
|
|
191
|
+
const lineSegmentList = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ ...parameters }));
|
|
192
|
+
parent.add(lineSegmentList);
|
|
193
|
+
return lineSegmentList;
|
|
194
|
+
}
|
|
195
|
+
destroy() {
|
|
196
|
+
if (this.resizeObserver) {
|
|
197
|
+
this.renderer.dispose();
|
|
198
|
+
this.resizeObserver.disconnect();
|
|
199
|
+
this.resizeObserver = void 0;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
3
203
|
const configProviderContextKey = Symbol();
|
|
4
204
|
const defaultNamespace = "el";
|
|
5
205
|
const statePrefix = "is-";
|
|
@@ -3667,6 +3867,225 @@ class Lines extends THREE.LineSegments {
|
|
|
3667
3867
|
});
|
|
3668
3868
|
}
|
|
3669
3869
|
}
|
|
3870
|
+
class DomContainer extends Component {
|
|
3871
|
+
static name = "DomContainer";
|
|
3872
|
+
domElement = document.createElement("div");
|
|
3873
|
+
canvas = document.createElement("canvas");
|
|
3874
|
+
html2DRenderer = document.createElement("div");
|
|
3875
|
+
html3DRenderer = document.createElement("div");
|
|
3876
|
+
constructor() {
|
|
3877
|
+
super();
|
|
3878
|
+
this.domElement.id = "build-dxf-container";
|
|
3879
|
+
this.domElement.appendChild(this.canvas);
|
|
3880
|
+
this.domElement.appendChild(this.html3DRenderer);
|
|
3881
|
+
this.domElement.appendChild(this.html2DRenderer);
|
|
3882
|
+
Object.assign(this.domElement.style, {
|
|
3883
|
+
width: "100%",
|
|
3884
|
+
height: "100%",
|
|
3885
|
+
position: "relative",
|
|
3886
|
+
userSelect: "none"
|
|
3887
|
+
});
|
|
3888
|
+
Object.assign(this.html3DRenderer.style, {
|
|
3889
|
+
position: "absolute",
|
|
3890
|
+
left: 0,
|
|
3891
|
+
top: 0,
|
|
3892
|
+
// zIndex: 9,
|
|
3893
|
+
width: "100%",
|
|
3894
|
+
height: "100%"
|
|
3895
|
+
});
|
|
3896
|
+
Object.assign(this.html2DRenderer.style, {
|
|
3897
|
+
position: "absolute",
|
|
3898
|
+
left: 0,
|
|
3899
|
+
top: 0,
|
|
3900
|
+
// zIndex: 10,
|
|
3901
|
+
width: "100%",
|
|
3902
|
+
height: "100%"
|
|
3903
|
+
});
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
class DomEventRegister extends Component {
|
|
3907
|
+
static name = "DomEventRegister";
|
|
3908
|
+
cancelDefaultBehaviorList = [];
|
|
3909
|
+
pointer = new Vector2();
|
|
3910
|
+
_isMouseEnter = false;
|
|
3911
|
+
set isMouseEnter(isMouseEnter) {
|
|
3912
|
+
if (this._isMouseEnter === isMouseEnter) return;
|
|
3913
|
+
this._isMouseEnter = isMouseEnter;
|
|
3914
|
+
}
|
|
3915
|
+
get isMouseEnter() {
|
|
3916
|
+
return this._isMouseEnter;
|
|
3917
|
+
}
|
|
3918
|
+
_mouseMoveEventProxylock = false;
|
|
3919
|
+
set mouseMoveEventProxylock(lock) {
|
|
3920
|
+
this._mouseMoveEventProxylock = lock;
|
|
3921
|
+
if (lock) {
|
|
3922
|
+
this._isMouseEnter = false;
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
get mouseMoveEventProxylock() {
|
|
3926
|
+
return this._mouseMoveEventProxylock;
|
|
3927
|
+
}
|
|
3928
|
+
/**
|
|
3929
|
+
* 组件被添加到父组件上时调用
|
|
3930
|
+
*/
|
|
3931
|
+
onAddFromParent() {
|
|
3932
|
+
this.initMouseMoveEventProxy();
|
|
3933
|
+
this.initKeyEvent();
|
|
3934
|
+
this.initWheelEvent();
|
|
3935
|
+
this.autoBodyCursor();
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* 初始化鼠标事件代理(判断鼠标是否在domElement上)
|
|
3939
|
+
*/
|
|
3940
|
+
initMouseMoveEventProxy() {
|
|
3941
|
+
const domContainer = this.parent?.findComponentByType(DomContainer), domElement = domContainer.domElement, variable = this.parent?.findComponentByType(Variable), globalMousemoveFun = (e) => {
|
|
3942
|
+
if (this._mouseMoveEventProxylock) return;
|
|
3943
|
+
const rect = domElement.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;
|
|
3944
|
+
if (offsetX >= 0 && offsetY >= 0 && offsetX <= rect.width && offsetY <= rect.height) {
|
|
3945
|
+
this.pointer.set(offsetX, offsetY);
|
|
3946
|
+
this.dispatchEvent({
|
|
3947
|
+
type: "mousemove",
|
|
3948
|
+
x: offsetX,
|
|
3949
|
+
y: offsetY,
|
|
3950
|
+
moveX: e.movementX,
|
|
3951
|
+
moveY: e.movementY
|
|
3952
|
+
});
|
|
3953
|
+
this.isMouseEnter = true;
|
|
3954
|
+
} else {
|
|
3955
|
+
this.isMouseEnter = false;
|
|
3956
|
+
}
|
|
3957
|
+
}, globalMousedownFun = (e) => {
|
|
3958
|
+
if (!this.isMouseEnter) return;
|
|
3959
|
+
const rect = domElement.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;
|
|
3960
|
+
this.pointer.set(offsetX, offsetY);
|
|
3961
|
+
variable.set("currentMouseDown", "mouse_" + e.button);
|
|
3962
|
+
this.dispatchEvent({
|
|
3963
|
+
type: "mousedown",
|
|
3964
|
+
x: offsetX,
|
|
3965
|
+
y: offsetY
|
|
3966
|
+
});
|
|
3967
|
+
}, globalMouseupFun = (e) => {
|
|
3968
|
+
if (!this.isMouseEnter) return;
|
|
3969
|
+
variable.set("currentMouseUp", "mouse_" + e.button);
|
|
3970
|
+
};
|
|
3971
|
+
document.addEventListener("mousemove", globalMousemoveFun);
|
|
3972
|
+
document.addEventListener("mousedown", globalMousedownFun);
|
|
3973
|
+
document.addEventListener("mouseup", globalMouseupFun);
|
|
3974
|
+
this.addEventRecord("destory", () => {
|
|
3975
|
+
document.removeEventListener("mousemove", globalMousemoveFun);
|
|
3976
|
+
document.removeEventListener("mousedown", globalMousedownFun);
|
|
3977
|
+
document.removeEventListener("mouseup", globalMouseupFun);
|
|
3978
|
+
});
|
|
3979
|
+
}
|
|
3980
|
+
/**
|
|
3981
|
+
* 初始化键盘事件
|
|
3982
|
+
*/
|
|
3983
|
+
initKeyEvent() {
|
|
3984
|
+
const variable = this.parent?.findComponentByType(Variable);
|
|
3985
|
+
document.body.tabIndex = 1;
|
|
3986
|
+
const onKeyup = (e) => {
|
|
3987
|
+
if (!this.isMouseEnter) return;
|
|
3988
|
+
const key = e.key.toLocaleLowerCase();
|
|
3989
|
+
variable.set("currentKeyUp", key);
|
|
3990
|
+
for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
|
|
3991
|
+
const element = this.cancelDefaultBehaviorList[i];
|
|
3992
|
+
if (element(e)) e.preventDefault();
|
|
3993
|
+
}
|
|
3994
|
+
};
|
|
3995
|
+
document.body.addEventListener("keyup", onKeyup);
|
|
3996
|
+
const onKeydown = (e) => {
|
|
3997
|
+
if (!this.isMouseEnter) return;
|
|
3998
|
+
const key = e.key.toLocaleLowerCase();
|
|
3999
|
+
variable.set("currentKeyDown", key);
|
|
4000
|
+
for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
|
|
4001
|
+
const element = this.cancelDefaultBehaviorList[i];
|
|
4002
|
+
if (element(e)) e.preventDefault();
|
|
4003
|
+
}
|
|
4004
|
+
};
|
|
4005
|
+
document.body.addEventListener("keydown", onKeydown);
|
|
4006
|
+
const onFocus = () => variable.set("focus", true);
|
|
4007
|
+
document.body.addEventListener("focus", onFocus);
|
|
4008
|
+
const onBlur = () => variable.set("focus", false);
|
|
4009
|
+
document.body.addEventListener("blur", onBlur);
|
|
4010
|
+
this.addEventRecord("destory", () => {
|
|
4011
|
+
document.body.removeEventListener("keyup", onKeyup);
|
|
4012
|
+
document.body.removeEventListener("keydown", onKeydown);
|
|
4013
|
+
document.body.removeEventListener("focus", onFocus);
|
|
4014
|
+
document.body.removeEventListener("blur", onBlur);
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
/**
|
|
4018
|
+
* 初始化滚轮事件
|
|
4019
|
+
*/
|
|
4020
|
+
initWheelEvent() {
|
|
4021
|
+
const variable = this.parent?.findComponentByType(Variable);
|
|
4022
|
+
const onWheel = (e) => variable.set("currentWheel", e.wheelDelta);
|
|
4023
|
+
document.body.addEventListener("wheel", onWheel);
|
|
4024
|
+
this.addEventRecord("destory", () => {
|
|
4025
|
+
document.body.removeEventListener("wheel", onWheel);
|
|
4026
|
+
});
|
|
4027
|
+
}
|
|
4028
|
+
/**
|
|
4029
|
+
* 根据domElement的cursor自动设置body的cursor
|
|
4030
|
+
*/
|
|
4031
|
+
autoBodyCursor() {
|
|
4032
|
+
const domContainer = this.parent?.findComponentByType(DomContainer), domElement = domContainer.domElement;
|
|
4033
|
+
let bodyCursor = null;
|
|
4034
|
+
this.addEventListener("update", () => {
|
|
4035
|
+
if (this._mouseMoveEventProxylock) return;
|
|
4036
|
+
if (this.isMouseEnter) {
|
|
4037
|
+
if (bodyCursor === null) {
|
|
4038
|
+
bodyCursor = document.body.style.cursor;
|
|
4039
|
+
}
|
|
4040
|
+
document.body.style.cursor = domElement.style.cursor;
|
|
4041
|
+
} else {
|
|
4042
|
+
if (bodyCursor !== null) {
|
|
4043
|
+
document.body.style.cursor = bodyCursor;
|
|
4044
|
+
bodyCursor = null;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
/**
|
|
4050
|
+
*
|
|
4051
|
+
* @param callBack
|
|
4052
|
+
*/
|
|
4053
|
+
addCancelDefaultBehavior(callBack) {
|
|
4054
|
+
this.cancelDefaultBehaviorList.push(callBack);
|
|
4055
|
+
return this;
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
*
|
|
4059
|
+
* @param el
|
|
4060
|
+
* @param callBack
|
|
4061
|
+
* @param offset
|
|
4062
|
+
* @param condition
|
|
4063
|
+
*/
|
|
4064
|
+
static dragMoveHelper(el, callBack, offset = { x: 0, y: 0 }, condition = () => true) {
|
|
4065
|
+
function onMousedown() {
|
|
4066
|
+
if (!condition()) return;
|
|
4067
|
+
const move = (e) => {
|
|
4068
|
+
offset.x += e.movementX;
|
|
4069
|
+
offset.y += e.movementY;
|
|
4070
|
+
callBack({ ...offset }, e.movementX, e.movementY);
|
|
4071
|
+
};
|
|
4072
|
+
const end = () => {
|
|
4073
|
+
document.removeEventListener("mousemove", move);
|
|
4074
|
+
document.removeEventListener("mouseup", end);
|
|
4075
|
+
};
|
|
4076
|
+
document.addEventListener("mousemove", move);
|
|
4077
|
+
document.addEventListener("mouseup", end);
|
|
4078
|
+
}
|
|
4079
|
+
el.addEventListener("mousedown", onMousedown);
|
|
4080
|
+
callBack({ ...offset }, 0, 0);
|
|
4081
|
+
return () => {
|
|
4082
|
+
el.removeEventListener("mousedown", onMousedown);
|
|
4083
|
+
};
|
|
4084
|
+
}
|
|
4085
|
+
destroy() {
|
|
4086
|
+
this.canceEventRecord("destory");
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
3670
4089
|
function selectLocalFileFun() {
|
|
3671
4090
|
return new Promise((resolve) => {
|
|
3672
4091
|
const input = document.createElement("input");
|
|
@@ -3710,36 +4129,39 @@ const SelectLocalFile = Object.assign(selectLocalFileFun, {
|
|
|
3710
4129
|
}
|
|
3711
4130
|
});
|
|
3712
4131
|
export {
|
|
3713
|
-
|
|
4132
|
+
isElement as A,
|
|
4133
|
+
withInstallFunction as B,
|
|
4134
|
+
DomEventRegister as D,
|
|
3714
4135
|
ElButton as E,
|
|
3715
4136
|
Lines as L,
|
|
4137
|
+
Renderer as R,
|
|
3716
4138
|
SelectLocalFile as S,
|
|
3717
4139
|
TypeComponentsMap as T,
|
|
3718
4140
|
_export_sfc as _,
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
4141
|
+
DomContainer as a,
|
|
4142
|
+
ElCheckbox as b,
|
|
4143
|
+
isClient as c,
|
|
4144
|
+
tryOnMounted as d,
|
|
4145
|
+
identity as e,
|
|
4146
|
+
buildProps as f,
|
|
4147
|
+
definePropType as g,
|
|
4148
|
+
isNumber as h,
|
|
3727
4149
|
isString as i,
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
4150
|
+
addUnit as j,
|
|
4151
|
+
useEmptyValuesProps as k,
|
|
4152
|
+
useSizeProp as l,
|
|
4153
|
+
iconPropType as m,
|
|
3732
4154
|
noop as n,
|
|
3733
|
-
|
|
4155
|
+
useGlobalComponentSettings as o,
|
|
3734
4156
|
provideGlobalConfig as p,
|
|
3735
|
-
|
|
4157
|
+
ElIcon as q,
|
|
3736
4158
|
resolveUnref as r,
|
|
3737
|
-
|
|
4159
|
+
TypeComponents as s,
|
|
3738
4160
|
tryOnScopeDispose as t,
|
|
3739
4161
|
useNamespace as u,
|
|
3740
|
-
|
|
4162
|
+
useTimeoutFn as v,
|
|
3741
4163
|
withInstall as w,
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
4164
|
+
isString$1 as x,
|
|
4165
|
+
isFunction$1 as y,
|
|
4166
|
+
isBoolean as z
|
|
3745
4167
|
};
|
|
@@ -10,6 +10,7 @@ export declare class Component<TEventMap extends {} = {}> extends EventDispatche
|
|
|
10
10
|
update: {};
|
|
11
11
|
} & TEventMap> {
|
|
12
12
|
parent?: ComponentManager;
|
|
13
|
+
destroyed: boolean;
|
|
13
14
|
constructor(...arg: any[]);
|
|
14
15
|
onAddFromParent(parent: ComponentManager): void;
|
|
15
16
|
onRemoveFromParent(parent: ComponentManager): void;
|
|
@@ -32,7 +32,7 @@ export declare class ComponentManager<TEventMap extends {} = {}> extends EventDi
|
|
|
32
32
|
* 查找所有符合条件的组件
|
|
33
33
|
* @param callBack
|
|
34
34
|
*/
|
|
35
|
-
findComponents(predicate: (component: Component, index: number) => boolean): Component<{}>
|
|
35
|
+
findComponents(predicate: (component: Component, index: number) => boolean): Component<{}>[];
|
|
36
36
|
/**
|
|
37
37
|
*
|
|
38
38
|
* @param type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from '../../../../../ComponentManager';
|
|
1
|
+
import { Component, ComponentManager } from '../../../../../ComponentManager';
|
|
2
2
|
import { Editor } from '../Editor';
|
|
3
3
|
import { EventInput, Renderer } from '../../../RenderPlugin/components';
|
|
4
4
|
import { CommandManager } from '../../../../../CommandManager';
|
|
@@ -17,6 +17,13 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
|
|
|
17
17
|
private _commandManager?;
|
|
18
18
|
get commandManager(): CommandManager;
|
|
19
19
|
interruptKeys: string[];
|
|
20
|
+
commandName: string;
|
|
21
|
+
constructor();
|
|
22
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
23
|
+
/**
|
|
24
|
+
* 取消
|
|
25
|
+
*/
|
|
26
|
+
cancel(): void;
|
|
20
27
|
/**
|
|
21
28
|
* 创建中断
|
|
22
29
|
* @returns
|
|
@@ -32,5 +39,5 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
|
|
|
32
39
|
* 创建清理
|
|
33
40
|
* @returns
|
|
34
41
|
*/
|
|
35
|
-
createFinally(): () => void;
|
|
42
|
+
createFinally(keys?: string[]): () => void;
|
|
36
43
|
}
|
|
@@ -4,7 +4,9 @@ import { Renderer } from '../../../RenderPlugin/components';
|
|
|
4
4
|
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
5
5
|
import { LineUserData } from '../RenderManager';
|
|
6
6
|
import * as THREE from "three";
|
|
7
|
-
export declare class Default extends Component<{
|
|
7
|
+
export declare class Default extends Component<{
|
|
8
|
+
selectLineChange: {};
|
|
9
|
+
}> {
|
|
8
10
|
static name: string;
|
|
9
11
|
get editor(): Editor;
|
|
10
12
|
renderer?: Renderer;
|
|
@@ -20,6 +22,10 @@ export declare class Default extends Component<{}> {
|
|
|
20
22
|
* @param lineSegment
|
|
21
23
|
*/
|
|
22
24
|
removeSelectLine(lineSegment: LineSegment): void;
|
|
25
|
+
/**
|
|
26
|
+
* 移除所有选中线段
|
|
27
|
+
*/
|
|
28
|
+
removeSelectLineAll(): void;
|
|
23
29
|
/**
|
|
24
30
|
* 删除选择的线段
|
|
25
31
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../../../../Quadtree/Point';
|
|
2
2
|
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
3
|
+
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
4
|
import * as THREE from "three";
|
|
4
5
|
export declare class DrawLine extends CommandFlowComponent<{}> {
|
|
5
6
|
static name: string;
|
|
@@ -9,7 +10,7 @@ export declare class DrawLine extends CommandFlowComponent<{}> {
|
|
|
9
10
|
shortcutKeys: string[];
|
|
10
11
|
confirmKeys: string[];
|
|
11
12
|
commandName: string;
|
|
12
|
-
onAddFromParent(): void;
|
|
13
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
13
14
|
/** 选择点
|
|
14
15
|
* @param next
|
|
15
16
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
2
|
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
3
|
+
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
4
|
import * as THREE from "three";
|
|
4
5
|
export declare class DrawWindow extends CommandFlowComponent<{}> {
|
|
5
6
|
static name: string;
|
|
@@ -7,7 +8,7 @@ export declare class DrawWindow extends CommandFlowComponent<{}> {
|
|
|
7
8
|
interruptKeys: string[];
|
|
8
9
|
shortcutKeys: string[];
|
|
9
10
|
commandName: string;
|
|
10
|
-
onAddFromParent(): void;
|
|
11
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
11
12
|
/** 选择开始点
|
|
12
13
|
* @param next
|
|
13
14
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
2
|
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
3
|
+
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
4
|
import * as THREE from "three";
|
|
4
5
|
export declare class PointDrag extends CommandFlowComponent<{}> {
|
|
5
6
|
static name: string;
|
|
@@ -7,7 +8,7 @@ export declare class PointDrag extends CommandFlowComponent<{}> {
|
|
|
7
8
|
interruptKeys: string[];
|
|
8
9
|
shortcutKeys: string[];
|
|
9
10
|
commandName: string;
|
|
10
|
-
onAddFromParent(): void;
|
|
11
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
11
12
|
/** 选择开始点
|
|
12
13
|
* @param next
|
|
13
14
|
*/
|
|
@@ -10,6 +10,7 @@ export declare class Editor extends Component<{
|
|
|
10
10
|
pointerPositionChange: {
|
|
11
11
|
position: THREE.Vector2;
|
|
12
12
|
};
|
|
13
|
+
cancelCommand: {};
|
|
13
14
|
}> {
|
|
14
15
|
static name: string;
|
|
15
16
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
@@ -24,7 +25,13 @@ export declare class Editor extends Component<{
|
|
|
24
25
|
plane: THREE.Mesh<THREE.PlaneGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
25
26
|
app?: App<Element>;
|
|
26
27
|
domElement: HTMLDivElement;
|
|
28
|
+
viewPermission?: "admin";
|
|
29
|
+
constructor(viewPermission?: "admin");
|
|
27
30
|
onAddFromParent(): void;
|
|
31
|
+
/**
|
|
32
|
+
* 取消命令,由其他命令组件监听事件后注册事件监听实现
|
|
33
|
+
*/
|
|
34
|
+
cancelCommand(): void;
|
|
28
35
|
coords: THREE.Vector2;
|
|
29
36
|
pointerPosition: THREE.Vector2;
|
|
30
37
|
private _exitEditCallBack?;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { DxfSystem } from '../..';
|
|
2
|
-
|
|
2
|
+
type Option = {
|
|
3
|
+
viewPermission?: "admin";
|
|
4
|
+
};
|
|
5
|
+
export declare function Editor_(dxfSystem: DxfSystem, option?: Option): void;
|
|
6
|
+
declare const Editor: typeof Editor_ & {
|
|
7
|
+
create(option?: Option): (dxfSystem: DxfSystem) => void;
|
|
8
|
+
};
|
|
9
|
+
export { Editor };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { DxfSystem } from '../../..';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
dxfSystem: DxfSystem;
|
|
4
|
+
permission?: "admin";
|
|
4
5
|
};
|
|
5
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
7
|
+
elRef: HTMLDivElement;
|
|
8
|
+
toolBarRef: HTMLDivElement;
|
|
9
|
+
}, HTMLDivElement>;
|
|
6
10
|
export default _default;
|