@mlightcad/mtext-renderer 0.4.9 → 0.4.11
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 +7 -1
- package/dist/index.js +861 -828
- package/dist/index.umd.cjs +3 -3
- package/dist/mtext-renderer-worker.js +832 -808
- package/lib/font/fontManager.d.ts +11 -1
- package/lib/renderer/mtext.d.ts +8 -0
- package/lib/worker/mainThreadRenderer.d.ts +2 -0
- package/lib/worker/webWorkerRenderer.d.ts +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,6 +165,9 @@ Main class for rendering AutoCAD MText content. Extends THREE.Object3D to integr
|
|
|
165
165
|
- `fontManager`: Reference to FontManager instance for font operations
|
|
166
166
|
- `styleManager`: Reference to StyleManager instance for style operations
|
|
167
167
|
|
|
168
|
+
**Public Methods:**
|
|
169
|
+
- `draw()`: Asynchronously builds geometry and loads required fonts on demand
|
|
170
|
+
|
|
168
171
|
## Class Diagram
|
|
169
172
|
|
|
170
173
|
```mermaid
|
|
@@ -328,7 +331,7 @@ import { FontManager, MText, StyleManager } from '@mlightcad/mtext-renderer';
|
|
|
328
331
|
const fontManager = FontManager.instance;
|
|
329
332
|
const styleManager = new StyleManager();
|
|
330
333
|
|
|
331
|
-
//
|
|
334
|
+
// Optionally preload a font (otherwise MText will load on demand in draw())
|
|
332
335
|
await fontManager.loadFontsByNames(['simsun']);
|
|
333
336
|
|
|
334
337
|
// Create MText content
|
|
@@ -358,6 +361,9 @@ const mtext = new MText(
|
|
|
358
361
|
fontManager
|
|
359
362
|
);
|
|
360
363
|
|
|
364
|
+
// Build geometry and load fonts on demand
|
|
365
|
+
await mtext.draw();
|
|
366
|
+
|
|
361
367
|
// Add to Three.js scene
|
|
362
368
|
scene.add(mtext);
|
|
363
369
|
```
|