@mlightcad/cad-simple-viewer 1.5.0 → 1.5.2
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 +2 -1
- package/dist/index.js +25678 -48997
- package/dist/index.umd.cjs +571 -603
- package/dist/libredwg-parser-worker.js +3955 -7422
- package/dist/mtext-renderer-worker.js +2727 -2539
- package/lib/app/AcApAnnotation.js +4 -4
- package/lib/app/AcApAnnotation.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +56 -2
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +182 -31
- package/lib/app/AcApDocManager.js.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/app/openFileProgress.d.ts +10 -0
- package/lib/app/openFileProgress.d.ts.map +1 -0
- package/lib/app/openFileProgress.js +20 -0
- package/lib/app/openFileProgress.js.map +1 -0
- package/lib/command/AcApSwitchBgCmd.d.ts +3 -0
- package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -1
- package/lib/command/AcApSwitchBgCmd.js +14 -7
- package/lib/command/AcApSwitchBgCmd.js.map +1 -1
- package/lib/command/AcApZoomCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomCmd.js +3 -3
- package/lib/command/AcApZoomCmd.js.map +1 -1
- package/lib/command/convert/index.d.ts +0 -1
- package/lib/command/convert/index.d.ts.map +1 -1
- package/lib/command/convert/index.js +0 -1
- package/lib/command/convert/index.js.map +1 -1
- package/lib/command/draw/AcApArcCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApArcCmd.js +47 -20
- package/lib/command/draw/AcApArcCmd.js.map +1 -1
- package/lib/command/draw/AcApCircleCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApCircleCmd.js +5 -6
- package/lib/command/draw/AcApCircleCmd.js.map +1 -1
- package/lib/command/draw/AcApEllipseCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApEllipseCmd.js +4 -6
- package/lib/command/draw/AcApEllipseCmd.js.map +1 -1
- package/lib/command/draw/AcApMLineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApMLineCmd.js +4 -7
- package/lib/command/draw/AcApMLineCmd.js.map +1 -1
- package/lib/command/draw/AcApMTextCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApMTextCmd.js +3 -1
- package/lib/command/draw/AcApMTextCmd.js.map +1 -1
- package/lib/command/draw/AcApPolygonCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApPolygonCmd.js +4 -5
- package/lib/command/draw/AcApPolygonCmd.js.map +1 -1
- package/lib/command/draw/AcApPolylineCmd.d.ts +49 -0
- package/lib/command/draw/AcApPolylineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApPolylineCmd.js +200 -18
- package/lib/command/draw/AcApPolylineCmd.js.map +1 -1
- package/lib/command/draw/AcApRayCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApRayCmd.js +2 -3
- package/lib/command/draw/AcApRayCmd.js.map +1 -1
- package/lib/command/draw/AcApRectCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApRectCmd.js +10 -10
- package/lib/command/draw/AcApRectCmd.js.map +1 -1
- package/lib/command/draw/AcApSplineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApSplineCmd.js +3 -6
- package/lib/command/draw/AcApSplineCmd.js.map +1 -1
- package/lib/command/draw/AcApXLineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApXLineCmd.js +2 -3
- package/lib/command/draw/AcApXLineCmd.js.map +1 -1
- package/lib/command/measure/AcApClearMeasurementsCmd.d.ts +11 -0
- package/lib/command/measure/AcApClearMeasurementsCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApClearMeasurementsCmd.js +15 -4
- package/lib/command/measure/AcApClearMeasurementsCmd.js.map +1 -1
- package/lib/command/measure/AcApMeasureAngleCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureAngleCmd.js +15 -6
- package/lib/command/measure/AcApMeasureAngleCmd.js.map +1 -1
- package/lib/command/measure/AcApMeasureArcCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureArcCmd.js +11 -4
- package/lib/command/measure/AcApMeasureArcCmd.js.map +1 -1
- package/lib/command/measure/AcApMeasureAreaCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureAreaCmd.js +11 -4
- package/lib/command/measure/AcApMeasureAreaCmd.js.map +1 -1
- package/lib/command/measure/AcApMeasureDistanceCmd.d.ts +3 -2
- package/lib/command/measure/AcApMeasureDistanceCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureDistanceCmd.js +14 -6
- package/lib/command/measure/AcApMeasureDistanceCmd.js.map +1 -1
- package/lib/command/modify/AcApOffsetCmd.d.ts +30 -0
- package/lib/command/modify/AcApOffsetCmd.d.ts.map +1 -0
- package/lib/command/modify/AcApOffsetCmd.js +425 -0
- package/lib/command/modify/AcApOffsetCmd.js.map +1 -0
- package/lib/command/modify/AcApRotateCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApRotateCmd.js +3 -4
- package/lib/command/modify/AcApRotateCmd.js.map +1 -1
- package/lib/command/modify/index.d.ts +1 -0
- package/lib/command/modify/index.d.ts.map +1 -1
- package/lib/command/modify/index.js +1 -0
- package/lib/command/modify/index.js.map +1 -1
- package/lib/command/review/AcApRevCircleCmd.d.ts.map +1 -1
- package/lib/command/review/AcApRevCircleCmd.js +4 -1
- package/lib/command/review/AcApRevCircleCmd.js.map +1 -1
- package/lib/editor/global/AcEdUiColor.d.ts +183 -0
- package/lib/editor/global/AcEdUiColor.d.ts.map +1 -0
- package/lib/editor/global/AcEdUiColor.js +224 -0
- package/lib/editor/global/AcEdUiColor.js.map +1 -0
- package/lib/editor/global/AcEdUiTheme.d.ts +0 -1
- package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -1
- package/lib/editor/global/AcEdUiTheme.js +0 -5
- package/lib/editor/global/AcEdUiTheme.js.map +1 -1
- package/lib/editor/global/eventBus.d.ts +3 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js.map +1 -1
- package/lib/editor/global/index.d.ts +1 -0
- package/lib/editor/global/index.d.ts.map +1 -1
- package/lib/editor/global/index.js +1 -0
- package/lib/editor/global/index.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +4 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +11 -8
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdOrthoMode.d.ts +11 -0
- package/lib/editor/input/AcEdOrthoMode.d.ts.map +1 -0
- package/lib/editor/input/AcEdOrthoMode.js +22 -0
- package/lib/editor/input/AcEdOrthoMode.js.map +1 -0
- package/lib/editor/input/AcEdPolarTracking.d.ts +107 -0
- package/lib/editor/input/AcEdPolarTracking.d.ts.map +1 -0
- package/lib/editor/input/AcEdPolarTracking.js +398 -0
- package/lib/editor/input/AcEdPolarTracking.js.map +1 -0
- package/lib/editor/input/AcEdSelectionFilter.js +7 -6
- package/lib/editor/input/AcEdSelectionFilter.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +4 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +6 -0
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/index.d.ts +2 -0
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +2 -0
- package/lib/editor/input/index.js.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.js +3 -2
- package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +4 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -1
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +11 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +1 -1
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +13 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.js +48 -3
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +5 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingMessage.js +1 -1
- package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +25 -6
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +164 -63
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts +67 -2
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.js +213 -21
- package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -1
- package/lib/editor/input/ui/AcEdRubberBand.d.ts +8 -0
- package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdRubberBand.js +62 -37
- package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
- package/lib/i18n/en/command.d.ts +71 -11
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +74 -14
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +8 -0
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +8 -0
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +71 -11
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +74 -14
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +8 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +8 -0
- package/lib/i18n/zh/jig.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/plugin/AcApLazyPluginRegistration.d.ts +28 -0
- package/lib/plugin/AcApLazyPluginRegistration.d.ts.map +1 -0
- package/lib/plugin/AcApLazyPluginRegistration.js +2 -0
- package/lib/plugin/AcApLazyPluginRegistration.js.map +1 -0
- package/lib/plugin/AcApPluginManager.d.ts +38 -0
- package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
- package/lib/plugin/AcApPluginManager.js +147 -22
- package/lib/plugin/AcApPluginManager.js.map +1 -1
- package/lib/plugin/index.d.ts +1 -0
- package/lib/plugin/index.d.ts.map +1 -1
- package/lib/plugin/index.js +1 -0
- package/lib/plugin/index.js.map +1 -1
- package/lib/util/AcApExportFileNameUtil.d.ts +22 -0
- package/lib/util/AcApExportFileNameUtil.d.ts.map +1 -0
- package/lib/util/AcApExportFileNameUtil.js +49 -0
- package/lib/util/AcApExportFileNameUtil.js.map +1 -0
- package/lib/util/AcApFontUtil.d.ts +79 -0
- package/lib/util/AcApFontUtil.d.ts.map +1 -0
- package/lib/util/AcApFontUtil.js +173 -0
- package/lib/util/AcApFontUtil.js.map +1 -0
- package/lib/util/index.d.ts +3 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +3 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/yieldToMain.d.ts +5 -0
- package/lib/util/yieldToMain.d.ts.map +1 -0
- package/lib/util/yieldToMain.js +11 -0
- package/lib/util/yieldToMain.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +13 -1
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +20 -1
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +3 -1
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
- package/lib/view/AcTrLayoutViewManager.js +4 -2
- package/lib/view/AcTrLayoutViewManager.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +38 -6
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +57 -30
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +184 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +657 -104
- 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 +12 -9
- package/lib/command/convert/AcApConvertToSvgCmd.d.ts +0 -32
- package/lib/command/convert/AcApConvertToSvgCmd.d.ts.map +0 -1
- package/lib/command/convert/AcApConvertToSvgCmd.js +0 -98
- package/lib/command/convert/AcApConvertToSvgCmd.js.map +0 -1
- package/lib/command/convert/AcApSvgConvertor.d.ts +0 -53
- package/lib/command/convert/AcApSvgConvertor.d.ts.map +0 -1
- package/lib/command/convert/AcApSvgConvertor.js +0 -103
- package/lib/command/convert/AcApSvgConvertor.js.map +0 -1
package/lib/view/AcTrView2d.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AcDbEntity, AcDbLayerTableRecord, AcDbLayerTableRecordAttrs, AcDbLayout, AcDbObjectId, AcGeBox2d, AcGeBox3d, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
|
|
1
|
+
import { AcDbDatabase, AcDbEntity, AcDbLayerTableRecord, AcDbLayerTableRecordAttrs, AcDbLayout, AcDbObjectId, AcGeBox2d, AcGeBox3d, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
|
|
2
2
|
import { AcTrHtmlTransientManager, AcTrRenderer } from '@mlightcad/three-renderer';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import { AcEdBaseView, AcEdCalculateSizeCallback, AcEdSpatialQueryResultItemEx, AcEdViewMode } from '../editor';
|
|
@@ -74,6 +74,37 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
74
74
|
private _numOfEntitiesToProcess;
|
|
75
75
|
/** CSS2D renderer for HTML transient overlays */
|
|
76
76
|
private _css2dRenderer;
|
|
77
|
+
/**
|
|
78
|
+
* Block table record ids of layouts whose entities are currently being
|
|
79
|
+
* batch-converted into the scene. Used by
|
|
80
|
+
* {@link AcTrView2d.loadLayoutEntitiesIfNeeded} to guard against
|
|
81
|
+
* re-entrant calls before the `setTimeout` callback flips
|
|
82
|
+
* `AcTrLayout.isLoaded` to `true`, which would otherwise duplicate
|
|
83
|
+
* entities when the same layout tab is clicked twice in quick succession.
|
|
84
|
+
*/
|
|
85
|
+
private _loadingLayouts;
|
|
86
|
+
/**
|
|
87
|
+
* Block table record ids of layouts that have already received an
|
|
88
|
+
* initial zoom-to-fit. Used by the `layoutSwitched` handler to apply
|
|
89
|
+
* the auto-zoom **only on the first user visit** to each layout, and
|
|
90
|
+
* to preserve the camera state on subsequent visits (matches AutoCAD's
|
|
91
|
+
* per-tab view persistence).
|
|
92
|
+
*
|
|
93
|
+
* Cannot be inferred from `_layoutViewManager.has(btrId)` because
|
|
94
|
+
* `addLayout` pre-creates an `AcTrLayoutView` for every layout in the
|
|
95
|
+
* DWG at document load time — by the time the user clicks a layout
|
|
96
|
+
* tab the view already exists, so "first existence of view" is
|
|
97
|
+
* always false. This set tracks the orthogonal question "has the user
|
|
98
|
+
* actually focused on this layout before?".
|
|
99
|
+
*
|
|
100
|
+
* Marked from two entry points:
|
|
101
|
+
* - `onAfterOpenDocument` (via `markLayoutAsInitialized`): the
|
|
102
|
+
* document's startup layout is initialized externally, so we don't
|
|
103
|
+
* auto-zoom again when the user clicks back to it.
|
|
104
|
+
* - `layoutSwitched` handler: after the first user-driven switch
|
|
105
|
+
* completes its initial zoom-to-fit.
|
|
106
|
+
*/
|
|
107
|
+
private _initializedLayouts;
|
|
77
108
|
/**
|
|
78
109
|
* Creates a new 2D CAD viewer instance.
|
|
79
110
|
*
|
|
@@ -148,6 +179,23 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
148
179
|
* @param value - The background color as a 24-bit hexadecimal RGB number
|
|
149
180
|
*/
|
|
150
181
|
set backgroundColor(value: number);
|
|
182
|
+
/**
|
|
183
|
+
* Applies canvas background colour from layout background sysvars or explicit
|
|
184
|
+
* API calls. Also refreshes ACI-7 foreground inversion via the style
|
|
185
|
+
* manager. Does not touch `COLORTHEME` / UI chrome.
|
|
186
|
+
*/
|
|
187
|
+
private applyCanvasBackground;
|
|
188
|
+
private isModelSpaceLayout;
|
|
189
|
+
/**
|
|
190
|
+
* Re-reads layout background sysvars from the active database. Called after
|
|
191
|
+
* a document is opened so DWG-stored values take effect.
|
|
192
|
+
*/
|
|
193
|
+
syncDisplaySysVars(database: AcDbDatabase): void;
|
|
194
|
+
/**
|
|
195
|
+
* Re-apply canvas background after a layout tab switch using the sysvar for
|
|
196
|
+
* the newly active layout (model or paper space).
|
|
197
|
+
*/
|
|
198
|
+
private refreshCanvasBackgroundForActiveLayout;
|
|
151
199
|
/**
|
|
152
200
|
* The block table record id of the model space
|
|
153
201
|
*/
|
|
@@ -166,6 +214,10 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
166
214
|
* The statistics of the current scene
|
|
167
215
|
*/
|
|
168
216
|
get stats(): import("./AcTrScene").AcTrSceneStats;
|
|
217
|
+
/**
|
|
218
|
+
* CAD scene graph used for rendering and HTML export.
|
|
219
|
+
*/
|
|
220
|
+
get cadScene(): AcTrScene;
|
|
169
221
|
/**
|
|
170
222
|
* The internal THREE scene used by this view.
|
|
171
223
|
*/
|
|
@@ -215,10 +267,53 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
215
267
|
* @inheritdoc
|
|
216
268
|
*/
|
|
217
269
|
flyTo(point: AcGePoint2dLike, scale: number): void;
|
|
270
|
+
private openPickedMTextEditor;
|
|
271
|
+
private editMTextEntity;
|
|
272
|
+
private resolveMTextEditorWidth;
|
|
273
|
+
private resolveMTextEditorTextHeight;
|
|
274
|
+
private pixelsToWorldY;
|
|
275
|
+
private getMTextToolbarFontFamilies;
|
|
218
276
|
/**
|
|
219
277
|
* @inheritdoc
|
|
278
|
+
*
|
|
279
|
+
* In **paper space** layouts the selection pipeline supports
|
|
280
|
+
* "drill-through": clicks inside a viewport rectangle resolve against
|
|
281
|
+
* the model-space entities that are visually rendered through that
|
|
282
|
+
* viewport, rather than picking the viewport's border. Clicks **near**
|
|
283
|
+
* the border still pick the `AcDbViewport` entity itself so the user
|
|
284
|
+
* can grip, move, lock or delete the viewport.
|
|
285
|
+
*
|
|
286
|
+
* This mirrors AutoCAD **web** behaviour (single-click selection of
|
|
287
|
+
* model content through the viewport). The desktop ARX behaviour
|
|
288
|
+
* (explicit MSPACE/PSPACE modes, CVPORT system variable, double-click
|
|
289
|
+
* to enter mspace) is a separate, larger feature — tracked in
|
|
290
|
+
* `.claude/plans/next_14_viewports_full.md` PR-γ Option A. We
|
|
291
|
+
* intentionally do **not** implement it here.
|
|
292
|
+
*
|
|
293
|
+
* The border vs interior decision uses a tolerance derived from
|
|
294
|
+
* `selectionBoxSize` (the same pixel-sized hit radius used elsewhere
|
|
295
|
+
* in pick) converted to paper-space WCS via `pointToBox`. This keeps
|
|
296
|
+
* the gesture consistent with how other entity edges behave — you
|
|
297
|
+
* don't have to land pixel-perfect on the viewport line to grab it.
|
|
220
298
|
*/
|
|
221
299
|
pick(point?: AcGePoint2dLike, hitRadius?: number, pickOneOnly?: boolean): AcEdSpatialQueryResultItemEx[];
|
|
300
|
+
/**
|
|
301
|
+
* Resolves hits against the model-space layout for each viewport the
|
|
302
|
+
* click drills through. Appends the matches into `results` (caller
|
|
303
|
+
* sorts/dedups). Kept private and separate from `pick` so the main
|
|
304
|
+
* pick path stays a single straight read.
|
|
305
|
+
*
|
|
306
|
+
* Each viewport gets its own raycaster shot (using the viewport view's
|
|
307
|
+
* own camera, which is zoomed to `viewport.viewBox` in model WCS), so
|
|
308
|
+
* a click that lands in overlapping viewports correctly resolves
|
|
309
|
+
* against each viewport's particular model framing.
|
|
310
|
+
*
|
|
311
|
+
* `pickThroughViewports` does NOT consult the active (paper) layout's
|
|
312
|
+
* spatial index — that work is already done by the caller. It only
|
|
313
|
+
* adds model-space results that would otherwise be invisible to the
|
|
314
|
+
* paper-space pick.
|
|
315
|
+
*/
|
|
316
|
+
private pickThroughViewports;
|
|
222
317
|
/**
|
|
223
318
|
* @inheritdoc
|
|
224
319
|
*/
|
|
@@ -265,6 +360,57 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
265
360
|
* @inheritdoc
|
|
266
361
|
*/
|
|
267
362
|
addLayout(layout: AcDbLayout): void;
|
|
363
|
+
/**
|
|
364
|
+
* Marks a layout as already framed by an external caller (typically
|
|
365
|
+
* `AcApDocManager.onAfterOpenDocument`, which zooms the startup
|
|
366
|
+
* layout right after parsing). Subsequent `layoutSwitched` events
|
|
367
|
+
* for this btrId will skip their initial zoom-to-fit so the user's
|
|
368
|
+
* camera state on the startup layout is preserved when they click
|
|
369
|
+
* back to that tab.
|
|
370
|
+
*
|
|
371
|
+
* This is the public counterpart of the `_initializedLayouts` set —
|
|
372
|
+
* exposed so the application layer can stay in sync with the view's
|
|
373
|
+
* notion of "which layouts have been framed already" without
|
|
374
|
+
* needing access to private state.
|
|
375
|
+
*/
|
|
376
|
+
markLayoutAsInitialized(layoutBtrId: AcDbObjectId): void;
|
|
377
|
+
/**
|
|
378
|
+
* Applies the initial zoom-to-fit for a layout the user just switched
|
|
379
|
+
* into for the first time. Picks the best available "what should the
|
|
380
|
+
* camera frame?" signal in this order:
|
|
381
|
+
*
|
|
382
|
+
* 1. **`AcDbLayout.limits`** (LIMMIN/LIMMAX) — only when it actually
|
|
383
|
+
* contains the layout's viewports. Many real DWGs ship with garbage
|
|
384
|
+
* limits (e.g. `(0,0)-(12,9)` from a legacy template setup) that
|
|
385
|
+
* don't reflect the actual paper sheet. We reject those by
|
|
386
|
+
* checking containment against `viewportsBoundingBox`.
|
|
387
|
+
*
|
|
388
|
+
* 2. **`AcTrLayoutView.viewportsBoundingBox`** — bounding box of all
|
|
389
|
+
* real user viewports in the layout. In production sheets viewports
|
|
390
|
+
* typically span 70-90% of the paper, so this is a great proxy for
|
|
391
|
+
* the printable area and (crucially) ignores outliers like title
|
|
392
|
+
* blocks authored in a different unit/scale.
|
|
393
|
+
*
|
|
394
|
+
* 3. **`AcDbLayout.extents`** — the layout's own EXTMIN/EXTMAX, if
|
|
395
|
+
* populated. Many parsers leave this empty (we've seen `(0,0)-(0,0)`),
|
|
396
|
+
* so it sits below the viewport-based heuristic.
|
|
397
|
+
*
|
|
398
|
+
* 4. **`zoomToFitDrawing`** (entity extents from spatial index) —
|
|
399
|
+
* last-resort fallback for layouts with no viewports and no
|
|
400
|
+
* sensible limits/extents (e.g. a freshly created empty paper).
|
|
401
|
+
* Vulnerable to scale-mismatch outliers, but better than no zoom.
|
|
402
|
+
*
|
|
403
|
+
* **Critically, this runs through `AcEdConditionWaiter`**: at the
|
|
404
|
+
* moment `layoutSwitched` fires, the layout's entities (including its
|
|
405
|
+
* `AcDbViewport`s) have not yet been batch-converted into the scene
|
|
406
|
+
* — `loadLayoutEntitiesIfNeeded` chunked-converts via `setTimeout`.
|
|
407
|
+
* Without the waiter, `viewportsBoundingBox` returns undefined and
|
|
408
|
+
* the strategy degrades into (1) zooming to garbage `limits`, or
|
|
409
|
+
* (4) zooming to an empty scene box. The waiter polls
|
|
410
|
+
* `_numOfEntitiesToProcess` and only fires the heuristic once the
|
|
411
|
+
* conversion is done.
|
|
412
|
+
*/
|
|
413
|
+
private applyInitialZoom;
|
|
268
414
|
/**
|
|
269
415
|
* @inheritdoc
|
|
270
416
|
*/
|
|
@@ -299,6 +445,22 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
299
445
|
/**
|
|
300
446
|
* Load entities from the specified layout if they haven't been loaded yet.
|
|
301
447
|
* This ensures that when switching to a layout, all its entities are available for rendering.
|
|
448
|
+
*
|
|
449
|
+
* Two non-obvious invariants are enforced here:
|
|
450
|
+
*
|
|
451
|
+
* 1. The layout is looked up by `layoutBtrId` (the argument), not by
|
|
452
|
+
* `this._scene.activeLayout`. The active layout reference happens to
|
|
453
|
+
* match in the current `layoutSwitched` handler call site, but relying
|
|
454
|
+
* on it would silently miss layouts that are pre-loaded ahead of
|
|
455
|
+
* becoming active (e.g. background prefetch).
|
|
456
|
+
* 2. The `_loadingLayouts` guard prevents re-entrance while the
|
|
457
|
+
* `setTimeout` chunked-convert callback is still in flight. Without it,
|
|
458
|
+
* clicking the same layout tab twice in quick succession (or
|
|
459
|
+
* `layoutSwitched` firing twice during the async window) would iterate
|
|
460
|
+
* the block table record again and duplicate every entity in the
|
|
461
|
+
* layout — visible as ghosted overdraw and double the spatial-index
|
|
462
|
+
* weight.
|
|
463
|
+
*
|
|
302
464
|
* @param layoutBtrId Input the block table record id of the layout
|
|
303
465
|
*/
|
|
304
466
|
private loadLayoutEntitiesIfNeeded;
|
|
@@ -309,6 +471,27 @@ export declare class AcTrView2d extends AcEdBaseView {
|
|
|
309
471
|
*/
|
|
310
472
|
private toggleStatsVisibility;
|
|
311
473
|
private drawEntity;
|
|
474
|
+
/**
|
|
475
|
+
* Walks the given block table record once and creates one
|
|
476
|
+
* `AcTrViewportView` for every real `AcDbViewport` entity it finds
|
|
477
|
+
* (skipping the default paper-space viewport that is filtered
|
|
478
|
+
* everywhere else by `AcTrViewportView.isDefaultPaperSpaceViewport`).
|
|
479
|
+
*
|
|
480
|
+
* This is the recovery pass for paper-space layouts whose viewport
|
|
481
|
+
* entities reached `batchConvert` before the `AcTrLayoutView` was
|
|
482
|
+
* created — those entities were drawn and added to the scene, but
|
|
483
|
+
* the viewport-view creation step silently no-oped (lookup returned
|
|
484
|
+
* undefined). Without this recovery, `viewportsBoundingBox` stays
|
|
485
|
+
* `undefined` on first user visit, the initial-zoom strategy
|
|
486
|
+
* degrades to the bogus `limits` branch, and the layout renders as
|
|
487
|
+
* a "grain in the corner" with empty viewport scissors. See the
|
|
488
|
+
* call site in `loadLayoutEntitiesIfNeeded` for the full context.
|
|
489
|
+
*
|
|
490
|
+
* Cheap operation: only AcDbViewport entities are inspected; for a
|
|
491
|
+
* typical sheet that's a handful of entities even on 5000-entity
|
|
492
|
+
* paper layouts.
|
|
493
|
+
*/
|
|
494
|
+
private ensureViewportViews;
|
|
312
495
|
/**
|
|
313
496
|
* Converts the specified database entities to three entities
|
|
314
497
|
* @param entities - The database entities
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcTrView2d.d.ts","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AcTrView2d.d.ts","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,UAAU,EAEV,oBAAoB,EACpB,yBAAyB,EACzB,UAAU,EAEV,YAAY,EAMZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,eAAe,EAGhB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAGL,wBAAwB,EACxB,YAAY,EAKb,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EACL,YAAY,EACZ,yBAAyB,EAMzB,4BAA4B,EAC5B,YAAY,EAGb,MAAM,WAAW,C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