@mlightcad/cad-simple-viewer 1.5.9 → 1.5.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/dist/cad-simple-viewer.js +12006 -53317
- package/dist/cad-simple-viewer.umd.cjs +31 -420
- package/dist/mtext-renderer-worker.js +2896 -2767
- package/lib/app/AcApDocManager.d.ts +49 -23
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +160 -48
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApFontLoader.d.ts +49 -26
- package/lib/app/AcApFontLoader.d.ts.map +1 -1
- package/lib/app/AcApFontLoader.js +245 -48
- package/lib/app/AcApFontLoader.js.map +1 -1
- package/lib/app/AcApOpenFileProfiler.d.ts +70 -17
- package/lib/app/AcApOpenFileProfiler.d.ts.map +1 -1
- package/lib/app/AcApOpenFileProfiler.js +96 -46
- package/lib/app/AcApOpenFileProfiler.js.map +1 -1
- package/lib/app/AcApOpenFileProgressController.d.ts +22 -5
- package/lib/app/AcApOpenFileProgressController.d.ts.map +1 -1
- package/lib/app/AcApOpenFileProgressController.js +76 -31
- package/lib/app/AcApOpenFileProgressController.js.map +1 -1
- package/lib/app/AcApProgress.d.ts +6 -0
- package/lib/app/AcApProgress.d.ts.map +1 -1
- package/lib/app/AcApProgress.js +11 -0
- package/lib/app/AcApProgress.js.map +1 -1
- package/lib/app/AcDbOpenDatabaseOptions.d.ts +15 -12
- package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -1
- package/lib/app/index.d.ts +1 -0
- package/lib/app/index.d.ts.map +1 -1
- package/lib/app/index.js +1 -0
- package/lib/app/index.js.map +1 -1
- package/lib/command/convert/AcApConvertToPngCmd.d.ts.map +1 -1
- package/lib/command/convert/AcApConvertToPngCmd.js +5 -1
- package/lib/command/convert/AcApConvertToPngCmd.js.map +1 -1
- package/lib/command/convert/AcApPngConvertor.d.ts +4 -1
- package/lib/command/convert/AcApPngConvertor.d.ts.map +1 -1
- package/lib/command/convert/AcApPngConvertor.js +131 -78
- package/lib/command/convert/AcApPngConvertor.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +6 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +10 -0
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts +7 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js +17 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +9 -0
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +17 -0
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/view/AcEdSpatialQueryResult.d.ts +10 -0
- package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
- package/lib/editor/view/AcEdSpatialQueryResult.js +36 -0
- package/lib/editor/view/AcEdSpatialQueryResult.js.map +1 -1
- package/lib/i18n/cs/command.d.ts +3 -0
- package/lib/i18n/cs/command.d.ts.map +1 -1
- package/lib/i18n/cs/command.js +3 -0
- package/lib/i18n/cs/command.js.map +1 -1
- package/lib/i18n/cs/main.d.ts +1 -0
- package/lib/i18n/cs/main.d.ts.map +1 -1
- package/lib/i18n/cs/main.js +1 -0
- package/lib/i18n/cs/main.js.map +1 -1
- package/lib/i18n/en/command.d.ts +3 -0
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +3 -0
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/main.d.ts +1 -0
- package/lib/i18n/en/main.d.ts.map +1 -1
- package/lib/i18n/en/main.js +1 -0
- package/lib/i18n/en/main.js.map +1 -1
- package/lib/i18n/tr/command.d.ts +3 -0
- package/lib/i18n/tr/command.d.ts.map +1 -1
- package/lib/i18n/tr/command.js +3 -0
- package/lib/i18n/tr/command.js.map +1 -1
- package/lib/i18n/tr/main.d.ts +1 -0
- package/lib/i18n/tr/main.d.ts.map +1 -1
- package/lib/i18n/tr/main.js +1 -0
- package/lib/i18n/tr/main.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +3 -0
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +3 -0
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/main.d.ts +1 -0
- package/lib/i18n/zh/main.d.ts.map +1 -1
- package/lib/i18n/zh/main.js +1 -0
- package/lib/i18n/zh/main.js.map +1 -1
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js +2 -2
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js.map +1 -1
- package/lib/spatialIndex/AcTrLinearSpatialIndex.d.ts +6 -1
- package/lib/spatialIndex/AcTrLinearSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrLinearSpatialIndex.js +68 -11
- package/lib/spatialIndex/AcTrLinearSpatialIndex.js.map +1 -1
- package/lib/spatialIndex/AcTrRBushSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrRBushSpatialIndex.js +58 -12
- package/lib/spatialIndex/AcTrRBushSpatialIndex.js.map +1 -1
- package/lib/util/AcApScriptParser.d.ts +13 -0
- package/lib/util/AcApScriptParser.d.ts.map +1 -0
- package/lib/util/AcApScriptParser.js +55 -0
- package/lib/util/AcApScriptParser.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/view/AcTrDirectBatch.d.ts +18 -0
- package/lib/view/AcTrDirectBatch.d.ts.map +1 -0
- package/lib/view/AcTrDirectBatch.js +113 -0
- package/lib/view/AcTrDirectBatch.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +7 -1
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +29 -0
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +11 -1
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +43 -0
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrProgressiveOpenFitController.d.ts +10 -6
- package/lib/view/AcTrProgressiveOpenFitController.d.ts.map +1 -1
- package/lib/view/AcTrProgressiveOpenFitController.js +35 -76
- package/lib/view/AcTrProgressiveOpenFitController.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +7 -1
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +18 -0
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +98 -12
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +553 -170
- package/lib/view/AcTrView2d.js.map +1 -1
- package/lib/view/index.d.ts +1 -0
- package/lib/view/index.d.ts.map +1 -1
- package/lib/view/index.js +1 -0
- package/lib/view/index.js.map +1 -1
- package/package.json +10 -8
|
@@ -71,10 +71,11 @@ export interface AcApDocManagerOptions {
|
|
|
71
71
|
*/
|
|
72
72
|
useMainThreadDraw?: boolean;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* When `true`, eagerly preload the modern fallback font chain at viewer
|
|
75
|
+
* init via {@link AcApDocManager.loadDefaultFonts}. Default is `false`:
|
|
76
|
+
* fonts load on demand through {@link FontManager.lazyFontLoading}.
|
|
76
77
|
*/
|
|
77
|
-
|
|
78
|
+
preloadDefaultFonts?: boolean;
|
|
78
79
|
/**
|
|
79
80
|
* URLs for Web Worker JavaScript bundles used by the CAD viewer.
|
|
80
81
|
*/
|
|
@@ -85,11 +86,6 @@ export interface AcApDocManagerOptions {
|
|
|
85
86
|
* `workersReady` event. Defaults to false.
|
|
86
87
|
*/
|
|
87
88
|
checkWorkersOnInit?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* URL of the offline HTML viewer runtime bundle (`viewer-runtime.iife.js`).
|
|
90
|
-
* Used by the HTML export plugin when packaging standalone HTML files.
|
|
91
|
-
*/
|
|
92
|
-
htmlViewerRuntimeUrl?: string | URL;
|
|
93
89
|
/**
|
|
94
90
|
* Host element for the busy overlay (e.g. HTML export spinner).
|
|
95
91
|
* Set to the viewer shell so the mask covers ribbon, toolbars, and status bar.
|
|
@@ -191,8 +187,6 @@ export declare class AcApDocManager {
|
|
|
191
187
|
private _fontLoader;
|
|
192
188
|
/** Base URL to get fonts, templates, and example files */
|
|
193
189
|
private _baseUrl;
|
|
194
|
-
/** URL of the HTML viewer runtime bundle for export */
|
|
195
|
-
private _htmlViewerRuntimeUrl?;
|
|
196
190
|
/** Busy overlay for long-running command operations */
|
|
197
191
|
private _busyIndicator;
|
|
198
192
|
/** Open-file progress overlay and event normalization */
|
|
@@ -341,10 +335,6 @@ export declare class AcApDocManager {
|
|
|
341
335
|
* Base URL to load fonts
|
|
342
336
|
*/
|
|
343
337
|
get baseUrl(): string;
|
|
344
|
-
/**
|
|
345
|
-
* URL of the offline HTML viewer runtime bundle used for HTML export.
|
|
346
|
-
*/
|
|
347
|
-
get htmlViewerRuntimeUrl(): string | URL | undefined;
|
|
348
338
|
/**
|
|
349
339
|
* Resolves colors for creating new entities.
|
|
350
340
|
*
|
|
@@ -374,7 +364,7 @@ export declare class AcApDocManager {
|
|
|
374
364
|
*
|
|
375
365
|
* @returns Array of available font names
|
|
376
366
|
*/
|
|
377
|
-
get avaiableFonts(): import("@mlightcad/
|
|
367
|
+
get avaiableFonts(): import("@mlightcad/mtext-renderer").FontInfo[];
|
|
378
368
|
/**
|
|
379
369
|
* Loads the specified fonts for text rendering.
|
|
380
370
|
*
|
|
@@ -548,6 +538,10 @@ export declare class AcApDocManager {
|
|
|
548
538
|
* for missed fonts so that the drawing can apply new fonts.
|
|
549
539
|
*/
|
|
550
540
|
regen(): void;
|
|
541
|
+
/**
|
|
542
|
+
* Resolves the font repository URL from {@link baseUrl}.
|
|
543
|
+
*/
|
|
544
|
+
private resolveFontsBaseUrl;
|
|
551
545
|
/**
|
|
552
546
|
* Search through all of the local and translated names in all of the command groups in the command stack
|
|
553
547
|
* starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
|
|
@@ -656,14 +650,42 @@ export declare class AcApDocManager {
|
|
|
656
650
|
*/
|
|
657
651
|
sendStringToExecute(cmdStr: string): void;
|
|
658
652
|
/**
|
|
659
|
-
* Executes a command script
|
|
653
|
+
* Executes a single command script and awaits completion.
|
|
654
|
+
*
|
|
655
|
+
* The first line is the command name; remaining lines are queued as inputs for
|
|
656
|
+
* `getPoint` / `getKeywords` / etc. Lazy plugins are loaded via
|
|
657
|
+
* {@link AcApPluginManager.loadByTrigger} when needed.
|
|
660
658
|
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
659
|
+
* Unlike {@link runScript}, leftover script inputs are cleared when the command
|
|
660
|
+
* ends (interactive / one-shot behavior).
|
|
663
661
|
*
|
|
664
662
|
* @param cmdStr - Command script (first line is the command name)
|
|
665
663
|
*/
|
|
666
|
-
|
|
664
|
+
executeCommandString(cmdStr: string): Promise<void>;
|
|
665
|
+
/**
|
|
666
|
+
* Runs a multi-command AutoCAD-style `.scr` script and awaits completion.
|
|
667
|
+
*
|
|
668
|
+
* Lines are parsed with {@link parseScriptLines}. The first non-blank line of
|
|
669
|
+
* each command is the command name; subsequent lines feed prompts until the
|
|
670
|
+
* command ends. Remaining queued lines become the next command. `QUIT` /
|
|
671
|
+
* `EXIT` terminate the script.
|
|
672
|
+
*
|
|
673
|
+
* @param script - Full script text
|
|
674
|
+
*/
|
|
675
|
+
runScript(script: string): Promise<void>;
|
|
676
|
+
/**
|
|
677
|
+
* Looks up and runs a registered command by name.
|
|
678
|
+
*
|
|
679
|
+
* When `preserveScriptInputs` is true (multi-command {@link runScript}), the
|
|
680
|
+
* script input queue is left intact so the next command can continue from the
|
|
681
|
+
* remaining lines. Otherwise the queue is cleared after the command finishes.
|
|
682
|
+
*/
|
|
683
|
+
private executeNamedCommand;
|
|
684
|
+
/**
|
|
685
|
+
* Consumes blank lines, then returns the next non-blank script token as a
|
|
686
|
+
* command name. Returns `undefined` when the queue is exhausted.
|
|
687
|
+
*/
|
|
688
|
+
private consumeNextScriptCommandName;
|
|
667
689
|
/**
|
|
668
690
|
* Splits command script into Enter-separated values.
|
|
669
691
|
* First line is command name, remaining lines are queued inputs for getXXX.
|
|
@@ -729,15 +751,19 @@ export declare class AcApDocManager {
|
|
|
729
751
|
/**
|
|
730
752
|
* Sets up or validates database opening options.
|
|
731
753
|
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
* If options are provided but missing a font loader, adds the font loader.
|
|
754
|
+
* Fonts are not loaded during open; {@link FontManager.lazyFontLoading}
|
|
755
|
+
* fetches them on demand while text is drawn.
|
|
735
756
|
*
|
|
736
757
|
* @param options - Optional database opening options to validate/modify
|
|
737
|
-
* @returns The validated options object
|
|
758
|
+
* @returns The validated options object
|
|
738
759
|
* @private
|
|
739
760
|
*/
|
|
740
761
|
private setOptions;
|
|
762
|
+
/**
|
|
763
|
+
* Removes removed open-time font options that integrators may still pass via
|
|
764
|
+
* cast/spread so they cannot silently affect `db.read`.
|
|
765
|
+
*/
|
|
766
|
+
private stripObsoleteFontOpenOptions;
|
|
741
767
|
/**
|
|
742
768
|
* Resolves the open mode used in document lifecycle events.
|
|
743
769
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocManager.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,YAAY,EAIZ,uBAAuB,EAIxB,MAAM,uBAAuB,CAAA;AAuE9B,OAAO,EAEL,WAAW,EACX,gBAAgB,EAChB,YAAY,EAC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S,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,uBAAuB;IAkGnC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;;;;;OAMG;IACH,SAAS,CAAC,4BAA4B,IAAI,OAAO;IAajD;;;;;;;;;OASG;IACH,OAAO,CAAC,UAAU;IAkBlB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAwBpC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAIzC;;;;OAIG;IACH,iBAAiB,IAAI,IAAI;IAIzB;;;;OAIG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9C;;;;;OAKG;IACG,iBAAiB,CAAC,CAAC,EACvB,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,CAAC,CAAC;IAIb;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,eAAe;IASvB;;;;;;;;OAQG;YACW,WAAW;CAwD1B"}
|
|
@@ -88,6 +88,7 @@ import { AcTrMTextRenderer } from '@mlightcad/three-renderer';
|
|
|
88
88
|
import { AcApAboutCmd, AcApArcCmd, AcApCacheFontCmd, AcApCircleCmd, AcApClearMeasurementsCmd, AcApConvertToDxfCmd, AcApConvertToPngCmd, AcApCopyCmd, AcApDimLinearCmd, AcApEllipseCmd, AcApEntityPreviewCmd, AcApEraseCmd, AcApHatchCmd, AcApHideObjectsCmd, AcApImageAttachCmd, AcApInsertCmd, AcApLayerCloseCmd, AcApLayerCmd, AcApLayerCurCmd, AcApLayerDelCmd, AcApLayerFreezeCmd, AcApLayerIsoCmd, AcApLayerLockCmd, AcApLayerOnCmd, AcApLayerPCmd, AcApLayerThawCmd, AcApLayerUnisoCmd, AcApLayerUnlockCmd, AcApLayoffCmd, AcApLineCmd, AcApLogCmd, AcApMeasureAngleCmd, AcApMeasureArcCmd, AcApMeasureAreaCmd, AcApMeasureDistanceCmd, AcApMLineCmd, AcApMoveCmd, AcApMTextCmd, AcApOffsetCmd, AcApOpenCmd, AcApPanCmd, AcApPointCmd, AcApPolygonCmd, AcApPolylineCmd, AcApQNewCmd, AcApRayCmd, AcApRectCmd, AcApRedoCmd, AcApRegenCmd, AcApRevCircleCmd, AcApRevCloudCmd, AcApRevRectCmd, AcApRevVisibilityCmd, AcApRotateCmd, AcApSelectCmd, AcApSketchCmd, AcApSplineCmd, AcApSwitchBgCmd, AcApSysVarCmd, AcApUndoCmd, AcApUnisolateObjectsCmd, AcApXAttachCmd, AcApXLineCmd, AcApZoomCmd } from '../command';
|
|
89
89
|
import { AcEdCommandStack, AcEdOpenMode } from '../editor';
|
|
90
90
|
import { AcApPluginManager } from '../plugin/AcApPluginManager';
|
|
91
|
+
import { isScriptQuitCommand, parseScriptLines } from '../util/AcApScriptParser';
|
|
91
92
|
import { acapWithSecondaryDatabase } from '../util/AcApSecondaryDatabase';
|
|
92
93
|
import { AcTrView2d } from '../view';
|
|
93
94
|
import { AcApBusyIndicator } from './AcApBusyIndicator';
|
|
@@ -202,7 +203,6 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
202
203
|
workersReady: new AcCmEventManager()
|
|
203
204
|
};
|
|
204
205
|
this._baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : DEFAULT_BASE_URL;
|
|
205
|
-
this._htmlViewerRuntimeUrl = options.htmlViewerRuntimeUrl;
|
|
206
206
|
this._commandAliasOverrides = this.normalizeCommandAliasConfig(options.commandAliases);
|
|
207
207
|
this._openDocumentDefaults = options.openDocumentDefaults;
|
|
208
208
|
if (options.useMainThreadDraw) {
|
|
@@ -212,6 +212,10 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
212
212
|
AcTrMTextRenderer.getInstance().setRenderMode('worker');
|
|
213
213
|
}
|
|
214
214
|
FontManager.instance.setDefaultFonts(DEFAULT_FONTS_PRESET);
|
|
215
|
+
FontManager.instance.lazyFontLoading = true;
|
|
216
|
+
FontManager.instance.awaitFontsBeforeDraw = true;
|
|
217
|
+
void AcTrMTextRenderer.getInstance().setLazyFontLoading(true);
|
|
218
|
+
void AcTrMTextRenderer.getInstance().setAwaitFontsBeforeDraw(true);
|
|
215
219
|
// Create one empty drawing
|
|
216
220
|
var doc = new AcApDocument();
|
|
217
221
|
var initialSize = (_c = (_b = options.container) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {
|
|
@@ -247,13 +251,17 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
247
251
|
});
|
|
248
252
|
this._context = new AcApContext(view, doc);
|
|
249
253
|
this._fontLoader = new AcApFontLoader();
|
|
250
|
-
|
|
254
|
+
var fontsUrl = this.resolveFontsBaseUrl();
|
|
255
|
+
this._fontLoader.baseUrl = fontsUrl;
|
|
256
|
+
// On-demand loads go through FontManager's loader, not AcApFontLoader.
|
|
257
|
+
FontManager.instance.baseUrl = fontsUrl;
|
|
251
258
|
acdbHostApplicationServices().workingDatabase = doc.database;
|
|
252
259
|
this._commandManager = new AcEdCommandStack();
|
|
253
260
|
this.registerCommands();
|
|
254
261
|
this._pluginManager = new AcApPluginManager(this._context, this._commandManager);
|
|
255
262
|
var busyHost = (_d = options.busyIndicatorHost) !== null && _d !== void 0 ? _d : view.container;
|
|
256
263
|
this._openFileProgress = new AcApOpenFileProgressController(busyHost);
|
|
264
|
+
this._openFileProgress.setSceneBusyGate(function () { return _this.curView.isProcessingEntities; });
|
|
257
265
|
this._busyIndicator = new AcApBusyIndicator(busyHost);
|
|
258
266
|
acapBindCommandServices({
|
|
259
267
|
showMessage: function (message, type, msgKey) {
|
|
@@ -285,8 +293,8 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
285
293
|
_this.curView.renderer.showLineWeight = doc.database.lwdisplay;
|
|
286
294
|
}
|
|
287
295
|
});
|
|
288
|
-
if (
|
|
289
|
-
this.loadDefaultFonts();
|
|
296
|
+
if (options.preloadDefaultFonts) {
|
|
297
|
+
void this.loadDefaultFonts();
|
|
290
298
|
}
|
|
291
299
|
this._webworkerFileUrls = options.webworkerFileUrls;
|
|
292
300
|
this.registerWorkers(options.webworkerFileUrls);
|
|
@@ -500,16 +508,6 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
500
508
|
enumerable: false,
|
|
501
509
|
configurable: true
|
|
502
510
|
});
|
|
503
|
-
Object.defineProperty(AcApDocManager.prototype, "htmlViewerRuntimeUrl", {
|
|
504
|
-
/**
|
|
505
|
-
* URL of the offline HTML viewer runtime bundle used for HTML export.
|
|
506
|
-
*/
|
|
507
|
-
get: function () {
|
|
508
|
-
return this._htmlViewerRuntimeUrl;
|
|
509
|
-
},
|
|
510
|
-
enumerable: false,
|
|
511
|
-
configurable: true
|
|
512
|
-
});
|
|
513
511
|
/**
|
|
514
512
|
* Resolves colors for creating new entities.
|
|
515
513
|
*
|
|
@@ -775,7 +773,7 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
775
773
|
return [4 /*yield*/, acapWithSecondaryDatabase(db, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
776
774
|
return __generator(this, function (_a) {
|
|
777
775
|
switch (_a.label) {
|
|
778
|
-
case 0: return [4 /*yield*/, db.read(content, __assign({
|
|
776
|
+
case 0: return [4 /*yield*/, db.read(content, __assign({ readOnly: true }, options), fileExtension === 'dwg' ? AcDbFileType.DWG : AcDbFileType.DXF)];
|
|
779
777
|
case 1:
|
|
780
778
|
_a.sent();
|
|
781
779
|
return [2 /*return*/];
|
|
@@ -957,6 +955,15 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
957
955
|
this.curView.clear();
|
|
958
956
|
this.context.doc.database.regen();
|
|
959
957
|
};
|
|
958
|
+
/**
|
|
959
|
+
* Resolves the font repository URL from {@link baseUrl}.
|
|
960
|
+
*/
|
|
961
|
+
AcApDocManager.prototype.resolveFontsBaseUrl = function () {
|
|
962
|
+
var base = this._baseUrl.endsWith('/')
|
|
963
|
+
? this._baseUrl
|
|
964
|
+
: "".concat(this._baseUrl, "/");
|
|
965
|
+
return "".concat(base, "fonts/");
|
|
966
|
+
};
|
|
960
967
|
/**
|
|
961
968
|
* Search through all of the local and translated names in all of the command groups in the command stack
|
|
962
969
|
* starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
|
|
@@ -1202,37 +1209,103 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1202
1209
|
});
|
|
1203
1210
|
};
|
|
1204
1211
|
/**
|
|
1205
|
-
* Executes a command script
|
|
1212
|
+
* Executes a single command script and awaits completion.
|
|
1206
1213
|
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1214
|
+
* The first line is the command name; remaining lines are queued as inputs for
|
|
1215
|
+
* `getPoint` / `getKeywords` / etc. Lazy plugins are loaded via
|
|
1216
|
+
* {@link AcApPluginManager.loadByTrigger} when needed.
|
|
1217
|
+
*
|
|
1218
|
+
* Unlike {@link runScript}, leftover script inputs are cleared when the command
|
|
1219
|
+
* ends (interactive / one-shot behavior).
|
|
1209
1220
|
*
|
|
1210
1221
|
* @param cmdStr - Command script (first line is the command name)
|
|
1211
1222
|
*/
|
|
1212
1223
|
AcApDocManager.prototype.executeCommandString = function (cmdStr) {
|
|
1213
1224
|
return __awaiter(this, void 0, void 0, function () {
|
|
1214
|
-
var lines, _a, cmdName, scriptInputs
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
return __generator(this, function (_d) {
|
|
1218
|
-
switch (_d.label) {
|
|
1225
|
+
var lines, _a, cmdName, scriptInputs;
|
|
1226
|
+
return __generator(this, function (_b) {
|
|
1227
|
+
switch (_b.label) {
|
|
1219
1228
|
case 0:
|
|
1220
1229
|
lines = this.splitCommandScript(cmdStr);
|
|
1221
1230
|
if (!lines.length) {
|
|
1222
1231
|
throw new Error('Command string is empty');
|
|
1223
1232
|
}
|
|
1224
1233
|
_a = __read(lines), cmdName = _a[0], scriptInputs = _a.slice(1);
|
|
1234
|
+
this.editor.clearScriptInputs();
|
|
1235
|
+
this.editor.enqueueScriptInputs(scriptInputs);
|
|
1236
|
+
return [4 /*yield*/, this.executeNamedCommand(cmdName, { preserveScriptInputs: false })];
|
|
1237
|
+
case 1:
|
|
1238
|
+
_b.sent();
|
|
1239
|
+
return [2 /*return*/];
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* Runs a multi-command AutoCAD-style `.scr` script and awaits completion.
|
|
1246
|
+
*
|
|
1247
|
+
* Lines are parsed with {@link parseScriptLines}. The first non-blank line of
|
|
1248
|
+
* each command is the command name; subsequent lines feed prompts until the
|
|
1249
|
+
* command ends. Remaining queued lines become the next command. `QUIT` /
|
|
1250
|
+
* `EXIT` terminate the script.
|
|
1251
|
+
*
|
|
1252
|
+
* @param script - Full script text
|
|
1253
|
+
*/
|
|
1254
|
+
AcApDocManager.prototype.runScript = function (script) {
|
|
1255
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1256
|
+
var lines, cmdName;
|
|
1257
|
+
return __generator(this, function (_a) {
|
|
1258
|
+
switch (_a.label) {
|
|
1259
|
+
case 0:
|
|
1260
|
+
lines = parseScriptLines(script);
|
|
1261
|
+
this.editor.clearScriptInputs();
|
|
1262
|
+
this.editor.enqueueScriptInputs(lines);
|
|
1263
|
+
_a.label = 1;
|
|
1264
|
+
case 1:
|
|
1265
|
+
if (!this.editor.hasScriptInputs()) return [3 /*break*/, 3];
|
|
1266
|
+
cmdName = this.consumeNextScriptCommandName();
|
|
1267
|
+
if (cmdName == null) {
|
|
1268
|
+
return [3 /*break*/, 3];
|
|
1269
|
+
}
|
|
1270
|
+
if (isScriptQuitCommand(cmdName)) {
|
|
1271
|
+
this.editor.clearScriptInputs();
|
|
1272
|
+
return [3 /*break*/, 3];
|
|
1273
|
+
}
|
|
1274
|
+
return [4 /*yield*/, this.executeNamedCommand(cmdName, { preserveScriptInputs: true })];
|
|
1275
|
+
case 2:
|
|
1276
|
+
_a.sent();
|
|
1277
|
+
return [3 /*break*/, 1];
|
|
1278
|
+
case 3: return [2 /*return*/];
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
});
|
|
1282
|
+
};
|
|
1283
|
+
/**
|
|
1284
|
+
* Looks up and runs a registered command by name.
|
|
1285
|
+
*
|
|
1286
|
+
* When `preserveScriptInputs` is true (multi-command {@link runScript}), the
|
|
1287
|
+
* script input queue is left intact so the next command can continue from the
|
|
1288
|
+
* remaining lines. Otherwise the queue is cleared after the command finishes.
|
|
1289
|
+
*/
|
|
1290
|
+
AcApDocManager.prototype.executeNamedCommand = function (cmdName, options) {
|
|
1291
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1292
|
+
var documentMode, cmd, loaded, promise;
|
|
1293
|
+
var _this = this;
|
|
1294
|
+
var _a, _b;
|
|
1295
|
+
return __generator(this, function (_c) {
|
|
1296
|
+
switch (_c.label) {
|
|
1297
|
+
case 0:
|
|
1225
1298
|
documentMode = this.context.doc.openMode;
|
|
1226
|
-
cmd = (
|
|
1299
|
+
cmd = (_a = this._commandManager.lookupGlobalCmd(cmdName)) !== null && _a !== void 0 ? _a : this._commandManager.lookupLocalCmd(cmdName, documentMode);
|
|
1227
1300
|
if (!!cmd) return [3 /*break*/, 2];
|
|
1228
1301
|
return [4 /*yield*/, this._pluginManager.loadByTrigger(cmdName)];
|
|
1229
1302
|
case 1:
|
|
1230
|
-
loaded =
|
|
1303
|
+
loaded = _c.sent();
|
|
1231
1304
|
if (loaded) {
|
|
1232
1305
|
cmd =
|
|
1233
|
-
(
|
|
1306
|
+
(_b = this._commandManager.lookupGlobalCmd(cmdName)) !== null && _b !== void 0 ? _b : this._commandManager.lookupLocalCmd(cmdName, documentMode);
|
|
1234
1307
|
}
|
|
1235
|
-
|
|
1308
|
+
_c.label = 2;
|
|
1236
1309
|
case 2:
|
|
1237
1310
|
if (!cmd) {
|
|
1238
1311
|
throw new Error("Command '".concat(cmdName, "' not found"));
|
|
@@ -1251,37 +1324,56 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1251
1324
|
// starting this one. The previous command's pending prompt is rejected
|
|
1252
1325
|
// with `AcEdPromptStatus.Cancel`, and we await its `trigger()` settlement
|
|
1253
1326
|
// so its `commandEnded` lifecycle finishes before the new one begins.
|
|
1254
|
-
|
|
1255
|
-
this.editor.clearScriptInputs();
|
|
1256
|
-
this.editor.enqueueScriptInputs(scriptInputs);
|
|
1327
|
+
_c.sent();
|
|
1257
1328
|
promise = cmd.trigger(this.context).finally(function () {
|
|
1258
|
-
|
|
1329
|
+
if (!options.preserveScriptInputs) {
|
|
1330
|
+
_this.editor.clearScriptInputs();
|
|
1331
|
+
}
|
|
1259
1332
|
_this._commandManager.clearActive(cmd);
|
|
1260
1333
|
});
|
|
1261
1334
|
this._commandManager.markActive(cmd, this.curView, promise);
|
|
1262
1335
|
return [4 /*yield*/, promise];
|
|
1263
1336
|
case 4:
|
|
1264
|
-
|
|
1337
|
+
_c.sent();
|
|
1265
1338
|
return [2 /*return*/];
|
|
1266
1339
|
}
|
|
1267
1340
|
});
|
|
1268
1341
|
});
|
|
1269
1342
|
};
|
|
1343
|
+
/**
|
|
1344
|
+
* Consumes blank lines, then returns the next non-blank script token as a
|
|
1345
|
+
* command name. Returns `undefined` when the queue is exhausted.
|
|
1346
|
+
*/
|
|
1347
|
+
AcApDocManager.prototype.consumeNextScriptCommandName = function () {
|
|
1348
|
+
while (this.editor.hasScriptInputs()) {
|
|
1349
|
+
var token = this.editor.consumeScriptInput();
|
|
1350
|
+
if (token == null) {
|
|
1351
|
+
return undefined;
|
|
1352
|
+
}
|
|
1353
|
+
var trimmed = token.trim();
|
|
1354
|
+
if (trimmed) {
|
|
1355
|
+
return trimmed;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
return undefined;
|
|
1359
|
+
};
|
|
1270
1360
|
/**
|
|
1271
1361
|
* Splits command script into Enter-separated values.
|
|
1272
1362
|
* First line is command name, remaining lines are queued inputs for getXXX.
|
|
1273
1363
|
*/
|
|
1274
1364
|
AcApDocManager.prototype.splitCommandScript = function (commandScript) {
|
|
1275
|
-
var
|
|
1276
|
-
? commandScript
|
|
1277
|
-
: commandScript.replace(/\\n/g, '\n');
|
|
1278
|
-
var lines = source.replace(/\r\n/g, '\n').split('\n');
|
|
1365
|
+
var lines = parseScriptLines(commandScript);
|
|
1279
1366
|
if (!lines.length)
|
|
1280
1367
|
return [];
|
|
1281
|
-
|
|
1282
|
-
|
|
1368
|
+
// Skip leading blank / comment-stripped empties to find the command name.
|
|
1369
|
+
var start = 0;
|
|
1370
|
+
while (start < lines.length && !lines[start].trim()) {
|
|
1371
|
+
start++;
|
|
1372
|
+
}
|
|
1373
|
+
if (start >= lines.length)
|
|
1283
1374
|
return [];
|
|
1284
|
-
|
|
1375
|
+
var cmdName = lines[start].trim();
|
|
1376
|
+
return __spreadArray([cmdName], __read(lines.slice(start + 1)), false);
|
|
1285
1377
|
};
|
|
1286
1378
|
/**
|
|
1287
1379
|
* Configures layout information for the current view.
|
|
@@ -1304,7 +1396,7 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1304
1396
|
* @protected
|
|
1305
1397
|
*/
|
|
1306
1398
|
AcApDocManager.prototype.onBeforeOpenDocument = function (options) {
|
|
1307
|
-
var _a;
|
|
1399
|
+
var _a, _b;
|
|
1308
1400
|
this.events.documentToBeOpened.dispatch({
|
|
1309
1401
|
doc: this.context.doc,
|
|
1310
1402
|
mode: this.getDocumentEventMode(options)
|
|
@@ -1315,6 +1407,7 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1315
1407
|
this.curView.bindDrawDatabase(this.context.doc.database);
|
|
1316
1408
|
this.curView.progressiveRendering =
|
|
1317
1409
|
(_a = options === null || options === void 0 ? void 0 : options.progressiveRendering) !== null && _a !== void 0 ? _a : false;
|
|
1410
|
+
this._openFileProgress.setSeeThroughOverlay((_b = options === null || options === void 0 ? void 0 : options.progressiveRendering) !== null && _b !== void 0 ? _b : false);
|
|
1318
1411
|
this.curView.clear();
|
|
1319
1412
|
// OPENPROF: start stage timings before db.read / entity flush.
|
|
1320
1413
|
this._openFileProfiler.begin(this.context.doc.database);
|
|
@@ -1430,6 +1523,7 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1430
1523
|
}
|
|
1431
1524
|
else {
|
|
1432
1525
|
this._openFileProfiler.cancel();
|
|
1526
|
+
this.curView.endProgressiveOpenFit();
|
|
1433
1527
|
this.regen();
|
|
1434
1528
|
}
|
|
1435
1529
|
};
|
|
@@ -1482,26 +1576,22 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1482
1576
|
/**
|
|
1483
1577
|
* Sets up or validates database opening options.
|
|
1484
1578
|
*
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1487
|
-
* If options are provided but missing a font loader, adds the font loader.
|
|
1579
|
+
* Fonts are not loaded during open; {@link FontManager.lazyFontLoading}
|
|
1580
|
+
* fetches them on demand while text is drawn.
|
|
1488
1581
|
*
|
|
1489
1582
|
* @param options - Optional database opening options to validate/modify
|
|
1490
|
-
* @returns The validated options object
|
|
1583
|
+
* @returns The validated options object
|
|
1491
1584
|
* @private
|
|
1492
1585
|
*/
|
|
1493
1586
|
AcApDocManager.prototype.setOptions = function (options) {
|
|
1494
1587
|
if (options == null) {
|
|
1495
1588
|
options = {
|
|
1496
|
-
fontLoader: this._fontLoader,
|
|
1497
1589
|
drawNoPlotLayers: false,
|
|
1498
1590
|
progressiveRendering: false
|
|
1499
1591
|
};
|
|
1500
1592
|
}
|
|
1501
1593
|
else {
|
|
1502
|
-
|
|
1503
|
-
options.fontLoader = this._fontLoader;
|
|
1504
|
-
}
|
|
1594
|
+
this.stripObsoleteFontOpenOptions(options);
|
|
1505
1595
|
if (options.drawNoPlotLayers == null) {
|
|
1506
1596
|
options.drawNoPlotLayers = false;
|
|
1507
1597
|
}
|
|
@@ -1511,6 +1601,28 @@ var AcApDocManager = /** @class */ (function () {
|
|
|
1511
1601
|
}
|
|
1512
1602
|
return options;
|
|
1513
1603
|
};
|
|
1604
|
+
/**
|
|
1605
|
+
* Removes removed open-time font options that integrators may still pass via
|
|
1606
|
+
* cast/spread so they cannot silently affect `db.read`.
|
|
1607
|
+
*/
|
|
1608
|
+
AcApDocManager.prototype.stripObsoleteFontOpenOptions = function (options) {
|
|
1609
|
+
var legacy = options;
|
|
1610
|
+
var hadFontLoader = legacy.fontLoader != null;
|
|
1611
|
+
var hadFailOnFontLoadError = legacy.failOnFontLoadError != null;
|
|
1612
|
+
if (!hadFontLoader && !hadFailOnFontLoadError) {
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
delete legacy.fontLoader;
|
|
1616
|
+
delete legacy.failOnFontLoadError;
|
|
1617
|
+
console.warn('[AcApDocManager] Ignoring obsolete open options ' +
|
|
1618
|
+
[
|
|
1619
|
+
hadFontLoader ? 'fontLoader' : null,
|
|
1620
|
+
hadFailOnFontLoadError ? 'failOnFontLoadError' : null
|
|
1621
|
+
]
|
|
1622
|
+
.filter(Boolean)
|
|
1623
|
+
.join(', ') +
|
|
1624
|
+
'; fonts load on demand via FontManager.lazyFontLoading.');
|
|
1625
|
+
};
|
|
1514
1626
|
/**
|
|
1515
1627
|
* Resolves the open mode used in document lifecycle events.
|
|
1516
1628
|
*
|