@mlightcad/cad-simple-viewer 1.7.6 → 1.7.7-preview.1
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/LICENSE +21 -21
- package/README.md +190 -190
- package/dist/cad-simple-viewer.js +5959 -5771
- package/dist/cad-simple-viewer.umd.cjs +114 -114
- package/dist/mtext-renderer-worker.js +14124 -8730
- package/find.ts +7 -7
- package/icons.ts +7 -7
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +56 -66
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApOpenDatabaseOptions.d.ts +8 -2
- package/lib/app/AcApOpenDatabaseOptions.d.ts.map +1 -1
- package/lib/command/convert/AcApEntityPreviewCmd.d.ts.map +1 -1
- package/lib/command/convert/AcApEntityPreviewCmd.js +1 -0
- package/lib/command/convert/AcApEntityPreviewCmd.js.map +1 -1
- package/lib/command/convert/AcApRasterImageConvertor.d.ts +17 -8
- package/lib/command/convert/AcApRasterImageConvertor.d.ts.map +1 -1
- package/lib/command/convert/AcApRasterImageConvertor.js +50 -12
- package/lib/command/convert/AcApRasterImageConvertor.js.map +1 -1
- package/lib/command/draw/AcApHatchCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApHatchCmd.js +1 -0
- package/lib/command/draw/AcApHatchCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerIsoCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerIsoCmd.js +1 -0
- package/lib/command/layer/AcApLayerIsoCmd.js.map +1 -1
- package/lib/editor/grip/AcEdGripEditSession.d.ts.map +1 -1
- package/lib/editor/grip/AcEdGripEditSession.js +6 -1
- package/lib/editor/grip/AcEdGripEditSession.js.map +1 -1
- package/lib/editor/grip/AcEdGripManager.d.ts.map +1 -1
- package/lib/editor/grip/AcEdGripManager.js +2 -1
- package/lib/editor/grip/AcEdGripManager.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +8 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +16 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +6 -6
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts +7 -6
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.js +33 -2
- package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +16 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +38 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/i18n/ar/main.d.ts +1 -0
- package/lib/i18n/ar/main.d.ts.map +1 -1
- package/lib/i18n/ar/main.js +1 -0
- package/lib/i18n/ar/main.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/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/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/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/service/AcApEntitySelection.d.ts.map +1 -1
- package/lib/service/AcApEntitySelection.js +34 -4
- package/lib/service/AcApEntitySelection.js.map +1 -1
- package/lib/service/AcApEntityService.d.ts.map +1 -1
- package/lib/service/AcApEntityService.js +11 -0
- package/lib/service/AcApEntityService.js.map +1 -1
- package/lib/service/AcApLayerService.d.ts +8 -1
- package/lib/service/AcApLayerService.d.ts.map +1 -1
- package/lib/service/AcApLayerService.js +10 -0
- package/lib/service/AcApLayerService.js.map +1 -1
- package/lib/service/AcApLockedLayer.d.ts +23 -0
- package/lib/service/AcApLockedLayer.d.ts.map +1 -0
- package/lib/service/AcApLockedLayer.js +94 -0
- package/lib/service/AcApLockedLayer.js.map +1 -0
- package/lib/service/index.d.ts +1 -0
- package/lib/service/index.d.ts.map +1 -1
- package/lib/service/index.js +1 -0
- package/lib/service/index.js.map +1 -1
- package/lib/ui/icons.d.ts +5 -2
- package/lib/ui/icons.d.ts.map +1 -1
- package/lib/ui/icons.js +5 -2
- package/lib/ui/icons.js.map +1 -1
- package/lib/util/AcApLayoutViewFraming.d.ts +68 -0
- package/lib/util/AcApLayoutViewFraming.d.ts.map +1 -0
- package/lib/util/AcApLayoutViewFraming.js +146 -0
- package/lib/util/AcApLayoutViewFraming.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 +4 -14
- package/lib/view/AcTrDirectBatch.d.ts.map +1 -1
- package/lib/view/AcTrDirectBatch.js +4 -120
- package/lib/view/AcTrDirectBatch.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +1 -1
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrView2d.d.ts +40 -36
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +156 -68
- package/lib/view/AcTrView2d.js.map +1 -1
- package/lib/view/AcTrViewSessionState.d.ts +7 -0
- package/lib/view/AcTrViewSessionState.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/find/AcApFindNavigator.ts +190 -190
- package/src/find/findDrawing.ts +211 -211
- package/src/find/findText.ts +624 -624
- package/src/find/index.ts +2 -2
- package/src/ui/icons.ts +411 -408
package/lib/view/AcTrView2d.js
CHANGED
|
@@ -96,7 +96,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
96
96
|
}
|
|
97
97
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
98
98
|
};
|
|
99
|
-
import { AcCmUiYieldGate, AcDbAttribute, AcDbBlockReference, acdbHostApplicationServices, AcDbMText, AcDbRasterImage, AcDbRay, AcDbRenderingCache, AcDbSysVarManager, AcDbViewport, AcDbXline, AcGeBox2d, AcGePoint2d, acgiForegroundColorForBackground, log } from '@mlightcad/data-model';
|
|
99
|
+
import { AcCmUiYieldGate, AcDbAttribute, AcDbBlockReference, acdbHostApplicationServices, AcDbMText, AcDbRasterImage, AcDbRay, AcDbRenderingCache, AcDbSysVarManager, AcDbText, AcDbViewport, AcDbXline, AcGeBox2d, AcGePoint2d, AcGePoint3d, acgiForegroundColorForBackground, log } from '@mlightcad/data-model';
|
|
100
100
|
import { AcDbSystemVariables } from '@mlightcad/data-model';
|
|
101
101
|
import { FontManager } from '@mlightcad/mtext-renderer';
|
|
102
102
|
import { AcTrEntity, AcTrGlyphEntity, AcTrGroup, AcTrMTextRenderer, AcTrRenderer, AcTrViewportView, hasPendingComplexLineTypeGlyphs, setAcTrDrawOrderZAllocator } from '@mlightcad/three-renderer';
|
|
@@ -105,6 +105,7 @@ import * as THREE from 'three';
|
|
|
105
105
|
import Stats from 'three/examples/jsm/libs/stats.module';
|
|
106
106
|
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
|
|
107
107
|
import { AcApDocManager, AcApSettingManager } from '../app';
|
|
108
|
+
import { AcApOpenViewMode } from '../app/AcApOpenDatabaseOptions';
|
|
108
109
|
import { AcApZoomCmd } from '../command/AcApZoomCmd';
|
|
109
110
|
import { isMarkupHtmlTextEditing } from '../command/markup/AcApMarkupTextEdit';
|
|
110
111
|
import { notifyMeasurementLayoutChanged } from '../command/measure/AcApMeasurementStore';
|
|
@@ -115,6 +116,7 @@ import { acedEntityIntersectsSelectionBox, acedNeedsCrossingGeometryRefine } fro
|
|
|
115
116
|
import { isEffectiveSpatialQueryHit } from '../editor/view/AcEdSpatialQueryResult';
|
|
116
117
|
import { AcTrGeometryUtil } from '../util';
|
|
117
118
|
import { acapRunDatabaseEdit } from '../util/AcApDatabaseEdit';
|
|
119
|
+
import { acapResolveLayoutFrameBox } from '../util/AcApLayoutViewFraming';
|
|
118
120
|
import { collectTextStyleFontNames, planTextStyleFontPreload } from '../util/AcApTextStyleFontPreload';
|
|
119
121
|
import { ACAP_READING_MODE_BACKGROUND, AcApReadingModeState } from './AcApReadingMode';
|
|
120
122
|
import { trySelectReviewOverlay, trySelectReviewOverlaysByBox } from './AcEdReviewOverlayPick';
|
|
@@ -247,6 +249,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
247
249
|
* race during document open.
|
|
248
250
|
*/
|
|
249
251
|
_this._externallyFramedLayouts = new Set();
|
|
252
|
+
/**
|
|
253
|
+
* Open options → Initial view (`Extents` / `Saved`) for this document.
|
|
254
|
+
* Applied at document open for the startup layout, and again on the
|
|
255
|
+
* **first visit** to every other layout the user has not framed yet.
|
|
256
|
+
*/
|
|
257
|
+
_this._openViewMode = AcApOpenViewMode.Extents;
|
|
250
258
|
/**
|
|
251
259
|
* Layer names with an in-flight {@link convertMissingEntitiesOnLayer} pass.
|
|
252
260
|
*
|
|
@@ -2014,13 +2022,20 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2014
2022
|
AcApDocManager.instance.sendStringToExecute('attedit');
|
|
2015
2023
|
return [2 /*return*/];
|
|
2016
2024
|
}
|
|
2017
|
-
if (!(entity instanceof AcDbMText))
|
|
2018
|
-
return [2 /*return*/];
|
|
2025
|
+
if (!(entity instanceof AcDbMText)) return [3 /*break*/, 2];
|
|
2019
2026
|
e.preventDefault();
|
|
2020
2027
|
return [4 /*yield*/, this.editMTextEntity(entity)];
|
|
2021
2028
|
case 1:
|
|
2022
2029
|
_a.sent();
|
|
2023
2030
|
return [2 /*return*/];
|
|
2031
|
+
case 2:
|
|
2032
|
+
if (!(entity instanceof AcDbText)) return [3 /*break*/, 4];
|
|
2033
|
+
e.preventDefault();
|
|
2034
|
+
return [4 /*yield*/, this.editTextEntity(entity)];
|
|
2035
|
+
case 3:
|
|
2036
|
+
_a.sent();
|
|
2037
|
+
_a.label = 4;
|
|
2038
|
+
case 4: return [2 /*return*/];
|
|
2024
2039
|
}
|
|
2025
2040
|
});
|
|
2026
2041
|
});
|
|
@@ -2110,6 +2125,70 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2110
2125
|
});
|
|
2111
2126
|
});
|
|
2112
2127
|
};
|
|
2128
|
+
/**
|
|
2129
|
+
* Opens the shared inline editor for a single-line TEXT entity.
|
|
2130
|
+
*
|
|
2131
|
+
* Uses the MTEXT input box so the contextual Text Editor ribbon appears the
|
|
2132
|
+
* same way as double-click MTEXT editing. Formatting codes are written back
|
|
2133
|
+
* as the TEXT string content.
|
|
2134
|
+
*/
|
|
2135
|
+
AcTrView2d.prototype.editTextEntity = function (text) {
|
|
2136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2137
|
+
var db, height, textHeight, content, width, editor, applied, result_2, _a, _b;
|
|
2138
|
+
var _c;
|
|
2139
|
+
var _d;
|
|
2140
|
+
return __generator(this, function (_e) {
|
|
2141
|
+
switch (_e.label) {
|
|
2142
|
+
case 0:
|
|
2143
|
+
db = text.database;
|
|
2144
|
+
this._isDirty = true;
|
|
2145
|
+
height = Number(text.height);
|
|
2146
|
+
textHeight = Number.isFinite(height) && height > 0 ? height : this.pixelsToWorldY(24);
|
|
2147
|
+
content = (_d = text.textString) !== null && _d !== void 0 ? _d : '';
|
|
2148
|
+
width = Math.max(textHeight * Math.max(content.length, 1) * 0.6, textHeight);
|
|
2149
|
+
editor = new AcEdMTextEditor();
|
|
2150
|
+
applied = false;
|
|
2151
|
+
_e.label = 1;
|
|
2152
|
+
case 1:
|
|
2153
|
+
_e.trys.push([1, , 4, 5]);
|
|
2154
|
+
_b = (_a = editor).open;
|
|
2155
|
+
_c = {
|
|
2156
|
+
view: this,
|
|
2157
|
+
location: text.position,
|
|
2158
|
+
width: width,
|
|
2159
|
+
textHeight: textHeight,
|
|
2160
|
+
initialText: content
|
|
2161
|
+
};
|
|
2162
|
+
return [4 /*yield*/, this.getMTextToolbarFontFamilies()];
|
|
2163
|
+
case 2: return [4 /*yield*/, _b.apply(_a, [(_c.toolbarFontFamilies = _e.sent(),
|
|
2164
|
+
_c)])];
|
|
2165
|
+
case 3:
|
|
2166
|
+
result_2 = _e.sent();
|
|
2167
|
+
if (!result_2)
|
|
2168
|
+
return [2 /*return*/];
|
|
2169
|
+
acapRunDatabaseEdit(db, 'Edit Text', function () {
|
|
2170
|
+
var opened = db.openEntityForWrite(text);
|
|
2171
|
+
if (!(opened instanceof AcDbText))
|
|
2172
|
+
return;
|
|
2173
|
+
opened.position = new AcGePoint3d(result_2.location);
|
|
2174
|
+
opened.textString = result_2.contents;
|
|
2175
|
+
if (Number.isFinite(result_2.height) && result_2.height > 0) {
|
|
2176
|
+
opened.height = result_2.height;
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
applied = true;
|
|
2180
|
+
return [3 /*break*/, 5];
|
|
2181
|
+
case 4:
|
|
2182
|
+
if (!applied) {
|
|
2183
|
+
this.updateEntity(text);
|
|
2184
|
+
this._isDirty = true;
|
|
2185
|
+
}
|
|
2186
|
+
return [7 /*endfinally*/];
|
|
2187
|
+
case 5: return [2 /*return*/];
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
});
|
|
2191
|
+
};
|
|
2113
2192
|
AcTrView2d.prototype.resolveMTextEditorWidth = function (mtext) {
|
|
2114
2193
|
var width = Number(mtext.width);
|
|
2115
2194
|
if (Number.isFinite(width) && width > 0)
|
|
@@ -2334,8 +2413,9 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2334
2413
|
var idsAdded = [];
|
|
2335
2414
|
var results = this.pick(point);
|
|
2336
2415
|
results.forEach(function (item) { return idsAdded.push(item.id); });
|
|
2337
|
-
|
|
2338
|
-
|
|
2416
|
+
var selectable = this.selectableIds(idsAdded, 'add');
|
|
2417
|
+
if (selectable.length > 0)
|
|
2418
|
+
this.selectionSet.add(selectable);
|
|
2339
2419
|
};
|
|
2340
2420
|
/**
|
|
2341
2421
|
* @inheritdoc
|
|
@@ -2754,6 +2834,15 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2754
2834
|
this._initializedLayouts.add(layoutBtrId);
|
|
2755
2835
|
this._externallyFramedLayouts.add(layoutBtrId);
|
|
2756
2836
|
};
|
|
2837
|
+
/**
|
|
2838
|
+
* Records the Open options → Initial view choice for this document.
|
|
2839
|
+
*
|
|
2840
|
+
* Used by {@link applyInitialZoom} on the first visit to any layout that
|
|
2841
|
+
* was not already framed at open time.
|
|
2842
|
+
*/
|
|
2843
|
+
AcTrView2d.prototype.setOpenViewMode = function (mode) {
|
|
2844
|
+
this._openViewMode = mode;
|
|
2845
|
+
};
|
|
2757
2846
|
/**
|
|
2758
2847
|
* Whether the layout has already been visited (or framed by the
|
|
2759
2848
|
* application layer), i.e. a switch to it will not run the first-visit
|
|
@@ -2781,41 +2870,18 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2781
2870
|
return undefined;
|
|
2782
2871
|
};
|
|
2783
2872
|
/**
|
|
2784
|
-
* Applies
|
|
2785
|
-
* into for the first time
|
|
2786
|
-
* camera frame?" signal in this order:
|
|
2787
|
-
*
|
|
2788
|
-
* 1. **`AcDbLayout.limits`** (LIMMIN/LIMMAX) — only when it actually
|
|
2789
|
-
* contains the layout's viewports. Many real DWGs ship with garbage
|
|
2790
|
-
* limits (e.g. `(0,0)-(12,9)` from a legacy template setup) that
|
|
2791
|
-
* don't reflect the actual paper sheet. We reject those by
|
|
2792
|
-
* checking containment against `viewportsBoundingBox`.
|
|
2793
|
-
*
|
|
2794
|
-
* 2. **`AcTrLayoutView.viewportsBoundingBox`** — bounding box of all
|
|
2795
|
-
* real user viewports in the layout. In production sheets viewports
|
|
2796
|
-
* typically span 70-90% of the paper, so this is a great proxy for
|
|
2797
|
-
* the printable area and (crucially) ignores outliers like title
|
|
2798
|
-
* blocks authored in a different unit/scale.
|
|
2799
|
-
*
|
|
2800
|
-
* 3. **`AcDbLayout.extents`** — the layout's own EXTMIN/EXTMAX, if
|
|
2801
|
-
* populated. Many parsers leave this empty (we've seen `(0,0)-(0,0)`),
|
|
2802
|
-
* so it sits below the viewport-based heuristic.
|
|
2873
|
+
* Applies Open options → Initial view for a layout the user just switched
|
|
2874
|
+
* into for the **first** time ({@link setOpenViewMode}).
|
|
2803
2875
|
*
|
|
2804
|
-
*
|
|
2805
|
-
*
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2876
|
+
* - **Saved + model**: VPORT `*ACTIVE`, else geometry fallback.
|
|
2877
|
+
* - **Saved + paper**: {@link acapResolveLayoutFrameBox} with limits
|
|
2878
|
+
* trusted only when they contain real viewports (rejects template
|
|
2879
|
+
* `(0,0)-(12,9)`), then viewports → layout extents → entity box.
|
|
2880
|
+
* - **Extents**: frame converted geometry (and paper viewports as a
|
|
2881
|
+
* content proxy). Does not prefer LIMMIN/LIMMAX over drawable bounds.
|
|
2808
2882
|
*
|
|
2809
|
-
*
|
|
2810
|
-
*
|
|
2811
|
-
* `AcDbViewport`s) have not yet been batch-converted into the scene
|
|
2812
|
-
* — `loadLayoutEntitiesIfNeeded` chunked-converts via the progressive
|
|
2813
|
-
* convert queue (or direct `batchConvert`).
|
|
2814
|
-
* Without the waiter, `viewportsBoundingBox` returns undefined and
|
|
2815
|
-
* the strategy degrades into (1) zooming to garbage `limits`, or
|
|
2816
|
-
* (4) zooming to an empty scene box. The waiter polls
|
|
2817
|
-
* {@link isProcessingEntities} (convert queue + deferred glyph jobs)
|
|
2818
|
-
* and only fires the heuristic once conversion and text geometry finish.
|
|
2883
|
+
* Runs through {@link AcEdConditionWaiter} so viewport / entity convert
|
|
2884
|
+
* finishes before framing.
|
|
2819
2885
|
*/
|
|
2820
2886
|
AcTrView2d.prototype.applyInitialZoom = function (btrId, layout) {
|
|
2821
2887
|
var _this = this;
|
|
@@ -2823,40 +2889,58 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2823
2889
|
if (_this._externallyFramedLayouts.delete(btrId)) {
|
|
2824
2890
|
return;
|
|
2825
2891
|
}
|
|
2826
|
-
var
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
var limitsContainsViewports = (function () {
|
|
2830
|
-
if (!limits || limits.isEmpty())
|
|
2831
|
-
return false;
|
|
2832
|
-
if (!vpsBox)
|
|
2833
|
-
return true;
|
|
2834
|
-
return (limits.min.x <= vpsBox.min.x &&
|
|
2835
|
-
limits.min.y <= vpsBox.min.y &&
|
|
2836
|
-
limits.max.x >= vpsBox.max.x &&
|
|
2837
|
-
limits.max.y >= vpsBox.max.y);
|
|
2838
|
-
})();
|
|
2839
|
-
if (limits && !limits.isEmpty() && limitsContainsViewports) {
|
|
2840
|
-
_this.zoomTo(limits);
|
|
2841
|
-
}
|
|
2842
|
-
else if (vpsBox) {
|
|
2843
|
-
_this.zoomTo(vpsBox);
|
|
2844
|
-
}
|
|
2845
|
-
else if (layout.extents && !layout.extents.isEmpty()) {
|
|
2846
|
-
var extents = layout.extents;
|
|
2847
|
-
_this.zoomTo(new AcGeBox2d({ x: extents.min.x, y: extents.min.y }, { x: extents.max.x, y: extents.max.y }));
|
|
2848
|
-
}
|
|
2849
|
-
else {
|
|
2850
|
-
var box = _this.getDrawingExtents();
|
|
2851
|
-
if (box) {
|
|
2852
|
-
_this.zoomTo(box);
|
|
2853
|
-
}
|
|
2892
|
+
var box = _this.resolveFirstVisitFrameBox(btrId, layout);
|
|
2893
|
+
if (box) {
|
|
2894
|
+
_this.zoomTo(box);
|
|
2854
2895
|
}
|
|
2855
2896
|
_this._isDirty = true;
|
|
2856
2897
|
AcApZoomCmd.rememberOriginalView(_this, btrId);
|
|
2857
2898
|
}, 300, 0);
|
|
2858
2899
|
waiter.start();
|
|
2859
2900
|
};
|
|
2901
|
+
/**
|
|
2902
|
+
* Resolves the camera box for a layout's first visit from
|
|
2903
|
+
* {@link _openViewMode}.
|
|
2904
|
+
*/
|
|
2905
|
+
AcTrView2d.prototype.resolveFirstVisitFrameBox = function (btrId, layout) {
|
|
2906
|
+
var _a, _b;
|
|
2907
|
+
var isModelSpace = btrId === this.modelSpaceBtrId;
|
|
2908
|
+
var wantSaved = this._openViewMode === AcApOpenViewMode.Saved;
|
|
2909
|
+
if (wantSaved && isModelSpace) {
|
|
2910
|
+
var db = AcApDocManager.instance.curDocument.database;
|
|
2911
|
+
var aspect = this.width / Math.max(this.height, 1);
|
|
2912
|
+
var savedBox = db.tables.viewportTable.getActiveVportBox(aspect);
|
|
2913
|
+
if (savedBox)
|
|
2914
|
+
return savedBox;
|
|
2915
|
+
}
|
|
2916
|
+
var layoutView = this._layoutViewManager.getAt(btrId);
|
|
2917
|
+
var extents = layout.extents;
|
|
2918
|
+
var layoutExtents = extents && !extents.isEmpty()
|
|
2919
|
+
? {
|
|
2920
|
+
min: { x: extents.min.x, y: extents.min.y },
|
|
2921
|
+
max: { x: extents.max.x, y: extents.max.y }
|
|
2922
|
+
}
|
|
2923
|
+
: undefined;
|
|
2924
|
+
var entityBox = this.getDrawingExtents();
|
|
2925
|
+
var viewportsBox = layoutView === null || layoutView === void 0 ? void 0 : layoutView.viewportsBoundingBox;
|
|
2926
|
+
if (wantSaved && !isModelSpace) {
|
|
2927
|
+
// Paper Saved: trust LIMMIN/LIMMAX only when they contain viewports.
|
|
2928
|
+
return (_a = acapResolveLayoutFrameBox({
|
|
2929
|
+
limits: layout.limits,
|
|
2930
|
+
viewportsBox: viewportsBox,
|
|
2931
|
+
layoutExtents: layoutExtents,
|
|
2932
|
+
entityBox: entityBox
|
|
2933
|
+
})) === null || _a === void 0 ? void 0 : _a.box;
|
|
2934
|
+
}
|
|
2935
|
+
// Extents (any layout), or Saved model fallback without *ACTIVE:
|
|
2936
|
+
// prefer drawable content; never lead with template model/paper limits.
|
|
2937
|
+
return (_b = acapResolveLayoutFrameBox({
|
|
2938
|
+
limits: undefined,
|
|
2939
|
+
viewportsBox: isModelSpace ? undefined : viewportsBox,
|
|
2940
|
+
layoutExtents: layoutExtents,
|
|
2941
|
+
entityBox: entityBox
|
|
2942
|
+
})) === null || _b === void 0 ? void 0 : _b.box;
|
|
2943
|
+
};
|
|
2860
2944
|
/**
|
|
2861
2945
|
* Invalidates in-flight progressive convert and empties convert / deferred
|
|
2862
2946
|
* queues without tearing down the renderer or DOM.
|
|
@@ -2889,6 +2973,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2889
2973
|
this._missedImages.clear();
|
|
2890
2974
|
this._initializedLayouts.clear();
|
|
2891
2975
|
this._externallyFramedLayouts.clear();
|
|
2976
|
+
this._openViewMode = AcApOpenViewMode.Extents;
|
|
2892
2977
|
this._loadingLayouts.clear();
|
|
2893
2978
|
this._renderer.dispose();
|
|
2894
2979
|
// Drop block templates when the scene is torn down (next open / close).
|
|
@@ -2906,6 +2991,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2906
2991
|
layoutViewManager: this._layoutViewManager,
|
|
2907
2992
|
initializedLayouts: this._initializedLayouts,
|
|
2908
2993
|
externallyFramedLayouts: this._externallyFramedLayouts,
|
|
2994
|
+
openViewMode: this._openViewMode,
|
|
2909
2995
|
loadingLayouts: this._loadingLayouts,
|
|
2910
2996
|
missedImages: this._missedImages,
|
|
2911
2997
|
missedFonts: this._renderer.snapshotMissedFonts(),
|
|
@@ -2918,7 +3004,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2918
3004
|
* @param state - Snapshot previously returned by {@link captureSessionState} or {@link beginNewSession}.
|
|
2919
3005
|
*/
|
|
2920
3006
|
AcTrView2d.prototype.restoreSessionState = function (state) {
|
|
2921
|
-
var _a;
|
|
3007
|
+
var _a, _b;
|
|
2922
3008
|
this._convertEpoch++;
|
|
2923
3009
|
this.clearFontLoadedRedrawTimer();
|
|
2924
3010
|
this.cancelOpenLineworkFrame();
|
|
@@ -2933,9 +3019,10 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2933
3019
|
this._layoutViewManager = state.layoutViewManager;
|
|
2934
3020
|
this._initializedLayouts = state.initializedLayouts;
|
|
2935
3021
|
this._externallyFramedLayouts = state.externallyFramedLayouts;
|
|
3022
|
+
this._openViewMode = (_a = state.openViewMode) !== null && _a !== void 0 ? _a : AcApOpenViewMode.Extents;
|
|
2936
3023
|
this._loadingLayouts = state.loadingLayouts;
|
|
2937
3024
|
this._missedImages = state.missedImages;
|
|
2938
|
-
this._renderer.replaceMissedFonts((
|
|
3025
|
+
this._renderer.replaceMissedFonts((_b = state.missedFonts) !== null && _b !== void 0 ? _b : {});
|
|
2939
3026
|
this.rebindLayerAppearance();
|
|
2940
3027
|
this._layoutViewManager.resize(this.width, this.height);
|
|
2941
3028
|
this.selectionSet.clear();
|
|
@@ -2966,6 +3053,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2966
3053
|
this._layoutViewManager = new AcTrLayoutViewManager();
|
|
2967
3054
|
this._initializedLayouts = new Set();
|
|
2968
3055
|
this._externallyFramedLayouts = new Set();
|
|
3056
|
+
this._openViewMode = AcApOpenViewMode.Extents;
|
|
2969
3057
|
this._loadingLayouts = new Set();
|
|
2970
3058
|
this._missedImages = new Map();
|
|
2971
3059
|
this._renderer.clearMissedFonts();
|