@mlightcad/cad-simple-viewer 1.7.8-preview.4 → 1.7.8-preview.6
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 +3441 -3296
- package/dist/cad-simple-viewer.umd.cjs +60 -60
- package/lib/editor/view/AcEdBaseView.d.ts +13 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +24 -4
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/editor/view/AcEdSelectionBoxIntersect.d.ts +22 -5
- package/lib/editor/view/AcEdSelectionBoxIntersect.d.ts.map +1 -1
- package/lib/editor/view/AcEdSelectionBoxIntersect.js +22 -5
- package/lib/editor/view/AcEdSelectionBoxIntersect.js.map +1 -1
- package/lib/editor/view/AcEdViewportBoxSelection.d.ts +90 -0
- package/lib/editor/view/AcEdViewportBoxSelection.d.ts.map +1 -0
- package/lib/editor/view/AcEdViewportBoxSelection.js +191 -0
- package/lib/editor/view/AcEdViewportBoxSelection.js.map +1 -0
- package/lib/editor/view/index.d.ts +1 -0
- package/lib/editor/view/index.d.ts.map +1 -1
- package/lib/editor/view/index.js +1 -0
- package/lib/editor/view/index.js.map +1 -1
- package/lib/view/AcTrInheritedLayerMaterialMapper.d.ts +15 -10
- package/lib/view/AcTrInheritedLayerMaterialMapper.d.ts.map +1 -1
- package/lib/view/AcTrInheritedLayerMaterialMapper.js +33 -20
- package/lib/view/AcTrInheritedLayerMaterialMapper.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +20 -4
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +141 -64
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +5 -5
package/lib/view/AcTrView2d.js
CHANGED
|
@@ -109,7 +109,7 @@ import { AcApOpenViewMode } from '../app/AcApOpenDatabaseOptions';
|
|
|
109
109
|
import { AcApZoomCmd } from '../command/AcApZoomCmd';
|
|
110
110
|
import { isMarkupHtmlTextEditing } from '../command/markup/AcApMarkupTextEdit';
|
|
111
111
|
import { notifyMeasurementLayoutChanged } from '../command/measure/AcApMeasurementStore';
|
|
112
|
-
import { acedAttachMobileBoxGesture, AcEdBaseView, AcEdConditionWaiter, AcEdCorsorType, AcEdGripManager, acedGuardCanvasTouchCallout, acedInteractionStrategy, acedIsTouchDerivedMouseEvent, AcEdMTextEditor, AcEdOpenMode, acedShouldIgnoreCompatMouse, AcEdViewMode, eventBus, resolvePointerSelectionAction } from '../editor';
|
|
112
|
+
import { acedAttachMobileBoxGesture, AcEdBaseView, acedCollectViewportBoxSelectionIds, AcEdConditionWaiter, AcEdCorsorType, AcEdGripManager, acedGuardCanvasTouchCallout, acedInteractionStrategy, acedIsTouchDerivedMouseEvent, AcEdMTextEditor, AcEdOpenMode, acedShouldIgnoreCompatMouse, AcEdViewMode, eventBus, resolvePointerSelectionAction } from '../editor';
|
|
113
113
|
import { ACGI_MODEL_SPACE_BACKGROUND, isModelSpaceDatabase, readLayoutBackgroundColor } from '../editor/global/AcEdUiColor';
|
|
114
114
|
import { ML_UI_Z_CANVAS_HTML_OVERLAY } from '../editor/global/AcEdUiLayout';
|
|
115
115
|
import { acedEntityIntersectsSelectionBox, acedNeedsCrossingGeometryRefine } from '../editor/view/AcEdSelectionBoxIntersect';
|
|
@@ -693,7 +693,9 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
693
693
|
beginSelectionPreview(e.clientX, e.clientY);
|
|
694
694
|
}, { signal: viewDomSignal });
|
|
695
695
|
_this.canvas.addEventListener('mousemove', function (e) {
|
|
696
|
-
if (!selectionStartWcs ||
|
|
696
|
+
if (!selectionStartWcs ||
|
|
697
|
+
!selectionPreviewEl ||
|
|
698
|
+
!selectionStartCanvas) {
|
|
697
699
|
return;
|
|
698
700
|
}
|
|
699
701
|
if (acedIsTouchDerivedMouseEvent(e) || acedShouldIgnoreCompatMouse()) {
|
|
@@ -2107,7 +2109,9 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2107
2109
|
this.setEntitySceneVisible(mtext.objectId, false);
|
|
2108
2110
|
this._isDirty = true;
|
|
2109
2111
|
resolvePresentation = mtext.resolveAnnotativePresentation;
|
|
2110
|
-
presentation = typeof resolvePresentation === 'function'
|
|
2112
|
+
presentation = typeof resolvePresentation === 'function'
|
|
2113
|
+
? resolvePresentation.call(mtext)
|
|
2114
|
+
: null;
|
|
2111
2115
|
rawLocation = (_d = presentation === null || presentation === void 0 ? void 0 : presentation.position) !== null && _d !== void 0 ? _d : mtext.location;
|
|
2112
2116
|
location = {
|
|
2113
2117
|
x: rawLocation.x,
|
|
@@ -2116,10 +2120,14 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2116
2120
|
};
|
|
2117
2121
|
direction = (_f = presentation === null || presentation === void 0 ? void 0 : presentation.direction) !== null && _f !== void 0 ? _f : mtext.direction;
|
|
2118
2122
|
attachmentPoint = (_g = presentation === null || presentation === void 0 ? void 0 : presentation.attachmentPoint) !== null && _g !== void 0 ? _g : mtext.attachmentPoint;
|
|
2119
|
-
editorWidth = presentation &&
|
|
2123
|
+
editorWidth = presentation &&
|
|
2124
|
+
Number.isFinite(presentation.width) &&
|
|
2125
|
+
presentation.width > 0
|
|
2120
2126
|
? presentation.width
|
|
2121
2127
|
: this.resolveMTextEditorWidth(mtext);
|
|
2122
|
-
textHeight = presentation &&
|
|
2128
|
+
textHeight = presentation &&
|
|
2129
|
+
Number.isFinite(presentation.height) &&
|
|
2130
|
+
presentation.height > 0
|
|
2123
2131
|
? presentation.height
|
|
2124
2132
|
: this.resolveMTextEditorTextHeight(mtext);
|
|
2125
2133
|
editor = new AcEdMTextEditor();
|
|
@@ -2526,6 +2534,61 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2526
2534
|
AcTrView2d.prototype.selectByBox = function (box) {
|
|
2527
2535
|
this.selectByBoxWithMode(box, 'crossing', 'add');
|
|
2528
2536
|
};
|
|
2537
|
+
/**
|
|
2538
|
+
* Collects model-space entities selected through the active layout's paper
|
|
2539
|
+
* viewports.
|
|
2540
|
+
*
|
|
2541
|
+
* Box selection used to query only the active layout's spatial index, so
|
|
2542
|
+
* model-space content rendered inside a viewport could be clicked (pick
|
|
2543
|
+
* drills through) but never box-selected — reported for LEADER entities in
|
|
2544
|
+
* `布局1`. Each viewport's visible slice of the pick rectangle is mapped to
|
|
2545
|
+
* model WCS, queried, and mapped back so window / crossing keeps its exact
|
|
2546
|
+
* AutoCAD meaning.
|
|
2547
|
+
*/
|
|
2548
|
+
AcTrView2d.prototype.collectViewportDrillThroughSelectionIds = function (box, mode) {
|
|
2549
|
+
var e_10, _a;
|
|
2550
|
+
var _b, _c;
|
|
2551
|
+
var activeLayoutView = this.activeLayoutView;
|
|
2552
|
+
var modelLayout = this._scene.modelSpaceLayout;
|
|
2553
|
+
if (!activeLayoutView || !modelLayout)
|
|
2554
|
+
return [];
|
|
2555
|
+
if (activeLayoutView.layoutBtrId === this._scene.modelSpaceBtrId)
|
|
2556
|
+
return [];
|
|
2557
|
+
var viewports = [];
|
|
2558
|
+
var _loop_2 = function (vpView) {
|
|
2559
|
+
viewports.push({
|
|
2560
|
+
paperBox: vpView.viewport.box,
|
|
2561
|
+
frozenLayers: vpView.viewport.frozenLayers,
|
|
2562
|
+
paperPointToModel: function (point) { return vpView.paperPointToModel(point); },
|
|
2563
|
+
modelPointToPaper: function (point) { return vpView.modelPointToPaper(point); }
|
|
2564
|
+
});
|
|
2565
|
+
};
|
|
2566
|
+
try {
|
|
2567
|
+
for (var _d = __values(activeLayoutView.viewportViews), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2568
|
+
var vpView = _e.value;
|
|
2569
|
+
_loop_2(vpView);
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
2573
|
+
finally {
|
|
2574
|
+
try {
|
|
2575
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
2576
|
+
}
|
|
2577
|
+
finally { if (e_10) throw e_10.error; }
|
|
2578
|
+
}
|
|
2579
|
+
if (viewports.length === 0)
|
|
2580
|
+
return [];
|
|
2581
|
+
var database = (_c = (_b = AcApDocManager.tryGetInstance()) === null || _b === void 0 ? void 0 : _b.curDocument) === null || _c === void 0 ? void 0 : _c.database;
|
|
2582
|
+
return acedCollectViewportBoxSelectionIds({
|
|
2583
|
+
selectionBox: box,
|
|
2584
|
+
mode: mode,
|
|
2585
|
+
viewports: viewports,
|
|
2586
|
+
searchModel: function (modelBox, selectionMode) {
|
|
2587
|
+
return modelLayout.search(modelBox, { selectionMode: selectionMode });
|
|
2588
|
+
},
|
|
2589
|
+
entityOf: function (id) { var _a; return (_a = database === null || database === void 0 ? void 0 : database.tables.blockTable.getEntityById(id)) !== null && _a !== void 0 ? _a : undefined; }
|
|
2590
|
+
});
|
|
2591
|
+
};
|
|
2529
2592
|
/**
|
|
2530
2593
|
* Drops crossing spatial hits whose curve geometry misses the pick box.
|
|
2531
2594
|
*
|
|
@@ -2534,7 +2597,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2534
2597
|
* that interior also selects those polylines and can stall highlight work.
|
|
2535
2598
|
*/
|
|
2536
2599
|
AcTrView2d.prototype.refineCrossingSelectionHits = function (box, results) {
|
|
2537
|
-
var
|
|
2600
|
+
var e_11, _a;
|
|
2538
2601
|
var _b;
|
|
2539
2602
|
var database = (_b = AcApDocManager.instance.curDocument) === null || _b === void 0 ? void 0 : _b.database;
|
|
2540
2603
|
if (!database) {
|
|
@@ -2559,12 +2622,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2559
2622
|
}
|
|
2560
2623
|
}
|
|
2561
2624
|
}
|
|
2562
|
-
catch (
|
|
2625
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
2563
2626
|
finally {
|
|
2564
2627
|
try {
|
|
2565
2628
|
if (results_1_1 && !results_1_1.done && (_a = results_1.return)) _a.call(results_1);
|
|
2566
2629
|
}
|
|
2567
|
-
finally { if (
|
|
2630
|
+
finally { if (e_11) throw e_11.error; }
|
|
2568
2631
|
}
|
|
2569
2632
|
return ids;
|
|
2570
2633
|
};
|
|
@@ -2580,7 +2643,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2580
2643
|
* @inheritdoc
|
|
2581
2644
|
*/
|
|
2582
2645
|
AcTrView2d.prototype.updateLayer = function (layer, changes) {
|
|
2583
|
-
var
|
|
2646
|
+
var e_12, _a;
|
|
2584
2647
|
var touchedObjectIds = this._scene.updateLayer(this.toLayerInfo(layer)).touchedObjectIds;
|
|
2585
2648
|
if (this._layerAppearance.layerStyleMayHaveChanged(changes)) {
|
|
2586
2649
|
this._layerAppearance.syncFromLiveRecord(layer);
|
|
@@ -2602,12 +2665,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2602
2665
|
this.applySessionHiddenObjectState(objectId);
|
|
2603
2666
|
}
|
|
2604
2667
|
}
|
|
2605
|
-
catch (
|
|
2668
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
2606
2669
|
finally {
|
|
2607
2670
|
try {
|
|
2608
2671
|
if (touchedObjectIds_1_1 && !touchedObjectIds_1_1.done && (_a = touchedObjectIds_1.return)) _a.call(touchedObjectIds_1);
|
|
2609
2672
|
}
|
|
2610
|
-
finally { if (
|
|
2673
|
+
finally { if (e_12) throw e_12.error; }
|
|
2611
2674
|
}
|
|
2612
2675
|
this._isDirty = true;
|
|
2613
2676
|
};
|
|
@@ -2944,7 +3007,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2944
3007
|
* drawable entity that must be rebuilt (for example ATTRIB → INSERT).
|
|
2945
3008
|
*/
|
|
2946
3009
|
AcTrView2d.prototype.resolveSceneUpdateEntities = function (entities) {
|
|
2947
|
-
var
|
|
3010
|
+
var e_13, _a;
|
|
2948
3011
|
var _b;
|
|
2949
3012
|
var db = (_b = AcApDocManager.instance.curDocument) === null || _b === void 0 ? void 0 : _b.database;
|
|
2950
3013
|
var resolved = [];
|
|
@@ -2966,12 +3029,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
2966
3029
|
resolved.push(target);
|
|
2967
3030
|
}
|
|
2968
3031
|
}
|
|
2969
|
-
catch (
|
|
3032
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
2970
3033
|
finally {
|
|
2971
3034
|
try {
|
|
2972
3035
|
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
|
|
2973
3036
|
}
|
|
2974
|
-
finally { if (
|
|
3037
|
+
finally { if (e_13) throw e_13.error; }
|
|
2975
3038
|
}
|
|
2976
3039
|
return resolved;
|
|
2977
3040
|
};
|
|
@@ -3756,7 +3819,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
3756
3819
|
* @param layoutBtrId Input the block table record id of the layout
|
|
3757
3820
|
*/
|
|
3758
3821
|
AcTrView2d.prototype.loadLayoutEntitiesIfNeeded = function (layoutBtrId) {
|
|
3759
|
-
var
|
|
3822
|
+
var e_14, _a;
|
|
3760
3823
|
var _this = this;
|
|
3761
3824
|
try {
|
|
3762
3825
|
var db = AcApDocManager.instance.curDocument.database;
|
|
@@ -3820,12 +3883,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
3820
3883
|
entities_2.push(entity);
|
|
3821
3884
|
}
|
|
3822
3885
|
}
|
|
3823
|
-
catch (
|
|
3886
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
3824
3887
|
finally {
|
|
3825
3888
|
try {
|
|
3826
3889
|
if (iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return)) _a.call(iterator_1);
|
|
3827
3890
|
}
|
|
3828
|
-
finally { if (
|
|
3891
|
+
finally { if (e_14) throw e_14.error; }
|
|
3829
3892
|
}
|
|
3830
3893
|
if (entities_2.length === 0) {
|
|
3831
3894
|
// Empty layout (e.g. a freshly-created paper space tab). Mark as
|
|
@@ -4168,8 +4231,8 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4168
4231
|
*/
|
|
4169
4232
|
AcTrView2d.prototype.redrawGlyphEntitiesAfterFontLoad = function (epoch, fontName) {
|
|
4170
4233
|
return __awaiter(this, void 0, void 0, function () {
|
|
4171
|
-
var redrawEpoch, glyphs, _a, _b, layout, glyphs_1, glyphs_1_1, glyph,
|
|
4172
|
-
var
|
|
4234
|
+
var redrawEpoch, glyphs, _a, _b, layout, glyphs_1, glyphs_1_1, glyph, e_15_1, defaults, normalized_1, msSinceIdle, db;
|
|
4235
|
+
var e_16, _c, e_15, _d;
|
|
4173
4236
|
var _e, _f;
|
|
4174
4237
|
return __generator(this, function (_g) {
|
|
4175
4238
|
switch (_g.label) {
|
|
@@ -4191,12 +4254,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4191
4254
|
});
|
|
4192
4255
|
}
|
|
4193
4256
|
}
|
|
4194
|
-
catch (
|
|
4257
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
4195
4258
|
finally {
|
|
4196
4259
|
try {
|
|
4197
4260
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
4198
4261
|
}
|
|
4199
|
-
finally { if (
|
|
4262
|
+
finally { if (e_16) throw e_16.error; }
|
|
4200
4263
|
}
|
|
4201
4264
|
_g.label = 1;
|
|
4202
4265
|
case 1:
|
|
@@ -4219,14 +4282,14 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4219
4282
|
return [3 /*break*/, 2];
|
|
4220
4283
|
case 5: return [3 /*break*/, 8];
|
|
4221
4284
|
case 6:
|
|
4222
|
-
|
|
4223
|
-
|
|
4285
|
+
e_15_1 = _g.sent();
|
|
4286
|
+
e_15 = { error: e_15_1 };
|
|
4224
4287
|
return [3 /*break*/, 8];
|
|
4225
4288
|
case 7:
|
|
4226
4289
|
try {
|
|
4227
4290
|
if (glyphs_1_1 && !glyphs_1_1.done && (_d = glyphs_1.return)) _d.call(glyphs_1);
|
|
4228
4291
|
}
|
|
4229
|
-
finally { if (
|
|
4292
|
+
finally { if (e_15) throw e_15.error; }
|
|
4230
4293
|
return [7 /*endfinally*/];
|
|
4231
4294
|
case 8:
|
|
4232
4295
|
if (glyphs.length > 0) {
|
|
@@ -4277,7 +4340,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4277
4340
|
});
|
|
4278
4341
|
};
|
|
4279
4342
|
AcTrView2d.prototype.groupHasPendingGlyphGeometry = function (group) {
|
|
4280
|
-
var
|
|
4343
|
+
var e_17, _a;
|
|
4281
4344
|
try {
|
|
4282
4345
|
// Prefer O(block-def shells). A full THREE.traverse over a mega-block
|
|
4283
4346
|
// (100k+ flattened mesh leaves) was dominating scene-convert wall time.
|
|
@@ -4288,12 +4351,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4288
4351
|
}
|
|
4289
4352
|
}
|
|
4290
4353
|
}
|
|
4291
|
-
catch (
|
|
4354
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
4292
4355
|
finally {
|
|
4293
4356
|
try {
|
|
4294
4357
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4295
4358
|
}
|
|
4296
|
-
finally { if (
|
|
4359
|
+
finally { if (e_17) throw e_17.error; }
|
|
4297
4360
|
}
|
|
4298
4361
|
return AcTrView2d.directChildrenHavePendingGlyphs(group);
|
|
4299
4362
|
};
|
|
@@ -4304,7 +4367,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4304
4367
|
* a whole-floor INSERT is O(glyph shells), not O(all drawable leaves).
|
|
4305
4368
|
*/
|
|
4306
4369
|
AcTrView2d.directChildrenHavePendingGlyphs = function (root) {
|
|
4307
|
-
var
|
|
4370
|
+
var e_18, _a;
|
|
4308
4371
|
var children = root.children;
|
|
4309
4372
|
for (var i = 0; i < children.length; i++) {
|
|
4310
4373
|
var child = children[i];
|
|
@@ -4316,7 +4379,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4316
4379
|
}
|
|
4317
4380
|
if (child instanceof AcTrGroup) {
|
|
4318
4381
|
try {
|
|
4319
|
-
for (var _b = (
|
|
4382
|
+
for (var _b = (e_18 = void 0, __values(child.getSourceEntities())), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4320
4383
|
var entity = _c.value;
|
|
4321
4384
|
if (entity instanceof AcTrGlyphEntity &&
|
|
4322
4385
|
!entity.hasDrawableGeometry()) {
|
|
@@ -4324,12 +4387,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4324
4387
|
}
|
|
4325
4388
|
}
|
|
4326
4389
|
}
|
|
4327
|
-
catch (
|
|
4390
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
4328
4391
|
finally {
|
|
4329
4392
|
try {
|
|
4330
4393
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4331
4394
|
}
|
|
4332
|
-
finally { if (
|
|
4395
|
+
finally { if (e_18) throw e_18.error; }
|
|
4333
4396
|
}
|
|
4334
4397
|
if (AcTrView2d.directChildrenHavePendingGlyphs(child)) {
|
|
4335
4398
|
return true;
|
|
@@ -4371,7 +4434,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4371
4434
|
*/
|
|
4372
4435
|
AcTrView2d.prototype.pumpDeferredGeometryQueue = function () {
|
|
4373
4436
|
var _this = this;
|
|
4374
|
-
var
|
|
4437
|
+
var _loop_3 = function () {
|
|
4375
4438
|
var job = this_1._deferredGeometryQueue.shift();
|
|
4376
4439
|
if (job.epoch !== this_1._convertEpoch) {
|
|
4377
4440
|
this_1._pendingGeometryJobs = Math.max(0, this_1._pendingGeometryJobs - 1);
|
|
@@ -4411,7 +4474,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4411
4474
|
var this_1 = this;
|
|
4412
4475
|
while (this._deferredGeometryActive < AcTrView2d.DEFERRED_GEOMETRY_CONCURRENCY &&
|
|
4413
4476
|
this._deferredGeometryQueue.length > 0) {
|
|
4414
|
-
|
|
4477
|
+
_loop_3();
|
|
4415
4478
|
}
|
|
4416
4479
|
};
|
|
4417
4480
|
/** Drops queued deferred geometry and resets counters for a new epoch. */
|
|
@@ -4493,7 +4556,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4493
4556
|
* paper layouts.
|
|
4494
4557
|
*/
|
|
4495
4558
|
AcTrView2d.prototype.ensureViewportViews = function (blockTableRecord, layoutView) {
|
|
4496
|
-
var
|
|
4559
|
+
var e_19, _a;
|
|
4497
4560
|
var iterator = blockTableRecord.newIterator();
|
|
4498
4561
|
try {
|
|
4499
4562
|
for (var iterator_2 = __values(iterator), iterator_2_1 = iterator_2.next(); !iterator_2_1.done; iterator_2_1 = iterator_2.next()) {
|
|
@@ -4506,12 +4569,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4506
4569
|
layoutView.addViewport(viewportView);
|
|
4507
4570
|
}
|
|
4508
4571
|
}
|
|
4509
|
-
catch (
|
|
4572
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
4510
4573
|
finally {
|
|
4511
4574
|
try {
|
|
4512
4575
|
if (iterator_2_1 && !iterator_2_1.done && (_a = iterator_2.return)) _a.call(iterator_2);
|
|
4513
4576
|
}
|
|
4514
|
-
finally { if (
|
|
4577
|
+
finally { if (e_19) throw e_19.error; }
|
|
4515
4578
|
}
|
|
4516
4579
|
};
|
|
4517
4580
|
/**
|
|
@@ -4520,7 +4583,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4520
4583
|
* {@link AcDbViewport.frozenLayerIds} but omit them from `toGiViewport()`.
|
|
4521
4584
|
*/
|
|
4522
4585
|
AcTrView2d.prototype.toGiViewportWithFrozenLayers = function (entity) {
|
|
4523
|
-
var
|
|
4586
|
+
var e_20, _a;
|
|
4524
4587
|
var _b;
|
|
4525
4588
|
var gi = entity.toGiViewport();
|
|
4526
4589
|
if (gi.frozenLayers && gi.frozenLayers.length > 0) {
|
|
@@ -4540,12 +4603,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4540
4603
|
names.push(layer.name);
|
|
4541
4604
|
}
|
|
4542
4605
|
}
|
|
4543
|
-
catch (
|
|
4606
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
4544
4607
|
finally {
|
|
4545
4608
|
try {
|
|
4546
4609
|
if (ids_1_1 && !ids_1_1.done && (_a = ids_1.return)) _a.call(ids_1);
|
|
4547
4610
|
}
|
|
4548
|
-
finally { if (
|
|
4611
|
+
finally { if (e_20) throw e_20.error; }
|
|
4549
4612
|
}
|
|
4550
4613
|
}
|
|
4551
4614
|
gi.frozenLayerIds = __spreadArray([], __read(ids), false);
|
|
@@ -4559,7 +4622,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4559
4622
|
*/
|
|
4560
4623
|
AcTrView2d.prototype.batchConvert = function (entities_3) {
|
|
4561
4624
|
return __awaiter(this, arguments, void 0, function (entities, options) {
|
|
4562
|
-
var epoch, db, progressive, yieldBudgetMs, yieldGate, yieldToEventLoop,
|
|
4625
|
+
var epoch, db, progressive, yieldBudgetMs, yieldGate, yieldToEventLoop, _loop_4, this_2, i;
|
|
4563
4626
|
var _this = this;
|
|
4564
4627
|
var _a, _b, _c, _d;
|
|
4565
4628
|
if (options === void 0) { options = {}; }
|
|
@@ -4586,7 +4649,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4586
4649
|
yieldToEventLoop = function () {
|
|
4587
4650
|
return new Promise(function (resolve) { return setTimeout(resolve, 0); });
|
|
4588
4651
|
};
|
|
4589
|
-
|
|
4652
|
+
_loop_4 = function (i) {
|
|
4590
4653
|
var entity, shouldConvert, objectId_1, convertGen_1, directMeta, added, superseded, threeEntity_1, isMultiLayerGroup, deferGeometry, isExtendBbox_1, commitEntity, fileName, error_3, failedId, didYield;
|
|
4591
4654
|
return __generator(this, function (_f) {
|
|
4592
4655
|
switch (_f.label) {
|
|
@@ -4825,7 +4888,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4825
4888
|
_e.label = 1;
|
|
4826
4889
|
case 1:
|
|
4827
4890
|
if (!(i < entities.length)) return [3 /*break*/, 4];
|
|
4828
|
-
return [5 /*yield**/,
|
|
4891
|
+
return [5 /*yield**/, _loop_4(i)];
|
|
4829
4892
|
case 2:
|
|
4830
4893
|
_e.sent();
|
|
4831
4894
|
_e.label = 3;
|
|
@@ -4865,8 +4928,8 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4865
4928
|
};
|
|
4866
4929
|
AcTrView2d.prototype.handleGroup = function (group_1, progressive_1) {
|
|
4867
4930
|
return __awaiter(this, arguments, void 0, function (group, progressive, epoch, convertGen) {
|
|
4868
|
-
var t0, objectId, children, objectsGroupByLayer_2, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, lazyChildren, groupChildBoxes, aggregateSpatialBbox, registeredChildIndex, yieldToEventLoop, lastGroupYieldAt,
|
|
4869
|
-
var
|
|
4931
|
+
var t0, objectId, children, objectsGroupByLayer_2, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, lazyChildren, groupChildBoxes, aggregateSpatialBbox, registeredChildIndex, yieldToEventLoop, lastGroupYieldAt, _loop_5, this_3, objectsGroupByLayer_1, objectsGroupByLayer_1_1, _a, layerName, objects, e_21_1;
|
|
4932
|
+
var e_22, _b, e_21, _c;
|
|
4870
4933
|
var _this = this;
|
|
4871
4934
|
var _d, _e;
|
|
4872
4935
|
if (epoch === void 0) { epoch = this._convertEpoch; }
|
|
@@ -4921,12 +4984,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4921
4984
|
child.parent = null;
|
|
4922
4985
|
}
|
|
4923
4986
|
}
|
|
4924
|
-
catch (
|
|
4987
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
4925
4988
|
finally {
|
|
4926
4989
|
try {
|
|
4927
4990
|
if (children_1_1 && !children_1_1.done && (_b = children_1.return)) _b.call(children_1);
|
|
4928
4991
|
}
|
|
4929
|
-
finally { if (
|
|
4992
|
+
finally { if (e_22) throw e_22.error; }
|
|
4930
4993
|
}
|
|
4931
4994
|
renderContext = group.renderContext;
|
|
4932
4995
|
groupObjectId = group.objectId;
|
|
@@ -4957,7 +5020,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
4957
5020
|
return new Promise(function (resolve) { return setTimeout(resolve, 0); });
|
|
4958
5021
|
};
|
|
4959
5022
|
lastGroupYieldAt = progressive ? performance.now() : 0;
|
|
4960
|
-
|
|
5023
|
+
_loop_5 = function (layerName, objects) {
|
|
4961
5024
|
var effectiveLayerName, sourceLayerForMaterials, entity, entityUserData, i, tAdd;
|
|
4962
5025
|
return __generator(this, function (_g) {
|
|
4963
5026
|
switch (_g.label) {
|
|
@@ -5032,7 +5095,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
5032
5095
|
case 4:
|
|
5033
5096
|
if (!!objectsGroupByLayer_1_1.done) return [3 /*break*/, 7];
|
|
5034
5097
|
_a = __read(objectsGroupByLayer_1_1.value, 2), layerName = _a[0], objects = _a[1];
|
|
5035
|
-
return [5 /*yield**/,
|
|
5098
|
+
return [5 /*yield**/, _loop_5(layerName, objects)];
|
|
5036
5099
|
case 5:
|
|
5037
5100
|
_f.sent();
|
|
5038
5101
|
_f.label = 6;
|
|
@@ -5041,14 +5104,14 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
5041
5104
|
return [3 /*break*/, 4];
|
|
5042
5105
|
case 7: return [3 /*break*/, 10];
|
|
5043
5106
|
case 8:
|
|
5044
|
-
|
|
5045
|
-
|
|
5107
|
+
e_21_1 = _f.sent();
|
|
5108
|
+
e_21 = { error: e_21_1 };
|
|
5046
5109
|
return [3 /*break*/, 10];
|
|
5047
5110
|
case 9:
|
|
5048
5111
|
try {
|
|
5049
5112
|
if (objectsGroupByLayer_1_1 && !objectsGroupByLayer_1_1.done && (_c = objectsGroupByLayer_1.return)) _c.call(objectsGroupByLayer_1);
|
|
5050
5113
|
}
|
|
5051
|
-
finally { if (
|
|
5114
|
+
finally { if (e_21) throw e_21.error; }
|
|
5052
5115
|
return [7 /*endfinally*/];
|
|
5053
5116
|
case 10:
|
|
5054
5117
|
group.dispose();
|
|
@@ -5165,7 +5228,9 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
5165
5228
|
if (!mtextRenderer.getMeshGlyphInstancing()) {
|
|
5166
5229
|
return;
|
|
5167
5230
|
}
|
|
5168
|
-
var _a = mtextRenderer.flushMeshGlyphInstances(this._scene.internalScene, function (layerName) {
|
|
5231
|
+
var _a = mtextRenderer.flushMeshGlyphInstances(this._scene.internalScene, function (layerName, ownerId) {
|
|
5232
|
+
return _this.resolveMeshGlyphLayerParent(layerName, ownerId);
|
|
5233
|
+
}), placements = _a.placements, buckets = _a.buckets;
|
|
5169
5234
|
if (placements > 0) {
|
|
5170
5235
|
// Prefix for headless CLI console forwarding.
|
|
5171
5236
|
console.log("[cad-simple-viewer-cli] mesh glyph InstancedMesh flush: placements=".concat(placements, " buckets=").concat(buckets));
|
|
@@ -5175,32 +5240,44 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
5175
5240
|
}
|
|
5176
5241
|
};
|
|
5177
5242
|
/**
|
|
5178
|
-
*
|
|
5179
|
-
*
|
|
5180
|
-
*
|
|
5243
|
+
* Parents mesh glyphs under the layout that owns the entity.
|
|
5244
|
+
*
|
|
5245
|
+
* Every layout has a layer group for each layer name. Preferring the active
|
|
5246
|
+
* layout puts model-space TrueType text into the paper-space group while a
|
|
5247
|
+
* paper layout is current, so viewports (which draw model space) never see
|
|
5248
|
+
* it. When `ownerId` names a layout, only that layout's layer is used.
|
|
5249
|
+
* Glyphs with no layout owner still follow the active layout.
|
|
5181
5250
|
*/
|
|
5182
|
-
AcTrView2d.prototype.resolveMeshGlyphLayerParent = function (layerName) {
|
|
5183
|
-
var
|
|
5184
|
-
var _b;
|
|
5185
|
-
var
|
|
5251
|
+
AcTrView2d.prototype.resolveMeshGlyphLayerParent = function (layerName, ownerId) {
|
|
5252
|
+
var e_23, _a;
|
|
5253
|
+
var _b, _c, _d;
|
|
5254
|
+
var owner = ownerId === null || ownerId === void 0 ? void 0 : ownerId.trim();
|
|
5255
|
+
if (owner) {
|
|
5256
|
+
var layout = this._scene.layouts.get(owner);
|
|
5257
|
+
if (!layout) {
|
|
5258
|
+
return null;
|
|
5259
|
+
}
|
|
5260
|
+
return (_c = (_b = layout.getLayer(layerName)) === null || _b === void 0 ? void 0 : _b.internalObject) !== null && _c !== void 0 ? _c : null;
|
|
5261
|
+
}
|
|
5262
|
+
var active = (_d = this._scene.activeLayout) === null || _d === void 0 ? void 0 : _d.getLayer(layerName);
|
|
5186
5263
|
if (active) {
|
|
5187
5264
|
return active.internalObject;
|
|
5188
5265
|
}
|
|
5189
5266
|
try {
|
|
5190
|
-
for (var
|
|
5191
|
-
var layout =
|
|
5267
|
+
for (var _e = __values(this._scene.layouts.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
5268
|
+
var layout = _f.value;
|
|
5192
5269
|
var layer = layout.getLayer(layerName);
|
|
5193
5270
|
if (layer) {
|
|
5194
5271
|
return layer.internalObject;
|
|
5195
5272
|
}
|
|
5196
5273
|
}
|
|
5197
5274
|
}
|
|
5198
|
-
catch (
|
|
5275
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
5199
5276
|
finally {
|
|
5200
5277
|
try {
|
|
5201
|
-
if (
|
|
5278
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
5202
5279
|
}
|
|
5203
|
-
finally { if (
|
|
5280
|
+
finally { if (e_23) throw e_23.error; }
|
|
5204
5281
|
}
|
|
5205
5282
|
return null;
|
|
5206
5283
|
};
|