@mlightcad/cad-simple-viewer 1.6.1 → 1.6.3

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 (281) hide show
  1. package/dist/cad-simple-viewer.js +12123 -8535
  2. package/dist/cad-simple-viewer.umd.cjs +180 -29
  3. package/icons.ts +7 -0
  4. package/lib/app/AcApBusyIndicator.d.ts +6 -0
  5. package/lib/app/AcApBusyIndicator.d.ts.map +1 -1
  6. package/lib/app/AcApBusyIndicator.js +8 -0
  7. package/lib/app/AcApBusyIndicator.js.map +1 -1
  8. package/lib/app/AcApContext.d.ts +24 -0
  9. package/lib/app/AcApContext.d.ts.map +1 -1
  10. package/lib/app/AcApContext.js +103 -18
  11. package/lib/app/AcApContext.js.map +1 -1
  12. package/lib/app/AcApDocManager.d.ts +221 -21
  13. package/lib/app/AcApDocManager.d.ts.map +1 -1
  14. package/lib/app/AcApDocManager.js +820 -134
  15. package/lib/app/AcApDocManager.js.map +1 -1
  16. package/lib/app/AcApDocSession.d.ts +41 -0
  17. package/lib/app/AcApDocSession.d.ts.map +1 -0
  18. package/lib/app/AcApDocSession.js +29 -0
  19. package/lib/app/AcApDocSession.js.map +1 -0
  20. package/lib/app/AcApDocument.d.ts +5 -0
  21. package/lib/app/AcApDocument.d.ts.map +1 -1
  22. package/lib/app/AcApDocument.js +21 -0
  23. package/lib/app/AcApDocument.js.map +1 -1
  24. package/lib/app/AcApOpenFileProgressController.d.ts +14 -0
  25. package/lib/app/AcApOpenFileProgressController.d.ts.map +1 -1
  26. package/lib/app/AcApOpenFileProgressController.js +18 -0
  27. package/lib/app/AcApOpenFileProgressController.js.map +1 -1
  28. package/lib/app/AcApProgress.d.ts +6 -0
  29. package/lib/app/AcApProgress.d.ts.map +1 -1
  30. package/lib/app/AcApProgress.js +17 -0
  31. package/lib/app/AcApProgress.js.map +1 -1
  32. package/lib/app/AcApSettingManager.d.ts.map +1 -1
  33. package/lib/app/AcApSettingManager.js +1 -0
  34. package/lib/app/AcApSettingManager.js.map +1 -1
  35. package/lib/app/index.d.ts +1 -0
  36. package/lib/app/index.d.ts.map +1 -1
  37. package/lib/app/index.js +1 -0
  38. package/lib/app/index.js.map +1 -1
  39. package/lib/command/AcApCloseCmd.d.ts +15 -0
  40. package/lib/command/AcApCloseCmd.d.ts.map +1 -0
  41. package/lib/command/AcApCloseCmd.js +83 -0
  42. package/lib/command/AcApCloseCmd.js.map +1 -0
  43. package/lib/command/draw/AcApArcCmd.d.ts.map +1 -1
  44. package/lib/command/draw/AcApArcCmd.js +28 -312
  45. package/lib/command/draw/AcApArcCmd.js.map +1 -1
  46. package/lib/command/draw/AcApCircleCmd.d.ts.map +1 -1
  47. package/lib/command/draw/AcApCircleCmd.js +10 -42
  48. package/lib/command/draw/AcApCircleCmd.js.map +1 -1
  49. package/lib/command/index.d.ts +1 -0
  50. package/lib/command/index.d.ts.map +1 -1
  51. package/lib/command/index.js +1 -0
  52. package/lib/command/index.js.map +1 -1
  53. package/lib/command/markup/AcApMarkupCalloutCmd.d.ts.map +1 -1
  54. package/lib/command/markup/AcApMarkupCalloutCmd.js +29 -10
  55. package/lib/command/markup/AcApMarkupCalloutCmd.js.map +1 -1
  56. package/lib/command/markup/AcApMarkupGeometry.d.ts +20 -1
  57. package/lib/command/markup/AcApMarkupGeometry.d.ts.map +1 -1
  58. package/lib/command/markup/AcApMarkupGeometry.js +84 -24
  59. package/lib/command/markup/AcApMarkupGeometry.js.map +1 -1
  60. package/lib/command/markup/AcApMarkupHistory.d.ts +1 -1
  61. package/lib/command/markup/AcApMarkupHistory.d.ts.map +1 -1
  62. package/lib/command/markup/AcApMarkupHistory.js +4 -11
  63. package/lib/command/markup/AcApMarkupHistory.js.map +1 -1
  64. package/lib/command/markup/AcApMarkupPresenter.d.ts +8 -2
  65. package/lib/command/markup/AcApMarkupPresenter.d.ts.map +1 -1
  66. package/lib/command/markup/AcApMarkupPresenter.js +35 -5
  67. package/lib/command/markup/AcApMarkupPresenter.js.map +1 -1
  68. package/lib/command/markup/AcApMarkupSession.d.ts +54 -0
  69. package/lib/command/markup/AcApMarkupSession.d.ts.map +1 -0
  70. package/lib/command/markup/AcApMarkupSession.js +85 -0
  71. package/lib/command/markup/AcApMarkupSession.js.map +1 -0
  72. package/lib/command/markup/AcApMarkupSessionBootstrap.d.ts +2 -0
  73. package/lib/command/markup/AcApMarkupSessionBootstrap.d.ts.map +1 -0
  74. package/lib/command/markup/AcApMarkupSessionBootstrap.js +12 -0
  75. package/lib/command/markup/AcApMarkupSessionBootstrap.js.map +1 -0
  76. package/lib/command/markup/AcApMarkupShapeCallout.d.ts +21 -1
  77. package/lib/command/markup/AcApMarkupShapeCallout.d.ts.map +1 -1
  78. package/lib/command/markup/AcApMarkupShapeCallout.js +29 -22
  79. package/lib/command/markup/AcApMarkupShapeCallout.js.map +1 -1
  80. package/lib/command/markup/AcApMarkupStore.d.ts +1 -1
  81. package/lib/command/markup/AcApMarkupStore.d.ts.map +1 -1
  82. package/lib/command/markup/AcApMarkupStore.js +3 -6
  83. package/lib/command/markup/AcApMarkupStore.js.map +1 -1
  84. package/lib/command/markup/AcApMarkupTextCmd.d.ts.map +1 -1
  85. package/lib/command/markup/AcApMarkupTextCmd.js +8 -2
  86. package/lib/command/markup/AcApMarkupTextCmd.js.map +1 -1
  87. package/lib/command/markup/AcApMarkupTextEdit.d.ts.map +1 -1
  88. package/lib/command/markup/AcApMarkupTextEdit.js +3 -1
  89. package/lib/command/markup/AcApMarkupTextEdit.js.map +1 -1
  90. package/lib/command/markup/AcApMarkupUtil.d.ts.map +1 -1
  91. package/lib/command/markup/AcApMarkupUtil.js +3 -2
  92. package/lib/command/markup/AcApMarkupUtil.js.map +1 -1
  93. package/lib/command/markup/index.d.ts +2 -0
  94. package/lib/command/markup/index.d.ts.map +1 -1
  95. package/lib/command/markup/index.js +3 -0
  96. package/lib/command/markup/index.js.map +1 -1
  97. package/lib/command/measure/AcApMeasureArcCmd.d.ts +22 -25
  98. package/lib/command/measure/AcApMeasureArcCmd.d.ts.map +1 -1
  99. package/lib/command/measure/AcApMeasureArcCmd.js +480 -256
  100. package/lib/command/measure/AcApMeasureArcCmd.js.map +1 -1
  101. package/lib/command/measure/AcApMeasureArcLock.d.ts +40 -0
  102. package/lib/command/measure/AcApMeasureArcLock.d.ts.map +1 -0
  103. package/lib/command/measure/AcApMeasureArcLock.js +226 -0
  104. package/lib/command/measure/AcApMeasureArcLock.js.map +1 -0
  105. package/lib/command/measure/AcApMeasurementGeometry.d.ts.map +1 -1
  106. package/lib/command/measure/AcApMeasurementGeometry.js +9 -9
  107. package/lib/command/measure/AcApMeasurementGeometry.js.map +1 -1
  108. package/lib/command/measure/AcApMeasurementSidecar.d.ts.map +1 -1
  109. package/lib/command/measure/AcApMeasurementSidecar.js +12 -7
  110. package/lib/command/measure/AcApMeasurementSidecar.js.map +1 -1
  111. package/lib/command/measure/AcApMeasurementStore.d.ts +2 -0
  112. package/lib/command/measure/AcApMeasurementStore.d.ts.map +1 -1
  113. package/lib/command/measure/AcApMeasurementStore.js +4 -0
  114. package/lib/command/measure/AcApMeasurementStore.js.map +1 -1
  115. package/lib/command/measure/AcApMeasurementTypes.d.ts +6 -0
  116. package/lib/command/measure/AcApMeasurementTypes.d.ts.map +1 -1
  117. package/lib/command/measure/entity/AcApMeasureArcEntity.d.ts +24 -22
  118. package/lib/command/measure/entity/AcApMeasureArcEntity.d.ts.map +1 -1
  119. package/lib/command/measure/entity/AcApMeasureArcEntity.js +104 -41
  120. package/lib/command/measure/entity/AcApMeasureArcEntity.js.map +1 -1
  121. package/lib/command/measure/entity/AcApMeasureDrawUtil.d.ts +35 -38
  122. package/lib/command/measure/entity/AcApMeasureDrawUtil.d.ts.map +1 -1
  123. package/lib/command/measure/entity/AcApMeasureDrawUtil.js +42 -53
  124. package/lib/command/measure/entity/AcApMeasureDrawUtil.js.map +1 -1
  125. package/lib/command/measure/entity/AcApMeasureEntityFactory.d.ts.map +1 -1
  126. package/lib/command/measure/entity/AcApMeasureEntityFactory.js +1 -1
  127. package/lib/command/measure/entity/AcApMeasureEntityFactory.js.map +1 -1
  128. package/lib/command/modify/AcApEraseCmd.d.ts +1 -0
  129. package/lib/command/modify/AcApEraseCmd.d.ts.map +1 -1
  130. package/lib/command/modify/AcApEraseCmd.js +4 -2
  131. package/lib/command/modify/AcApEraseCmd.js.map +1 -1
  132. package/lib/editor/grip/AcEdGripEditSession.d.ts.map +1 -1
  133. package/lib/editor/grip/AcEdGripEditSession.js +2 -0
  134. package/lib/editor/grip/AcEdGripEditSession.js.map +1 -1
  135. package/lib/editor/input/AcEdOsnapCenterMarks.d.ts +23 -0
  136. package/lib/editor/input/AcEdOsnapCenterMarks.d.ts.map +1 -0
  137. package/lib/editor/input/AcEdOsnapCenterMarks.js +240 -0
  138. package/lib/editor/input/AcEdOsnapCenterMarks.js.map +1 -0
  139. package/lib/editor/input/AcEdOsnapResolver.d.ts +18 -0
  140. package/lib/editor/input/AcEdOsnapResolver.d.ts.map +1 -1
  141. package/lib/editor/input/AcEdOsnapResolver.js +159 -10
  142. package/lib/editor/input/AcEdOsnapResolver.js.map +1 -1
  143. package/lib/editor/input/marker/AcEdMarker.d.ts +1 -1
  144. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  145. package/lib/editor/input/marker/AcEdMarker.js +11 -1
  146. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  147. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +17 -1
  148. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -1
  149. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +71 -10
  150. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -1
  151. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  152. package/lib/editor/input/ui/AcEdFloatingInput.js +4 -0
  153. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  154. package/lib/editor/view/AcEdBaseView.d.ts +12 -0
  155. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  156. package/lib/editor/view/AcEdBaseView.js +29 -1
  157. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  158. package/lib/i18n/AcApI18n.d.ts +1 -1
  159. package/lib/i18n/AcApI18n.d.ts.map +1 -1
  160. package/lib/i18n/AcApI18n.js +2 -1
  161. package/lib/i18n/AcApI18n.js.map +1 -1
  162. package/lib/i18n/ar/command.d.ts +456 -0
  163. package/lib/i18n/ar/command.d.ts.map +1 -0
  164. package/lib/i18n/ar/command.js +14 -0
  165. package/lib/i18n/ar/command.js.map +1 -0
  166. package/lib/i18n/ar/jig.d.ts +1231 -0
  167. package/lib/i18n/ar/jig.d.ts.map +1 -0
  168. package/lib/i18n/ar/jig.js +594 -0
  169. package/lib/i18n/ar/jig.js.map +1 -0
  170. package/lib/i18n/ar/main.d.ts +64 -0
  171. package/lib/i18n/ar/main.d.ts.map +1 -0
  172. package/lib/i18n/ar/main.js +63 -0
  173. package/lib/i18n/ar/main.js.map +1 -0
  174. package/lib/i18n/cs/command.d.ts +3 -0
  175. package/lib/i18n/cs/command.d.ts.map +1 -1
  176. package/lib/i18n/cs/command.js +3 -0
  177. package/lib/i18n/cs/command.js.map +1 -1
  178. package/lib/i18n/cs/jig.d.ts +3 -0
  179. package/lib/i18n/cs/jig.d.ts.map +1 -1
  180. package/lib/i18n/cs/jig.js +7 -4
  181. package/lib/i18n/cs/jig.js.map +1 -1
  182. package/lib/i18n/en/command.d.ts +3 -0
  183. package/lib/i18n/en/command.d.ts.map +1 -1
  184. package/lib/i18n/en/command.js +3 -0
  185. package/lib/i18n/en/command.js.map +1 -1
  186. package/lib/i18n/en/jig.d.ts +3 -0
  187. package/lib/i18n/en/jig.d.ts.map +1 -1
  188. package/lib/i18n/en/jig.js +7 -4
  189. package/lib/i18n/en/jig.js.map +1 -1
  190. package/lib/i18n/index.d.ts.map +1 -1
  191. package/lib/i18n/index.js +8 -0
  192. package/lib/i18n/index.js.map +1 -1
  193. package/lib/i18n/tr/command.d.ts +3 -0
  194. package/lib/i18n/tr/command.d.ts.map +1 -1
  195. package/lib/i18n/tr/command.js +3 -0
  196. package/lib/i18n/tr/command.js.map +1 -1
  197. package/lib/i18n/tr/jig.d.ts +3 -0
  198. package/lib/i18n/tr/jig.d.ts.map +1 -1
  199. package/lib/i18n/tr/jig.js +7 -4
  200. package/lib/i18n/tr/jig.js.map +1 -1
  201. package/lib/i18n/zh/command.d.ts +3 -0
  202. package/lib/i18n/zh/command.d.ts.map +1 -1
  203. package/lib/i18n/zh/command.js +3 -0
  204. package/lib/i18n/zh/command.js.map +1 -1
  205. package/lib/i18n/zh/jig.d.ts +3 -0
  206. package/lib/i18n/zh/jig.d.ts.map +1 -1
  207. package/lib/i18n/zh/jig.js +7 -4
  208. package/lib/i18n/zh/jig.js.map +1 -1
  209. package/lib/plugin/AcApPluginManager.d.ts +10 -0
  210. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  211. package/lib/plugin/AcApPluginManager.js +18 -0
  212. package/lib/plugin/AcApPluginManager.js.map +1 -1
  213. package/lib/service/AcApEntityService.d.ts +4 -2
  214. package/lib/service/AcApEntityService.d.ts.map +1 -1
  215. package/lib/service/AcApEntityService.js +14 -10
  216. package/lib/service/AcApEntityService.js.map +1 -1
  217. package/lib/ui/AcApDrawStyle.d.ts +19 -1
  218. package/lib/ui/AcApDrawStyle.d.ts.map +1 -1
  219. package/lib/ui/AcApDrawStyle.js +22 -1
  220. package/lib/ui/AcApDrawStyle.js.map +1 -1
  221. package/lib/ui/AcApDrawStyleToolbar.d.ts +12 -7
  222. package/lib/ui/AcApDrawStyleToolbar.d.ts.map +1 -1
  223. package/lib/ui/AcApDrawStyleToolbar.js +173 -52
  224. package/lib/ui/AcApDrawStyleToolbar.js.map +1 -1
  225. package/lib/ui/icons.d.ts +148 -0
  226. package/lib/ui/icons.d.ts.map +1 -0
  227. package/lib/ui/icons.js +173 -0
  228. package/lib/ui/icons.js.map +1 -0
  229. package/lib/ui/index.d.ts +1 -0
  230. package/lib/ui/index.d.ts.map +1 -1
  231. package/lib/ui/index.js +1 -0
  232. package/lib/ui/index.js.map +1 -1
  233. package/lib/util/AcApCssColor.d.ts +8 -0
  234. package/lib/util/AcApCssColor.d.ts.map +1 -0
  235. package/lib/util/AcApCssColor.js +20 -0
  236. package/lib/util/AcApCssColor.js.map +1 -0
  237. package/lib/util/AcApMeasurementUtil.d.ts.map +1 -1
  238. package/lib/util/AcApMeasurementUtil.js +3 -2
  239. package/lib/util/AcApMeasurementUtil.js.map +1 -1
  240. package/lib/util/AcApScreenHitTest.d.ts +5 -1
  241. package/lib/util/AcApScreenHitTest.d.ts.map +1 -1
  242. package/lib/util/AcApScreenHitTest.js +9 -3
  243. package/lib/util/AcApScreenHitTest.js.map +1 -1
  244. package/lib/util/index.d.ts +1 -0
  245. package/lib/util/index.d.ts.map +1 -1
  246. package/lib/util/index.js +1 -0
  247. package/lib/util/index.js.map +1 -1
  248. package/lib/view/AcApCompareDisplay.d.ts +37 -0
  249. package/lib/view/AcApCompareDisplay.d.ts.map +1 -0
  250. package/lib/view/AcApCompareDisplay.js +8 -0
  251. package/lib/view/AcApCompareDisplay.js.map +1 -0
  252. package/lib/view/AcEdReviewOverlayPick.d.ts +9 -0
  253. package/lib/view/AcEdReviewOverlayPick.d.ts.map +1 -1
  254. package/lib/view/AcEdReviewOverlayPick.js +30 -1
  255. package/lib/view/AcEdReviewOverlayPick.js.map +1 -1
  256. package/lib/view/AcTrLayer.d.ts +6 -0
  257. package/lib/view/AcTrLayer.d.ts.map +1 -1
  258. package/lib/view/AcTrLayer.js +8 -0
  259. package/lib/view/AcTrLayer.js.map +1 -1
  260. package/lib/view/AcTrLayout.d.ts +12 -0
  261. package/lib/view/AcTrLayout.d.ts.map +1 -1
  262. package/lib/view/AcTrLayout.js +12 -0
  263. package/lib/view/AcTrLayout.js.map +1 -1
  264. package/lib/view/AcTrScene.d.ts +7 -0
  265. package/lib/view/AcTrScene.d.ts.map +1 -1
  266. package/lib/view/AcTrScene.js +13 -0
  267. package/lib/view/AcTrScene.js.map +1 -1
  268. package/lib/view/AcTrView2d.d.ts +50 -2
  269. package/lib/view/AcTrView2d.d.ts.map +1 -1
  270. package/lib/view/AcTrView2d.js +210 -37
  271. package/lib/view/AcTrView2d.js.map +1 -1
  272. package/lib/view/AcTrViewSessionState.d.ts +26 -0
  273. package/lib/view/AcTrViewSessionState.d.ts.map +1 -0
  274. package/lib/view/AcTrViewSessionState.js +2 -0
  275. package/lib/view/AcTrViewSessionState.js.map +1 -0
  276. package/lib/view/index.d.ts +2 -0
  277. package/lib/view/index.d.ts.map +1 -1
  278. package/lib/view/index.js +2 -0
  279. package/lib/view/index.js.map +1 -1
  280. package/package.json +12 -5
  281. package/src/ui/icons.ts +293 -0
