@mlightcad/cad-simple-viewer 1.7.8-preview.0 → 1.7.8-preview.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.
Files changed (121) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +190 -190
  3. package/dist/cad-simple-viewer.js +10120 -8596
  4. package/dist/cad-simple-viewer.umd.cjs +82 -82
  5. package/find.ts +7 -7
  6. package/icons.ts +7 -7
  7. package/lib/app/AcApContext.d.ts.map +1 -1
  8. package/lib/app/AcApContext.js +10 -1
  9. package/lib/app/AcApContext.js.map +1 -1
  10. package/lib/app/AcApDocManager.d.ts.map +1 -1
  11. package/lib/app/AcApDocManager.js +28 -2
  12. package/lib/app/AcApDocManager.js.map +1 -1
  13. package/lib/command/AcApObjectScaleCmd.d.ts +12 -0
  14. package/lib/command/AcApObjectScaleCmd.d.ts.map +1 -0
  15. package/lib/command/AcApObjectScaleCmd.js +193 -0
  16. package/lib/command/AcApObjectScaleCmd.js.map +1 -0
  17. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  18. package/lib/command/AcApSysVarCmd.js +2 -0
  19. package/lib/command/AcApSysVarCmd.js.map +1 -1
  20. package/lib/command/draw/AcApDimAlignedCmd.d.ts +21 -0
  21. package/lib/command/draw/AcApDimAlignedCmd.d.ts.map +1 -0
  22. package/lib/command/draw/AcApDimAlignedCmd.js +218 -0
  23. package/lib/command/draw/AcApDimAlignedCmd.js.map +1 -0
  24. package/lib/command/draw/AcApDimAngularCmd.d.ts +27 -0
  25. package/lib/command/draw/AcApDimAngularCmd.d.ts.map +1 -0
  26. package/lib/command/draw/AcApDimAngularCmd.js +264 -0
  27. package/lib/command/draw/AcApDimAngularCmd.js.map +1 -0
  28. package/lib/command/draw/AcApDimArcCmd.d.ts +26 -0
  29. package/lib/command/draw/AcApDimArcCmd.d.ts.map +1 -0
  30. package/lib/command/draw/AcApDimArcCmd.js +184 -0
  31. package/lib/command/draw/AcApDimArcCmd.js.map +1 -0
  32. package/lib/command/draw/AcApDimBlockUtil.d.ts +40 -0
  33. package/lib/command/draw/AcApDimBlockUtil.d.ts.map +1 -0
  34. package/lib/command/draw/AcApDimBlockUtil.js +290 -0
  35. package/lib/command/draw/AcApDimBlockUtil.js.map +1 -0
  36. package/lib/command/draw/AcApDimChainUtil.d.ts +13 -0
  37. package/lib/command/draw/AcApDimChainUtil.d.ts.map +1 -0
  38. package/lib/command/draw/AcApDimChainUtil.js +140 -0
  39. package/lib/command/draw/AcApDimChainUtil.js.map +1 -0
  40. package/lib/command/draw/AcApDimCmdUtil.d.ts +22 -0
  41. package/lib/command/draw/AcApDimCmdUtil.d.ts.map +1 -0
  42. package/lib/command/draw/AcApDimCmdUtil.js +125 -0
  43. package/lib/command/draw/AcApDimCmdUtil.js.map +1 -0
  44. package/lib/command/draw/AcApDimContinueCmd.d.ts +13 -0
  45. package/lib/command/draw/AcApDimContinueCmd.d.ts.map +1 -0
  46. package/lib/command/draw/AcApDimContinueCmd.js +204 -0
  47. package/lib/command/draw/AcApDimContinueCmd.js.map +1 -0
  48. package/lib/command/draw/AcApDimDiameterCmd.d.ts +27 -0
  49. package/lib/command/draw/AcApDimDiameterCmd.d.ts.map +1 -0
  50. package/lib/command/draw/AcApDimDiameterCmd.js +204 -0
  51. package/lib/command/draw/AcApDimDiameterCmd.js.map +1 -0
  52. package/lib/command/draw/AcApDimLinearCmd.d.ts +10 -13
  53. package/lib/command/draw/AcApDimLinearCmd.d.ts.map +1 -1
  54. package/lib/command/draw/AcApDimLinearCmd.js +161 -97
  55. package/lib/command/draw/AcApDimLinearCmd.js.map +1 -1
  56. package/lib/command/draw/AcApDimOrdinateCmd.d.ts +22 -0
  57. package/lib/command/draw/AcApDimOrdinateCmd.d.ts.map +1 -0
  58. package/lib/command/draw/AcApDimOrdinateCmd.js +186 -0
  59. package/lib/command/draw/AcApDimOrdinateCmd.js.map +1 -0
  60. package/lib/command/draw/AcApDimRadiusCmd.d.ts +28 -0
  61. package/lib/command/draw/AcApDimRadiusCmd.d.ts.map +1 -0
  62. package/lib/command/draw/AcApDimRadiusCmd.js +206 -0
  63. package/lib/command/draw/AcApDimRadiusCmd.js.map +1 -0
  64. package/lib/command/draw/index.d.ts +9 -0
  65. package/lib/command/draw/index.d.ts.map +1 -1
  66. package/lib/command/draw/index.js +9 -0
  67. package/lib/command/draw/index.js.map +1 -1
  68. package/lib/command/index.d.ts +1 -0
  69. package/lib/command/index.d.ts.map +1 -1
  70. package/lib/command/index.js +1 -0
  71. package/lib/command/index.js.map +1 -1
  72. package/lib/i18n/ar/command.d.ts +34 -0
  73. package/lib/i18n/ar/command.d.ts.map +1 -1
  74. package/lib/i18n/ar/command.js +1 -1
  75. package/lib/i18n/ar/command.js.map +1 -1
  76. package/lib/i18n/ar/jig.d.ts +244 -0
  77. package/lib/i18n/ar/jig.d.ts.map +1 -1
  78. package/lib/i18n/ar/jig.js +1 -1
  79. package/lib/i18n/ar/jig.js.map +1 -1
  80. package/lib/i18n/cs/command.d.ts +24 -0
  81. package/lib/i18n/cs/command.d.ts.map +1 -1
  82. package/lib/i18n/cs/command.js +24 -0
  83. package/lib/i18n/cs/command.js.map +1 -1
  84. package/lib/i18n/cs/jig.d.ts +221 -0
  85. package/lib/i18n/cs/jig.d.ts.map +1 -1
  86. package/lib/i18n/cs/jig.js +21 -5
  87. package/lib/i18n/cs/jig.js.map +1 -1
  88. package/lib/i18n/en/command.d.ts +34 -0
  89. package/lib/i18n/en/command.d.ts.map +1 -1
  90. package/lib/i18n/en/command.js +34 -0
  91. package/lib/i18n/en/command.js.map +1 -1
  92. package/lib/i18n/en/jig.d.ts +244 -0
  93. package/lib/i18n/en/jig.d.ts.map +1 -1
  94. package/lib/i18n/en/jig.js +147 -3
  95. package/lib/i18n/en/jig.js.map +1 -1
  96. package/lib/i18n/tr/command.d.ts +24 -0
  97. package/lib/i18n/tr/command.d.ts.map +1 -1
  98. package/lib/i18n/tr/command.js +24 -0
  99. package/lib/i18n/tr/command.js.map +1 -1
  100. package/lib/i18n/tr/jig.d.ts +221 -0
  101. package/lib/i18n/tr/jig.d.ts.map +1 -1
  102. package/lib/i18n/tr/jig.js +21 -5
  103. package/lib/i18n/tr/jig.js.map +1 -1
  104. package/lib/i18n/zh/command.d.ts +34 -0
  105. package/lib/i18n/zh/command.d.ts.map +1 -1
  106. package/lib/i18n/zh/command.js +34 -0
  107. package/lib/i18n/zh/command.js.map +1 -1
  108. package/lib/i18n/zh/jig.d.ts +244 -0
  109. package/lib/i18n/zh/jig.d.ts.map +1 -1
  110. package/lib/i18n/zh/jig.js +135 -3
  111. package/lib/i18n/zh/jig.js.map +1 -1
  112. package/lib/view/AcTrView2d.d.ts +28 -0
  113. package/lib/view/AcTrView2d.d.ts.map +1 -1
  114. package/lib/view/AcTrView2d.js +147 -74
  115. package/lib/view/AcTrView2d.js.map +1 -1
  116. package/package.json +5 -5
  117. package/src/find/AcApFindNavigator.ts +190 -190
  118. package/src/find/findDrawing.ts +211 -211
  119. package/src/find/findText.ts +624 -624
  120. package/src/find/index.ts +2 -2
  121. package/src/ui/icons.ts +411 -411
