build-dxf 0.0.19-6 → 0.0.19-8
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/build.d.ts +21 -1
- package/src/build.js +26 -5
- package/src/index.css +655 -1
- package/src/index.js +4 -2
- package/src/index2.js +100 -38
- package/src/index3.js +23 -12
- package/src/utils/ComponentManager/ComponentManager.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +22 -4
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts +1 -1
package/package.json
CHANGED
package/src/build.d.ts
CHANGED
|
@@ -7,6 +7,26 @@ export * from './utils/DxfSystem/plugin/ModelDataPlugin';
|
|
|
7
7
|
* @param camera
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function createEditor(dom: HTMLDivElement, camera?: THREE.
|
|
10
|
+
export declare function createEditor(dom: HTMLDivElement, camera?: THREE.Camera, orbitControls?: boolean): Promise<{
|
|
11
11
|
dxfSystem: DxfSystem;
|
|
12
|
+
getFileAll: () => {
|
|
13
|
+
dxf: File;
|
|
14
|
+
obj: File;
|
|
15
|
+
glb: File;
|
|
16
|
+
gltf: File;
|
|
17
|
+
};
|
|
12
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取所有文件数据
|
|
21
|
+
* @param dxfSystem
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFileAll(dxfSystem?: DxfSystem): {
|
|
24
|
+
dxf: File;
|
|
25
|
+
obj: File;
|
|
26
|
+
glb: File;
|
|
27
|
+
gltf: File;
|
|
28
|
+
};
|
|
29
|
+
/** 获取全局DxfSystem
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare function getGlobalDxfSystem(): DxfSystem | null;
|
package/src/build.js
CHANGED
|
@@ -120,7 +120,7 @@ class ComponentManager extends EventDispatcher {
|
|
|
120
120
|
* @param callBack
|
|
121
121
|
*/
|
|
122
122
|
findComponents(predicate) {
|
|
123
|
-
return this.components.
|
|
123
|
+
return this.components.filter(predicate);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
*
|
|
@@ -3076,26 +3076,45 @@ function loadRenderPlugin() {
|
|
|
3076
3076
|
function loadEditorPlugin() {
|
|
3077
3077
|
return import("./index3.js");
|
|
3078
3078
|
}
|
|
3079
|
-
|
|
3079
|
+
let gloabalDxfSystem = null;
|
|
3080
|
+
async function createEditor(dom, camera, orbitControls = false) {
|
|
3080
3081
|
const mp = await Promise.resolve().then(() => index);
|
|
3081
3082
|
const rp = await loadRenderPlugin();
|
|
3082
3083
|
const editor = await loadEditorPlugin();
|
|
3083
3084
|
const dxfSystem = new DxfSystem().usePlugin(mp.ModelDataPlugin.create({
|
|
3084
3085
|
detailsPoint: false,
|
|
3085
|
-
whiteModel:
|
|
3086
|
+
whiteModel: true
|
|
3086
3087
|
})).usePlugin(rp.RenderPlugin.create({
|
|
3087
3088
|
originalLine: false,
|
|
3088
3089
|
modelData: false,
|
|
3089
3090
|
detailsPoint: false,
|
|
3090
|
-
orbitControls
|
|
3091
|
+
orbitControls,
|
|
3091
3092
|
camera
|
|
3092
3093
|
})).usePlugin(editor.Editor);
|
|
3093
3094
|
const domContainer = dxfSystem.findComponentByType(rp.components.DomContainer);
|
|
3094
3095
|
domContainer && dom.appendChild(domContainer.domElement);
|
|
3096
|
+
gloabalDxfSystem = dxfSystem;
|
|
3095
3097
|
return {
|
|
3096
|
-
dxfSystem
|
|
3098
|
+
dxfSystem,
|
|
3099
|
+
getFileAll: () => getFileAll(dxfSystem)
|
|
3097
3100
|
};
|
|
3098
3101
|
}
|
|
3102
|
+
function getFileAll(dxfSystem = gloabalDxfSystem) {
|
|
3103
|
+
const whiteModel = dxfSystem.findComponentByName("WhiteModel");
|
|
3104
|
+
const dxf = new File([dxfSystem.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" });
|
|
3105
|
+
const obj = new File([whiteModel.toOBJBlob()], "model.obj", { type: "application/octet-stream" });
|
|
3106
|
+
const glb = new File([whiteModel.toGltfBlob(true)], "model.glb", { type: "application/octet-stream" });
|
|
3107
|
+
const gltf = new File([whiteModel.toGltfBlob(false)], "model.gltf", { type: "application/json" });
|
|
3108
|
+
return {
|
|
3109
|
+
dxf,
|
|
3110
|
+
obj,
|
|
3111
|
+
glb,
|
|
3112
|
+
gltf
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
function getGlobalDxfSystem() {
|
|
3116
|
+
return gloabalDxfSystem;
|
|
3117
|
+
}
|
|
3099
3118
|
export {
|
|
3100
3119
|
Box2 as B,
|
|
3101
3120
|
Component as C,
|
|
@@ -3110,5 +3129,7 @@ export {
|
|
|
3110
3129
|
DetailsPoint as a,
|
|
3111
3130
|
PointVirtualGrid as b,
|
|
3112
3131
|
createEditor as c,
|
|
3132
|
+
getGlobalDxfSystem as d,
|
|
3133
|
+
getFileAll as g,
|
|
3113
3134
|
index$1 as i
|
|
3114
3135
|
};
|