@@ -327,7 +327,7 @@ var AcTrView2d = /** @class */ (function (_super) {
327
327
  // Initialize background color through setter to keep renderer/cursor in sync.
328
328
  _this.backgroundColor =
329
329
  (_b = mergedOptions.background) !== null && _b !== void 0 ? _b : ACGI_MODEL_SPACE_BACKGROUND;
330
- _this._stats = _this.createStats(AcApSettingManager.instance.isShowStats);
330
+ _this._stats = _this.createStats(AcApSettingManager.instance.isShowStats && _this.isActiveManagedView());
331
331
  // Layout background sysvars drive the canvas clear colour and ACI-7
332
332
  // inversion (`MODELBKCOLOR` for model space, `PAPERBKCOLOR` for the
333
333
  // active layout). `COLORTHEME` only affects UI chrome — see
@@ -427,7 +427,7 @@ var AcTrView2d = /** @class */ (function (_super) {
427
427
  _this.selectionSet.clear();
428
428
  }
429
429
  }
430
- else {
430
+ else if (_this.entitySelectionEnabled) {
431
431
  var picked = _this.pick(endWcs);
432
432
  if (picked.length > 0) {
433
433
  if (action === 'replace') {
@@ -439,13 +439,18 @@ var AcTrView2d = /** @class */ (function (_super) {
439
439
  _this.selectionSet.clear();
440
440
  }
441
441
  }
442
+ else if (action === 'replace') {
443
+ _this.selectionSet.clear();
444
+ }
442
445
  }
443
446
  else {
444
447
  var box = new AcGeBox2d()
445
448
  .expandByPoint(selectionStartWcs)
446
449
  .expandByPoint(endWcs);
447
450
  var mode = _this.getSelectionMode(selectionStartCanvas, endCanvas);
448
- _this.selectByBoxWithMode(box, mode, action);
451
+ if (_this.entitySelectionEnabled) {
452
+ _this.selectByBoxWithMode(box, mode, action);
453
+ }
449
454
  trySelectReviewOverlaysByBox(_this, box, mode, action);
450
455
  }
451
456
  selectionStartWcs = null;
@@ -456,6 +461,8 @@ var AcTrView2d = /** @class */ (function (_super) {
456
461
  return;
457
462
  if (!canHandleSelectionGesture())
458
463
  return;
464
+ if (!_this.entitySelectionEnabled)
465
+ return;
459
466
  if (AcApDocManager.instance.curDocument.openMode !== AcEdOpenMode.Write) {
460
467
  return;
461
468
  }
@@ -465,9 +472,20 @@ var AcTrView2d = /** @class */ (function (_super) {
465
472
  // such as the canvas or the entire document. This can interfere with other event listeners you
466
473
  // add, including the keydown event.
467
474
  document.addEventListener('keydown', function (e) {
475
+ if (!_this.isActiveManagedView())
476
+ return;
468
477
  _this._keyHandler.handleKeyDown(e);
469
478
  });
470
479
  acdbHostApplicationServices().layoutManager.events.layoutSwitched.addEventListener(function (args) {
480
+ var _a, _b;
481
+ if (!_this.isActiveManagedView())
482
+ return;
483
+ var layoutDb = args.layout
484
+ .database;
485
+ var currentDb = (_b = (_a = AcApDocManager._instance) === null || _a === void 0 ? void 0 : _a.curDocument) === null || _b === void 0 ? void 0 : _b.database;
486
+ if (layoutDb && currentDb && layoutDb !== currentDb) {
487
+ return;
488
+ }
471
489
  var btrId = args.layout.blockTableRecordId;
472
490
  // "First visit" is tracked separately from view existence because
473
491
  // `addLayout` pre-creates an `AcTrLayoutView` for every layout in
@@ -1075,28 +1093,56 @@ var AcTrView2d = /** @class */ (function (_super) {
1075
1093
  configurable: true
1076
1094
  });
1077
1095
  /**
1078
- * Converts every drawable entity into the scene before offline export.
1096
+ * Converts drawable entities into the scene before offline export.
1079
1097
  *
1080
1098
  * Interactive viewing skips off/frozen layers for performance; HTML snapshots
1081
1099
  * store layer visibility separately and need full geometry so the exported
1082
1100
  * layer panel can toggle layers on later.
1083
1101
  *
1102
+ * When `includeLayouts` is `true` (the default), paper-space tabs the user
1103
+ * never visited are registered and converted. When `false`, only model space
1104
+ * is converted.
1105
+ *
1084
1106
  * Converted geometry remains in the live scene after this call completes.
1085
1107
  */
1086
1108
  AcTrView2d.prototype.ensureEntitiesConvertedForExport = function (options) {
1087
1109
  return __awaiter(this, void 0, void 0, function () {
1088
- var includeInvisibleLayers, db, pending, _a, _b, _c, layoutBtrId, blockTableRecord, idle;
1089
- var e_4, _d;
1110
+ var includeInvisibleLayers, includeLayouts, db, pending, layoutTable, _a, _b, layout, btrId, _c, _d, _e, layoutBtrId, blockTableRecord, idle;
1111
+ var e_4, _f, e_5, _g;
1090
1112
  var _this = this;
1091
- return __generator(this, function (_e) {
1092
- switch (_e.label) {
1113
+ var _h;
1114
+ return __generator(this, function (_j) {
1115
+ switch (_j.label) {
1093
1116
  case 0:
1094
1117
  includeInvisibleLayers = (options === null || options === void 0 ? void 0 : options.includeInvisibleLayers) !== false;
1118
+ includeLayouts = (options === null || options === void 0 ? void 0 : options.includeLayouts) !== false;
1095
1119
  db = AcApDocManager.instance.curDocument.database;
1096
1120
  pending = [];
1121
+ layoutTable = (_h = db.objects) === null || _h === void 0 ? void 0 : _h.layout;
1122
+ if (includeLayouts && (layoutTable === null || layoutTable === void 0 ? void 0 : layoutTable.newIterator)) {
1123
+ try {
1124
+ for (_a = __values(layoutTable.newIterator()), _b = _a.next(); !_b.done; _b = _a.next()) {
1125
+ layout = _b.value;
1126
+ btrId = layout.blockTableRecordId;
1127
+ if (btrId) {
1128
+ this._scene.addEmptyLayout(btrId);
1129
+ }
1130
+ }
1131
+ }
1132
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1133
+ finally {
1134
+ try {
1135
+ if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
1136
+ }
1137
+ finally { if (e_4) throw e_4.error; }
1138
+ }
1139
+ }
1097
1140
  try {
1098
- for (_a = __values(this._scene.layouts), _b = _a.next(); !_b.done; _b = _a.next()) {
1099
- _c = __read(_b.value, 1), layoutBtrId = _c[0];
1141
+ for (_c = __values(this._scene.layouts), _d = _c.next(); !_d.done; _d = _c.next()) {
1142
+ _e = __read(_d.value, 1), layoutBtrId = _e[0];
1143
+ if (!includeLayouts && layoutBtrId !== this._scene.modelSpaceBtrId) {
1144
+ continue;
1145
+ }
1100
1146
  blockTableRecord = db.tables.blockTable.getIdAt(layoutBtrId);
1101
1147
  if (!blockTableRecord) {
1102
1148
  continue;
@@ -1104,22 +1150,22 @@ var AcTrView2d = /** @class */ (function (_super) {
1104
1150
  pending.push.apply(pending, __spreadArray([], __read(this._entityDisplay.collectMissingEntitiesForExport(blockTableRecord, function (objectId) { return _this.hasEntity(objectId); }, includeInvisibleLayers)), false));
1105
1151
  }
1106
1152
  }
1107
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1153
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1108
1154
  finally {
1109
1155
  try {
1110
- if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
1156
+ if (_d && !_d.done && (_g = _c.return)) _g.call(_c);
1111
1157
  }
1112
- finally { if (e_4) throw e_4.error; }
1158
+ finally { if (e_5) throw e_5.error; }
1113
1159
  }
1114
1160
  if (!(pending.length > 0)) return [3 /*break*/, 2];
1115
1161
  this._numOfEntitiesToProcess += pending.length;
1116
1162
  return [4 /*yield*/, this.batchConvert(pending, { forExport: true })];
1117
1163
  case 1:
1118
- _e.sent();
1119
- _e.label = 2;
1164
+ _j.sent();
1165
+ _j.label = 2;
1120
1166
  case 2: return [4 /*yield*/, this.waitUntilIdle()];
1121
1167
  case 3:
1122
- idle = _e.sent();
1168
+ idle = _j.sent();
1123
1169
  if (!idle) {
1124
1170
  log.warn('[AcTrView2d] Timed out waiting for deferred geometry before export');
1125
1171
  }
@@ -1420,7 +1466,7 @@ var AcTrView2d = /** @class */ (function (_super) {
1420
1466
  * don't have to land pixel-perfect on the viewport line to grab it.
1421
1467
  */
1422
1468
  AcTrView2d.prototype.pick = function (point, hitRadius, pickOneOnly) {
1423
- var e_5, _a;
1469
+ var e_6, _a;
1424
1470
  if (point == null)
1425
1471
  point = this.curPos;
1426
1472
  var results = [];
@@ -1451,12 +1497,12 @@ var AcTrView2d = /** @class */ (function (_super) {
1451
1497
  }
1452
1498
  }
1453
1499
  }
1454
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1500
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1455
1501
  finally {
1456
1502
  try {
1457
1503
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1458
1504
  }
1459
- finally { if (e_5) throw e_5.error; }
1505
+ finally { if (e_6) throw e_6.error; }
1460
1506
  }
1461
1507
  }
1462
1508
  // 1) Resolve hits in the active layout. Skip the `AcDbViewport`
@@ -1499,7 +1545,7 @@ var AcTrView2d = /** @class */ (function (_super) {
1499
1545
  * paper-space pick.
1500
1546
  */
1501
1547
  AcTrView2d.prototype.pickThroughViewports = function (paperPoint, paperBox, viewports, results) {
1502
- var e_6, _a;
1548
+ var e_7, _a;
1503
1549
  var modelLayout = this._scene.modelSpaceLayout;
1504
1550
  if (!modelLayout)
1505
1551
  return;
@@ -1534,12 +1580,12 @@ var AcTrView2d = /** @class */ (function (_super) {
1534
1580
  _loop_1(vpView);
1535
1581
  }
1536
1582
  }
1537
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1583
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1538
1584
  finally {
1539
1585
  try {
1540
1586
  if (viewports_1_1 && !viewports_1_1.done && (_a = viewports_1.return)) _a.call(viewports_1);
1541
1587
  }
1542
- finally { if (e_6) throw e_6.error; }
1588
+ finally { if (e_7) throw e_7.error; }
1543
1589
  }
1544
1590
  };
1545
1591
  /**
@@ -1576,7 +1622,7 @@ var AcTrView2d = /** @class */ (function (_super) {
1576
1622
  * @inheritdoc
1577
1623
  */
1578
1624
  AcTrView2d.prototype.updateLayer = function (layer, changes) {
1579
- var e_7, _a;
1625
+ var e_8, _a;
1580
1626
  var touchedObjectIds = this._scene.updateLayer(this.toLayerInfo(layer)).touchedObjectIds;
1581
1627
  if (this._layerAppearance.layerStyleMayHaveChanged(changes)) {
1582
1628
  this._layerAppearance.syncFromLiveRecord(layer);
@@ -1598,12 +1644,12 @@ var AcTrView2d = /** @class */ (function (_super) {
1598
1644
  this.applySessionHiddenObjectState(objectId);
1599
1645
  }
1600
1646
  }
1601
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1647
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1602
1648
  finally {
1603
1649
  try {
1604
1650
  if (touchedObjectIds_1_1 && !touchedObjectIds_1_1.done && (_a = touchedObjectIds_1.return)) _a.call(touchedObjectIds_1);
1605
1651
  }
1606
- finally { if (e_7) throw e_7.error; }
1652
+ finally { if (e_8) throw e_8.error; }
1607
1653
  }
1608
1654
  this._isDirty = true;
1609
1655
  };
@@ -1832,7 +1878,7 @@ var AcTrView2d = /** @class */ (function (_super) {
1832
1878
  * drawable entity that must be rebuilt (for example ATTRIB → INSERT).
1833
1879
  */
1834
1880
  AcTrView2d.prototype.resolveSceneUpdateEntities = function (entities) {
1835
- var e_8, _a;
1881
+ var e_9, _a;
1836
1882
  var _b;
1837
1883
  var db = (_b = AcApDocManager.instance.curDocument) === null || _b === void 0 ? void 0 : _b.database;
1838
1884
  var resolved = [];
@@ -1854,12 +1900,12 @@ var AcTrView2d = /** @class */ (function (_super) {
1854
1900
  resolved.push(target);
1855
1901
  }
1856
1902
  }
1857
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
1903
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1858
1904
  finally {
1859
1905
  try {
1860
1906
  if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
1861
1907
  }
1862
- finally { if (e_8) throw e_8.error; }
1908
+ finally { if (e_9) throw e_9.error; }
1863
1909
  }
1864
1910
  return resolved;
1865
1911
  };
@@ -1988,8 +2034,103 @@ var AcTrView2d = /** @class */ (function (_super) {
1988
2034
  this._scene.clear();
1989
2035
  this._isDirty = true;
1990
2036
  this._missedImages.clear();
2037
+ this._initializedLayouts.clear();
2038
+ this._externallyFramedLayouts.clear();
2039
+ this._loadingLayouts.clear();
1991
2040
  this._renderer.dispose();
1992
2041
  };
2042
+ /**
2043
+ * Captures GPU/camera/selection state so another document can occupy this view.
2044
+ *
2045
+ * @returns Parked state owned by {@link AcApDocSession} until restore.
2046
+ */
2047
+ AcTrView2d.prototype.captureSessionState = function () {
2048
+ return {
2049
+ scene: this._scene,
2050
+ layoutViewManager: this._layoutViewManager,
2051
+ initializedLayouts: this._initializedLayouts,
2052
+ externallyFramedLayouts: this._externallyFramedLayouts,
2053
+ loadingLayouts: this._loadingLayouts,
2054
+ missedImages: this._missedImages,
2055
+ selectionIds: this.selectionSet.ids
2056
+ };
2057
+ };
2058
+ /**
2059
+ * Restores a parked document onto this shared view without disposing the renderer.
2060
+ *
2061
+ * @param state - Snapshot previously returned by {@link captureSessionState} or {@link beginNewSession}.
2062
+ */
2063
+ AcTrView2d.prototype.restoreSessionState = function (state) {
2064
+ this._convertEpoch++;
2065
+ this._convertQueue.length = 0;
2066
+ this._numOfEntitiesToProcess = 0;
2067
+ this._pendingGeometryJobs = 0;
2068
+ this._scene = state.scene;
2069
+ this._layoutViewManager = state.layoutViewManager;
2070
+ this._initializedLayouts = state.initializedLayouts;
2071
+ this._externallyFramedLayouts = state.externallyFramedLayouts;
2072
+ this._loadingLayouts = state.loadingLayouts;
2073
+ this._missedImages = state.missedImages;
2074
+ this.rebindLayerAppearance();
2075
+ this._layoutViewManager.resize(this.width, this.height);
2076
+ this.selectionSet.clear();
2077
+ if (state.selectionIds.length > 0) {
2078
+ this.selectionSet.add(state.selectionIds);
2079
+ }
2080
+ this._isDirty = true;
2081
+ };
2082
+ /**
2083
+ * Detaches the current scene and installs an empty one for a newly opened document.
2084
+ *
2085
+ * @returns Parked state of the previous document.
2086
+ */
2087
+ AcTrView2d.prototype.beginNewSession = function () {
2088
+ var parked = this.captureSessionState();
2089
+ this._convertEpoch++;
2090
+ this._convertQueue.length = 0;
2091
+ this._numOfEntitiesToProcess = 0;
2092
+ this._pendingGeometryJobs = 0;
2093
+ this._scene = this.createScene();
2094
+ this._layoutViewManager = new AcTrLayoutViewManager();
2095
+ this._initializedLayouts = new Set();
2096
+ this._externallyFramedLayouts = new Set();
2097
+ this._loadingLayouts = new Set();
2098
+ this._missedImages = new Map();
2099
+ this.rebindLayerAppearance();
2100
+ this.selectionSet.clear();
2101
+ this._isDirty = true;
2102
+ return parked;
2103
+ };
2104
+ /**
2105
+ * Disposes GPU resources for a parked session that is being closed.
2106
+ *
2107
+ * @param state - Parked snapshot to discard.
2108
+ */
2109
+ AcTrView2d.prototype.disposeSessionState = function (state) {
2110
+ state.scene.clear();
2111
+ state.layoutViewManager = new AcTrLayoutViewManager();
2112
+ state.initializedLayouts.clear();
2113
+ state.externallyFramedLayouts.clear();
2114
+ state.loadingLayouts.clear();
2115
+ state.missedImages.clear();
2116
+ state.selectionIds = [];
2117
+ };
2118
+ /**
2119
+ * Recreates the layer-appearance controller after the scene is swapped.
2120
+ */
2121
+ AcTrView2d.prototype.rebindLayerAppearance = function () {
2122
+ this._layerAppearance = new AcTrLayerAppearanceController(this._scene, this._renderer);
2123
+ };
2124
+ /**
2125
+ * True when this view is the document manager's live canvas.
2126
+ * Satellite/preview views must ignore global shortcuts and layout switches.
2127
+ */
2128
+ AcTrView2d.prototype.isActiveManagedView = function () {
2129
+ var _a;
2130
+ var singleton = AcApDocManager;
2131
+ var current = (_a = singleton._instance) === null || _a === void 0 ? void 0 : _a.curView;
2132
+ return current == null || current === this;
2133
+ };
1993
2134
  /**
1994
2135
  * Drains the progressive convert queue on a single serial worker so ENTITY
1995
2136
  * flush chunks can enqueue while conversion overlaps the loading overlay.
@@ -2057,6 +2198,8 @@ var AcTrView2d = /** @class */ (function (_super) {
2057
2198
  * @inheritdoc
2058
2199
  */
2059
2200
  AcTrView2d.prototype.highlight = function (ids) {
2201
+ if (!this.entitySelectionEnabled)
2202
+ return;
2060
2203
  this._isDirty = this._scene.select(ids);
2061
2204
  };
2062
2205
  /**
@@ -2065,6 +2208,34 @@ var AcTrView2d = /** @class */ (function (_super) {
2065
2208
  AcTrView2d.prototype.unhighlight = function (ids) {
2066
2209
  this._isDirty = this._scene.unselect(ids);
2067
2210
  };
2211
+ /**
2212
+ * Enables compare-display coloring on non-overlay layouts of this view.
2213
+ * Pass an overlay {@link AcTrLayout} to color a reference overlay separately.
2214
+ *
2215
+ * @param options - Compare colors and per-entity role overrides.
2216
+ * @param targetLayout - Overlay layout to color; omit for the main scene.
2217
+ */
2218
+ AcTrView2d.prototype.setCompareDisplay = function (options, targetLayout) {
2219
+ var _a, _b, _c, _d, _e, _f;
2220
+ var baseColor = (_c = (_a = options.baseColor) !== null && _a !== void 0 ? _a : (_b = options.colors) === null || _b === void 0 ? void 0 : _b.unchanged) !== null && _c !== void 0 ? _c : 0x9ca3af;
2221
+ var mapped = {
2222
+ enabled: options.enabled,
2223
+ baseColor: baseColor,
2224
+ colors: {
2225
+ deleted: (_d = options.colors) === null || _d === void 0 ? void 0 : _d.deleted,
2226
+ added: (_e = options.colors) === null || _e === void 0 ? void 0 : _e.added,
2227
+ modified: (_f = options.colors) === null || _f === void 0 ? void 0 : _f.modified
2228
+ },
2229
+ overrides: options.overrides
2230
+ };
2231
+ if (targetLayout) {
2232
+ targetLayout.setCompareDisplay(mapped);
2233
+ }
2234
+ else {
2235
+ this._scene.setCompareDisplay(mapped);
2236
+ }
2237
+ this._isDirty = true;
2238
+ };
2068
2239
  AcTrView2d.prototype.stopAnimationLoop = function () {
2069
2240
  if (this._rafId != null) {
2070
2241
  cancelAnimationFrame(this._rafId);
@@ -2075,6 +2246,8 @@ var AcTrView2d = /** @class */ (function (_super) {
2075
2246
  * @inheritdoc
2076
2247
  */
2077
2248
  AcTrView2d.prototype.onHover = function (id) {
2249
+ if (!this.entitySelectionEnabled)
2250
+ return;
2078
2251
  this._isDirty = this._scene.hover([id]);
2079
2252
  };
2080
2253
  /**
@@ -2151,7 +2324,7 @@ var AcTrView2d = /** @class */ (function (_super) {
2151
2324
  * @param layoutBtrId Input the block table record id of the layout
2152
2325
  */
2153
2326
  AcTrView2d.prototype.loadLayoutEntitiesIfNeeded = function (layoutBtrId) {
2154
- var e_9, _a;
2327
+ var e_10, _a;
2155
2328
  var _this = this;
2156
2329
  try {
2157
2330
  var db = AcApDocManager.instance.curDocument.database;
@@ -2222,12 +2395,12 @@ var AcTrView2d = /** @class */ (function (_super) {
2222
2395
  entities_2.push(entity);
2223
2396
  }
2224
2397
  }
2225
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2398
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2226
2399
  finally {
2227
2400
  try {
2228
2401
  if (iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return)) _a.call(iterator_1);
2229
2402
  }
2230
- finally { if (e_9) throw e_9.error; }
2403
+ finally { if (e_10) throw e_10.error; }
2231
2404
  }
2232
2405
  if (entities_2.length === 0) {
2233
2406
  // Empty layout (e.g. a freshly-created paper space tab). Mark as
@@ -2465,7 +2638,7 @@ var AcTrView2d = /** @class */ (function (_super) {
2465
2638
  * paper layouts.
2466
2639
  */
2467
2640
  AcTrView2d.prototype.ensureViewportViews = function (blockTableRecord, layoutView) {
2468
- var e_10, _a;
2641
+ var e_11, _a;
2469
2642
  var iterator = blockTableRecord.newIterator();
2470
2643
  try {
2471
2644
  for (var iterator_2 = __values(iterator), iterator_2_1 = iterator_2.next(); !iterator_2_1.done; iterator_2_1 = iterator_2.next()) {
@@ -2478,12 +2651,12 @@ var AcTrView2d = /** @class */ (function (_super) {
2478
2651
  layoutView.addViewport(viewportView);
2479
2652
  }
2480
2653
  }
2481
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2654
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2482
2655
  finally {
2483
2656
  try {
2484
2657
  if (iterator_2_1 && !iterator_2_1.done && (_a = iterator_2.return)) _a.call(iterator_2);
2485
2658
  }
2486
- finally { if (e_10) throw e_10.error; }
2659
+ finally { if (e_11) throw e_11.error; }
2487
2660
  }
2488
2661
  };
2489
2662
  /**
@@ -2720,7 +2893,7 @@ var AcTrView2d = /** @class */ (function (_super) {
2720
2893
  AcTrView2d.prototype.handleGroup = function (group_1, progressive_1) {
2721
2894
  return __awaiter(this, arguments, void 0, function (group, progressive, epoch) {
2722
2895
  var children, objectsGroupByLayer, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, groupChildBoxes, aggregateSpatialBbox;
2723
- var e_11, _a;
2896
+ var e_12, _a;
2724
2897
  var _this = this;
2725
2898
  if (epoch === void 0) { epoch = this._convertEpoch; }
2726
2899
  return __generator(this, function (_b) {
@@ -2762,12 +2935,12 @@ var AcTrView2d = /** @class */ (function (_super) {
2762
2935
  child.parent = null;
2763
2936
  }
2764
2937
  }
2765
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
2938
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
2766
2939
  finally {
2767
2940
  try {
2768
2941
  if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
2769
2942
  }
2770
- finally { if (e_11) throw e_11.error; }
2943
+ finally { if (e_12) throw e_12.error; }
2771
2944
  }
2772
2945
  renderContext = group.renderContext;
2773
2946
  groupObjectId = group.objectId;