@@ -317,6 +317,20 @@ var AcTrView2d = /** @class */ (function (_super) {
317
317
  * document open.
318
318
  */
319
319
  _this._convertEpoch = 0;
320
+ /**
321
+ * Per-objectId generation for transient overlay draws. Each
322
+ * {@link addTransientEntity} / {@link removeTransientEntity} bumps the
323
+ * counter so a stale `asyncDraw` cannot publish an older jig frame after a
324
+ * newer cursor update already started.
325
+ */
326
+ _this._transientDrawGeneration = new Map();
327
+ /**
328
+ * Nested count of in-flight transient convert/asyncDraw passes that need
329
+ * {@link AcTrRenderContext.skipMeshGlyphInstancing}. Kept elevated until
330
+ * every jig `asyncDraw` finishes so nested MTEXT cannot enqueue world
331
+ * InstancedMesh slots mid-preview.
332
+ */
333
+ _this._transientSkipMeshGlyphDepth = 0;
320
334
  /** Last time progressive open actually painted mid-convert. */
321
335
  _this._lastProgressivePaintAt = 0;
322
336
  /**
@@ -2603,46 +2617,73 @@ var AcTrView2d = /** @class */ (function (_super) {
2603
2617
  */
2604
2618
  AcTrView2d.prototype.addTransientEntity = function (entity) {
2605
2619
  var _this = this;
2620
+ var _a, _b;
2606
2621
  var entities = Array.isArray(entity) ? entity : [entity];
2607
2622
  var epoch = this._convertEpoch;
2608
2623
  // Overlay transients (markup / measurement / jigs) must honor entity
2609
2624
  // lineweight even when LWDISPLAY is off; otherwise ribbon style is a no-op.
2610
2625
  var previousForce = this._renderer.forceShowLineWeight;
2611
2626
  this._renderer.forceShowLineWeight = true;
2627
+ // Force merge-mode glyphs on the transient tree (see AcTrMText). Keep the
2628
+ // context flag raised for the whole sync convert so nested MTEXT never
2629
+ // enqueue world InstancedMesh placements that flush after the command.
2630
+ var renderContext = this._renderer.context;
2631
+ this._transientSkipMeshGlyphDepth++;
2632
+ renderContext.skipMeshGlyphInstancing = true;
2633
+ var releaseSkipMeshGlyph = function () {
2634
+ _this._transientSkipMeshGlyphDepth = Math.max(0, _this._transientSkipMeshGlyphDepth - 1);
2635
+ if (_this._transientSkipMeshGlyphDepth === 0) {
2636
+ renderContext.skipMeshGlyphInstancing = false;
2637
+ }
2638
+ };
2612
2639
  try {
2613
- var _loop_2 = function (i) {
2640
+ for (var i = 0; i < entities.length; ++i) {
2614
2641
  var entity_1 = entities[i];
2615
- var threeEntity = this_1.drawEntity(entity_1, true);
2642
+ var objectId = String((_a = entity_1.objectId) !== null && _a !== void 0 ? _a : '');
2643
+ var generation = objectId
2644
+ ? ((_b = this._transientDrawGeneration.get(objectId)) !== null && _b !== void 0 ? _b : 0) + 1
2645
+ : 0;
2646
+ if (objectId) {
2647
+ this._transientDrawGeneration.set(objectId, generation);
2648
+ // Drop live InstancedMesh slots and any not-yet-flushed placements
2649
+ // left by a previous jig frame under the same id.
2650
+ AcTrMTextRenderer.getInstance().removeMeshGlyphInstances(objectId);
2651
+ }
2652
+ var threeEntity = this.drawEntity(entity_1, true);
2616
2653
  if (threeEntity) {
2617
2654
  threeEntity.objectId = entity_1.objectId;
2618
2655
  // Grip/jig clones reuse the live entity objectId. Keep mesh glyphs on
2619
2656
  // the transient tree (merge) so preview cannot enqueue duplicate
2620
2657
  // world InstancedMesh instances that outlive the transient.
2621
2658
  threeEntity.userData.skipMeshGlyphInstancing = true;
2622
- void threeEntity
2623
- .asyncDraw()
2624
- .then(function () {
2625
- // Drop stale transients started before clear()/regen invalidated the view.
2626
- if (epoch !== _this._convertEpoch) {
2627
- threeEntity.dispose();
2628
- return;
2629
- }
2630
- _this._scene.addTransientEntity(threeEntity);
2631
- _this._isDirty = true;
2632
- })
2633
- .catch(function (error) {
2659
+ // Sync draw: asyncDraw + generation discard left previews blank while
2660
+ // the mouse moved, then flushed every enqueued sample when the
2661
+ // command ended. Jig blocks are small enough to bake synchronously.
2662
+ try {
2663
+ threeEntity.syncDraw();
2664
+ }
2665
+ catch (error) {
2634
2666
  log.error('[AcTrView2d] Transient entity geometry failed:', error);
2635
2667
  threeEntity.dispose();
2636
- });
2668
+ continue;
2669
+ }
2670
+ if (epoch !== this._convertEpoch) {
2671
+ threeEntity.dispose();
2672
+ continue;
2673
+ }
2674
+ if (objectId &&
2675
+ this._transientDrawGeneration.get(objectId) !== generation) {
2676
+ threeEntity.dispose();
2677
+ continue;
2678
+ }
2679
+ this._scene.addTransientEntity(threeEntity);
2680
+ this._isDirty = true;
2637
2681
  }
2638
- };
2639
- var this_1 = this;
2640
- for (var i = 0; i < entities.length; ++i) {
2641
- _loop_2(i);
2642
2682
  }
2643
2683
  }
2644
2684
  finally {
2645
2685
  this._renderer.forceShowLineWeight = previousForce;
2686
+ releaseSkipMeshGlyph();
2646
2687
  }
2647
2688
  };
2648
2689
  /**
@@ -2650,6 +2691,11 @@ var AcTrView2d = /** @class */ (function (_super) {
2650
2691
  * @param objectId Input the object id of the transient entity to remove
2651
2692
  */
2652
2693
  AcTrView2d.prototype.removeTransientEntity = function (objectId) {
2694
+ var _a;
2695
+ var id = String(objectId !== null && objectId !== void 0 ? objectId : '');
2696
+ if (id) {
2697
+ this._transientDrawGeneration.set(id, ((_a = this._transientDrawGeneration.get(id)) !== null && _a !== void 0 ? _a : 0) + 1);
2698
+ }
2653
2699
  this._scene.removeTransientEntity(objectId);
2654
2700
  this._isDirty = true;
2655
2701
  };
@@ -2749,9 +2795,33 @@ var AcTrView2d = /** @class */ (function (_super) {
2749
2795
  AcTrView2d.prototype.removeEntity = function (entity) {
2750
2796
  var _this = this;
2751
2797
  var entities = Array.isArray(entity) ? entity : [entity];
2752
- entities.forEach(function (entity) { return _this._scene.removeEntity(entity.objectId); });
2798
+ entities.forEach(function (entity) {
2799
+ _this.releaseConvertClaim(entity.objectId);
2800
+ _this._scene.removeEntity(entity.objectId);
2801
+ });
2753
2802
  this._isDirty = true;
2754
2803
  };
2804
+ /**
2805
+ * Drops convert bookkeeping for an object id that left the scene.
2806
+ *
2807
+ * {@link batchConvert} claims an id before committing geometry and never
2808
+ * releases it while the entity stays in the scene. An undo erases the entity
2809
+ * from the database and calls {@link removeEntity}, but the stale claim made
2810
+ * the follow-up redo pass hit the "already scheduled" skip in
2811
+ * {@link batchConvert}, so the redone entity never reappeared. The generation
2812
+ * bump also prevents an in-flight convert or deferred glyph commit for the
2813
+ * same id from re-adding geometry after the erase.
2814
+ *
2815
+ * @param objectId - Object id leaving the scene
2816
+ */
2817
+ AcTrView2d.prototype.releaseConvertClaim = function (objectId) {
2818
+ var _a;
2819
+ var id = String(objectId !== null && objectId !== void 0 ? objectId : '');
2820
+ if (!id)
2821
+ return;
2822
+ this._claimedConvertObjectIds.delete(id);
2823
+ this._entityConvertGeneration.set(id, ((_a = this._entityConvertGeneration.get(id)) !== null && _a !== void 0 ? _a : 0) + 1);
2824
+ };
2755
2825
  /**
2756
2826
  * @inheritdoc
2757
2827
  */
@@ -4301,15 +4371,15 @@ var AcTrView2d = /** @class */ (function (_super) {
4301
4371
  */
4302
4372
  AcTrView2d.prototype.pumpDeferredGeometryQueue = function () {
4303
4373
  var _this = this;
4304
- var _loop_3 = function () {
4305
- var job = this_2._deferredGeometryQueue.shift();
4306
- if (job.epoch !== this_2._convertEpoch) {
4307
- this_2._pendingGeometryJobs = Math.max(0, this_2._pendingGeometryJobs - 1);
4374
+ var _loop_2 = function () {
4375
+ var job = this_1._deferredGeometryQueue.shift();
4376
+ if (job.epoch !== this_1._convertEpoch) {
4377
+ this_1._pendingGeometryJobs = Math.max(0, this_1._pendingGeometryJobs - 1);
4308
4378
  return "continue";
4309
4379
  }
4310
- this_2._convertPhaseMs.finishGeometryQueueWait +=
4380
+ this_1._convertPhaseMs.finishGeometryQueueWait +=
4311
4381
  performance.now() - job.enqueuedAt;
4312
- this_2._deferredGeometryActive++;
4382
+ this_1._deferredGeometryActive++;
4313
4383
  void job
4314
4384
  .run()
4315
4385
  .then(function () {
@@ -4338,10 +4408,10 @@ var AcTrView2d = /** @class */ (function (_super) {
4338
4408
  _this.pumpDeferredGeometryQueue();
4339
4409
  });
4340
4410
  };
4341
- var this_2 = this;
4411
+ var this_1 = this;
4342
4412
  while (this._deferredGeometryActive < AcTrView2d.DEFERRED_GEOMETRY_CONCURRENCY &&
4343
4413
  this._deferredGeometryQueue.length > 0) {
4344
- _loop_3();
4414
+ _loop_2();
4345
4415
  }
4346
4416
  };
4347
4417
  /** Drops queued deferred geometry and resets counters for a new epoch. */
@@ -4489,7 +4559,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4489
4559
  */
4490
4560
  AcTrView2d.prototype.batchConvert = function (entities_3) {
4491
4561
  return __awaiter(this, arguments, void 0, function (entities, options) {
4492
- var epoch, db, progressive, yieldBudgetMs, yieldGate, yieldToEventLoop, _loop_4, this_3, i;
4562
+ var epoch, db, progressive, yieldBudgetMs, yieldGate, yieldToEventLoop, _loop_3, this_2, i;
4493
4563
  var _this = this;
4494
4564
  var _a, _b, _c, _d;
4495
4565
  if (options === void 0) { options = {}; }
@@ -4516,7 +4586,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4516
4586
  yieldToEventLoop = function () {
4517
4587
  return new Promise(function (resolve) { return setTimeout(resolve, 0); });
4518
4588
  };
4519
- _loop_4 = function (i) {
4589
+ _loop_3 = function (i) {
4520
4590
  var entity, shouldConvert, objectId_1, convertGen_1, directMeta, added, superseded, threeEntity_1, isMultiLayerGroup, deferGeometry, isExtendBbox_1, commitEntity, fileName, error_3, failedId, didYield;
4521
4591
  return __generator(this, function (_f) {
4522
4592
  switch (_f.label) {
@@ -4526,7 +4596,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4526
4596
  case 1:
4527
4597
  _f.trys.push([1, 9, 10, 11]);
4528
4598
  // Document was cleared / replaced while this batch was draining.
4529
- if (epoch !== this_3._convertEpoch) {
4599
+ if (epoch !== this_2._convertEpoch) {
4530
4600
  return [2 /*return*/, "continue"];
4531
4601
  }
4532
4602
  // Skip the default paper-space viewport (`*Paper_Space`) entirely:
@@ -4544,48 +4614,48 @@ var AcTrView2d = /** @class */ (function (_super) {
4544
4614
  AcTrViewportView.isDefaultPaperSpaceViewport(entity)) {
4545
4615
  return [2 /*return*/, "continue"];
4546
4616
  }
4547
- shouldConvert = options.forExport || this_3._convertInvisibleLayers
4548
- ? this_3._entityDisplay.shouldConvertForExport(entity)
4549
- : this_3._entityDisplay.shouldConvert(entity);
4617
+ shouldConvert = options.forExport || this_2._convertInvisibleLayers
4618
+ ? this_2._entityDisplay.shouldConvertForExport(entity)
4619
+ : this_2._entityDisplay.shouldConvert(entity);
4550
4620
  if (!shouldConvert) {
4551
4621
  return [2 /*return*/, "continue"];
4552
4622
  }
4553
4623
  objectId_1 = String((_a = entity.objectId) !== null && _a !== void 0 ? _a : '');
4554
4624
  convertGen_1 = 0;
4555
4625
  if (objectId_1 &&
4556
- (this_3.hasEntity(objectId_1) ||
4557
- this_3._claimedConvertObjectIds.has(objectId_1))) {
4626
+ (this_2.hasEntity(objectId_1) ||
4627
+ this_2._claimedConvertObjectIds.has(objectId_1))) {
4558
4628
  // The border may already be in the scene from a pass that ran
4559
4629
  // before the layout view existed. Still attach the viewport
4560
4630
  // view; a second border is not drawn because we continue below.
4561
4631
  if (entity instanceof AcDbViewport) {
4562
- this_3.attachViewportView(entity);
4632
+ this_2.attachViewportView(entity);
4563
4633
  }
4564
4634
  return [2 /*return*/, "continue"];
4565
4635
  }
4566
4636
  if (objectId_1) {
4567
- this_3._claimedConvertObjectIds.add(objectId_1);
4568
- convertGen_1 = (_b = this_3._entityConvertGeneration.get(objectId_1)) !== null && _b !== void 0 ? _b : 0;
4637
+ this_2._claimedConvertObjectIds.add(objectId_1);
4638
+ convertGen_1 = (_b = this_2._entityConvertGeneration.get(objectId_1)) !== null && _b !== void 0 ? _b : 0;
4569
4639
  }
4570
- directMeta = tryBuildDirectEntityMeta(entity, this_3._renderer);
4640
+ directMeta = tryBuildDirectEntityMeta(entity, this_2._renderer);
4571
4641
  if (directMeta) {
4572
4642
  added = false;
4573
4643
  superseded = false;
4574
4644
  try {
4575
4645
  if (objectId_1 &&
4576
- ((_c = this_3._entityConvertGeneration.get(objectId_1)) !== null && _c !== void 0 ? _c : 0) !== convertGen_1) {
4646
+ ((_c = this_2._entityConvertGeneration.get(objectId_1)) !== null && _c !== void 0 ? _c : 0) !== convertGen_1) {
4577
4647
  superseded = true;
4578
4648
  }
4579
4649
  else {
4580
- added = this_3._scene.addDirectEntity(directMeta, shouldExtendBboxForDirectEntity(entity));
4650
+ added = this_2._scene.addDirectEntity(directMeta, shouldExtendBboxForDirectEntity(entity));
4581
4651
  if (added) {
4582
- this_3.applySessionHiddenObjectState(entity.objectId);
4652
+ this_2.applySessionHiddenObjectState(entity.objectId);
4583
4653
  if (progressive) {
4584
- this_3.markProgressiveDirty();
4585
- this_3._progressiveOpenFit.afterGeometryBatch(function () { return _this.getDrawingExtents(); }, i);
4654
+ this_2.markProgressiveDirty();
4655
+ this_2._progressiveOpenFit.afterGeometryBatch(function () { return _this.getDrawingExtents(); }, i);
4586
4656
  }
4587
4657
  else {
4588
- this_3.markInteractiveOpenDirty();
4658
+ this_2.markInteractiveOpenDirty();
4589
4659
  }
4590
4660
  }
4591
4661
  }
@@ -4598,14 +4668,14 @@ var AcTrView2d = /** @class */ (function (_super) {
4598
4668
  }
4599
4669
  // Append refused (e.g. invisible) — fall through to the legacy path.
4600
4670
  }
4601
- threeEntity_1 = this_3.drawEntity(entity, false);
4671
+ threeEntity_1 = this_2.drawEntity(entity, false);
4602
4672
  // Viewports may produce no border geometry (e.g. on a no-plot layer) while
4603
4673
  // still needing an AcTrViewportView for model content below.
4604
4674
  if (!threeEntity_1 && !(entity instanceof AcDbViewport)) {
4605
4675
  // Release the claim so a later export pass can retry; otherwise
4606
4676
  // `forExport` claim checks would skip this id forever.
4607
4677
  if (objectId_1) {
4608
- this_3._claimedConvertObjectIds.delete(objectId_1);
4678
+ this_2._claimedConvertObjectIds.delete(objectId_1);
4609
4679
  }
4610
4680
  return [2 /*return*/, "continue"];
4611
4681
  }
@@ -4624,14 +4694,14 @@ var AcTrView2d = /** @class */ (function (_super) {
4624
4694
  }
4625
4695
  isMultiLayerGroup = threeEntity_1 instanceof AcTrGroup &&
4626
4696
  !threeEntity_1.isOnTheSameLayer;
4627
- deferGeometry = !options.forExport && this_3.needsDeferredFontGeometry(threeEntity_1);
4697
+ deferGeometry = !options.forExport && this_2.needsDeferredFontGeometry(threeEntity_1);
4628
4698
  if (!isMultiLayerGroup) return [3 /*break*/, 5];
4629
4699
  if (!deferGeometry) return [3 /*break*/, 2];
4630
- this_3.enqueueDeferredGeometry(function () {
4700
+ this_2.enqueueDeferredGeometry(function () {
4631
4701
  return _this.handleGroup(threeEntity_1, progressive, epoch, convertGen_1);
4632
4702
  }, epoch);
4633
4703
  return [3 /*break*/, 4];
4634
- case 2: return [4 /*yield*/, this_3.handleGroup(threeEntity_1, progressive, epoch, convertGen_1)];
4704
+ case 2: return [4 /*yield*/, this_2.handleGroup(threeEntity_1, progressive, epoch, convertGen_1)];
4635
4705
  case 3:
4636
4706
  _f.sent();
4637
4707
  _f.label = 4;
@@ -4681,14 +4751,14 @@ var AcTrView2d = /** @class */ (function (_super) {
4681
4751
  });
4682
4752
  }); };
4683
4753
  if (!deferGeometry) return [3 /*break*/, 6];
4684
- this_3.enqueueDeferredGeometry(commitEntity, epoch);
4754
+ this_2.enqueueDeferredGeometry(commitEntity, epoch);
4685
4755
  return [3 /*break*/, 8];
4686
4756
  case 6: return [4 /*yield*/, commitEntity()];
4687
4757
  case 7:
4688
4758
  _f.sent();
4689
4759
  _f.label = 8;
4690
4760
  case 8:
4691
- if (epoch !== this_3._convertEpoch) {
4761
+ if (epoch !== this_2._convertEpoch) {
4692
4762
  return [2 /*return*/, "continue"];
4693
4763
  }
4694
4764
  if (entity instanceof AcDbViewport) {
@@ -4697,15 +4767,15 @@ var AcTrView2d = /** @class */ (function (_super) {
4697
4767
  // user-created viewport. The redundant check below is kept as
4698
4768
  // a defensive guard in case a future refactor reorders the
4699
4769
  // early-skip — it costs ~nothing and prevents a regression.
4700
- this_3.attachViewportView(entity);
4770
+ this_2.attachViewportView(entity);
4701
4771
  }
4702
4772
  else if (entity instanceof AcDbRasterImage) {
4703
4773
  fileName = entity.imageFileName;
4704
4774
  if (fileName && !entity.image) {
4705
- this_3._missedImages.set(entity.objectId, fileName);
4775
+ this_2._missedImages.set(entity.objectId, fileName);
4706
4776
  }
4707
4777
  else if (entity.image) {
4708
- this_3._missedImages.delete(entity.objectId);
4778
+ this_2._missedImages.delete(entity.objectId);
4709
4779
  }
4710
4780
  }
4711
4781
  return [3 /*break*/, 11];
@@ -4713,25 +4783,25 @@ var AcTrView2d = /** @class */ (function (_super) {
4713
4783
  error_3 = _f.sent();
4714
4784
  failedId = String((_d = entity.objectId) !== null && _d !== void 0 ? _d : '');
4715
4785
  if (failedId) {
4716
- this_3._claimedConvertObjectIds.delete(failedId);
4786
+ this_2._claimedConvertObjectIds.delete(failedId);
4717
4787
  }
4718
4788
  log.error("[AcTrView2d] Failed to convert entity ".concat(entity.objectId, " (").concat(entity.type, "):"), error_3);
4719
4789
  return [3 /*break*/, 11];
4720
4790
  case 10:
4721
4791
  // Counter was reset in clear() when the epoch advanced; do not
4722
4792
  // decrease again or isProcessingEntities can go negative/warn.
4723
- if (epoch === this_3._convertEpoch) {
4724
- this_3.decreaseNumOfEntitiesToProcess();
4793
+ if (epoch === this_2._convertEpoch) {
4794
+ this_2.decreaseNumOfEntitiesToProcess();
4725
4795
  }
4726
4796
  return [7 /*endfinally*/];
4727
4797
  case 11:
4728
- if (epoch !== this_3._convertEpoch) {
4798
+ if (epoch !== this_2._convertEpoch) {
4729
4799
  return [2 /*return*/, "continue"];
4730
4800
  }
4731
4801
  if (!progressive) return [3 /*break*/, 13];
4732
4802
  // Prefer input-aware yields so pan/zoom are not starved after the
4733
4803
  // overlay is gone; paint throttling stays in markProgressiveDirty.
4734
- return [4 /*yield*/, this_3.progressiveYieldForInput(yieldGate, yieldToEventLoop)];
4804
+ return [4 /*yield*/, this_2.progressiveYieldForInput(yieldGate, yieldToEventLoop)];
4735
4805
  case 12:
4736
4806
  // Prefer input-aware yields so pan/zoom are not starved after the
4737
4807
  // overlay is gone; paint throttling stays in markProgressiveDirty.
@@ -4743,19 +4813,19 @@ var AcTrView2d = /** @class */ (function (_super) {
4743
4813
  case 14:
4744
4814
  didYield = _f.sent();
4745
4815
  if (didYield) {
4746
- this_3._progressiveYieldCount++;
4816
+ this_2._progressiveYieldCount++;
4747
4817
  }
4748
4818
  _f.label = 15;
4749
4819
  case 15: return [2 /*return*/];
4750
4820
  }
4751
4821
  });
4752
4822
  };
4753
- this_3 = this;
4823
+ this_2 = this;
4754
4824
  i = 0;
4755
4825
  _e.label = 1;
4756
4826
  case 1:
4757
4827
  if (!(i < entities.length)) return [3 /*break*/, 4];
4758
- return [5 /*yield**/, _loop_4(i)];
4828
+ return [5 /*yield**/, _loop_3(i)];
4759
4829
  case 2:
4760
4830
  _e.sent();
4761
4831
  _e.label = 3;
@@ -4795,7 +4865,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4795
4865
  };
4796
4866
  AcTrView2d.prototype.handleGroup = function (group_1, progressive_1) {
4797
4867
  return __awaiter(this, arguments, void 0, function (group, progressive, epoch, convertGen) {
4798
- var t0, objectId, children, objectsGroupByLayer_2, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, lazyChildren, groupChildBoxes, aggregateSpatialBbox, registeredChildIndex, yieldToEventLoop, lastGroupYieldAt, _loop_5, this_4, objectsGroupByLayer_1, objectsGroupByLayer_1_1, _a, layerName, objects, e_20_1;
4868
+ var t0, objectId, children, objectsGroupByLayer_2, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, lazyChildren, groupChildBoxes, aggregateSpatialBbox, registeredChildIndex, yieldToEventLoop, lastGroupYieldAt, _loop_4, this_3, objectsGroupByLayer_1, objectsGroupByLayer_1_1, _a, layerName, objects, e_20_1;
4799
4869
  var e_21, _b, e_20, _c;
4800
4870
  var _this = this;
4801
4871
  var _d, _e;
@@ -4887,7 +4957,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4887
4957
  return new Promise(function (resolve) { return setTimeout(resolve, 0); });
4888
4958
  };
4889
4959
  lastGroupYieldAt = progressive ? performance.now() : 0;
4890
- _loop_5 = function (layerName, objects) {
4960
+ _loop_4 = function (layerName, objects) {
4891
4961
  var effectiveLayerName, sourceLayerForMaterials, entity, entityUserData, i, tAdd;
4892
4962
  return __generator(this, function (_g) {
4893
4963
  switch (_g.label) {
@@ -4903,7 +4973,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4903
4973
  // Keep runtime layer metadata/material cache aligned with the inherited layer so
4904
4974
  // later layer style edits (color, linetype, lineweight, transparency) target this
4905
4975
  // object set correctly.
4906
- this_4._inheritedLayerMaterialMapper.remap(objects, sourceLayerForMaterials, effectiveLayerName);
4976
+ this_3._inheritedLayerMaterialMapper.remap(objects, sourceLayerForMaterials, effectiveLayerName);
4907
4977
  entity = new AcTrEntity(renderContext);
4908
4978
  // Copy the INSERT matrix exactly — applyMatrix4 decomposes and drops
4909
4979
  // reflections from mirrored block scales.
@@ -4934,14 +5004,14 @@ var AcTrView2d = /** @class */ (function (_super) {
4934
5004
  entity.add(objects[i]);
4935
5005
  }
4936
5006
  entity.updateMatrixWorld(true);
4937
- this_4._layerAppearance.refreshTextMaterialsInObjectTree(entity);
5007
+ this_3._layerAppearance.refreshTextMaterialsInObjectTree(entity);
4938
5008
  tAdd = performance.now();
4939
- this_4._scene.addEntity(entity, true);
4940
- this_4._convertPhaseMs.addEntity += performance.now() - tAdd;
4941
- this_4.applySessionHiddenObjectState(groupObjectId);
5009
+ this_3._scene.addEntity(entity, true);
5010
+ this_3._convertPhaseMs.addEntity += performance.now() - tAdd;
5011
+ this_3.applySessionHiddenObjectState(groupObjectId);
4942
5012
  entity.dispose();
4943
5013
  if (!(progressive &&
4944
- epoch === this_4._convertEpoch &&
5014
+ epoch === this_3._convertEpoch &&
4945
5015
  performance.now() - lastGroupYieldAt >=
4946
5016
  AcTrView2d.PROGRESSIVE_OPEN_YIELD_BUDGET_MS)) return [3 /*break*/, 2];
4947
5017
  return [4 /*yield*/, yieldToEventLoop()];
@@ -4953,7 +5023,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4953
5023
  }
4954
5024
  });
4955
5025
  };
4956
- this_4 = this;
5026
+ this_3 = this;
4957
5027
  _f.label = 3;
4958
5028
  case 3:
4959
5029
  _f.trys.push([3, 8, 9, 10]);
@@ -4962,7 +5032,7 @@ var AcTrView2d = /** @class */ (function (_super) {
4962
5032
  case 4:
4963
5033
  if (!!objectsGroupByLayer_1_1.done) return [3 /*break*/, 7];
4964
5034
  _a = __read(objectsGroupByLayer_1_1.value, 2), layerName = _a[0], objects = _a[1];
4965
- return [5 /*yield**/, _loop_5(layerName, objects)];
5035
+ return [5 /*yield**/, _loop_4(layerName, objects)];
4966
5036
  case 5:
4967
5037
  _f.sent();
4968
5038
  _f.label = 6;
@@ -5099,6 +5169,9 @@ var AcTrView2d = /** @class */ (function (_super) {
5099
5169
  if (placements > 0) {
5100
5170
  // Prefix for headless CLI console forwarding.
5101
5171
  console.log("[cad-simple-viewer-cli] mesh glyph InstancedMesh flush: placements=".concat(placements, " buckets=").concat(buckets));
5172
+ // Flush can run while `_isDirty` was already cleared after the last
5173
+ // paint; without this, InstancedMesh text stays invisible until pan.
5174
+ this._isDirty = true;
5102
5175
  }
5103
5176
  };
5104
5177
  /**