@mlightcad/cad-simple-viewer 1.0.16 → 1.0.19
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 +11 -10
- package/dist/index.js +2351 -15106
- package/dist/index.umd.cjs +22 -24
- package/dist/libredwg-parser-worker.js +339 -339
- package/dist/mtext-renderer-worker.js +18619 -0
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +6 -0
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +4 -9
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApGlobalFunc.d.ts +12 -10
- package/lib/app/AcApGlobalFunc.d.ts.map +1 -1
- package/lib/app/AcApGlobalFunc.js +40 -74
- package/lib/app/AcApGlobalFunc.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +12 -6
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +14 -4
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +81 -44
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -57,19 +57,15 @@ Thirdly, add the following code in the entry point of cad-simple-viewer integrat
|
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
59
|
import { AcApDocManager } from '@mlightcad/cad-simple-viewer'
|
|
60
|
-
import { AcDbDatabaseConverterManager, AcDbFileType,
|
|
60
|
+
import { AcDbDatabaseConverterManager, AcDbFileType, registerWorkers } from '@mlightcad/data-model'
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
|
|
62
|
+
// Initializes background workers used by the viewer runtime.
|
|
63
|
+
registerWorkers()
|
|
64
64
|
|
|
65
65
|
// Get canvas DOM element by its id
|
|
66
66
|
const canvas = document.getElementById('canvas') as HTMLCanvasElement
|
|
67
67
|
AcApDocManager.createInstance(canvas)
|
|
68
68
|
|
|
69
|
-
// Although it is optional, it is better to call this method to load the default fonts.
|
|
70
|
-
// The default fonts are used if fonts used in drawing are not found.
|
|
71
|
-
await AcApDocManager.instance.loadDefaultFonts()
|
|
72
|
-
|
|
73
69
|
// Read the file content
|
|
74
70
|
const fileContent = await this.readFile(file)
|
|
75
71
|
|
|
@@ -90,14 +86,15 @@ const success = await AcApDocManager.instance.openDocument(
|
|
|
90
86
|
......
|
|
91
87
|
```
|
|
92
88
|
|
|
93
|
-
Finally, copy web worker javascript
|
|
89
|
+
Finally, copy web worker javascript files to `dist/assets` folder.
|
|
94
90
|
|
|
95
|
-
Web worker are used to parser dxf/dwg file so that UI not blocked. You can copy the following web worker files to folder `dist/assets` manually.
|
|
91
|
+
Web worker are used to parser dxf/dwg file and render mtext entities so that UI not blocked. You can copy the following web worker files to folder `dist/assets` manually.
|
|
96
92
|
|
|
97
93
|
- `./node_modules/@mlightcad/data-model/dist/dxf-parser-worker.js`
|
|
98
94
|
- `./node_modules/@mlightcad/cad-simple-viewer/dist/libredwg-parser-worker.js`
|
|
95
|
+
- `./node_modules/@mlightcad/cad-simple-viewer/dist/mtext-renderer-worker.js`
|
|
99
96
|
|
|
100
|
-
However, `vite-plugin-static-copy` is recommended to make your
|
|
97
|
+
However, `vite-plugin-static-copy` is recommended to make your life easier.
|
|
101
98
|
|
|
102
99
|
```typescript
|
|
103
100
|
import { resolve } from 'path'
|
|
@@ -126,6 +123,10 @@ export default defineConfig(() => {
|
|
|
126
123
|
{
|
|
127
124
|
src: './node_modules/@mlightcad/cad-simple-viewer/dist/libredwg-parser-worker.js',
|
|
128
125
|
dest: 'assets'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
src: './node_modules/@mlightcad/cad-simple-viewer/dist/mtext-renderer-worker.js',
|
|
129
|
+
dest: 'assets'
|
|
129
130
|
}
|
|
130
131
|
]
|
|
131
132
|
})
|