@mlightcad/cad-simple-viewer 1.0.0

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/dist/index.js +2422 -0
  4. package/dist/index.umd.cjs +9 -0
  5. package/lib/app/AcApContext.d.ts +15 -0
  6. package/lib/app/AcApContext.d.ts.map +1 -0
  7. package/lib/app/AcApContext.js +56 -0
  8. package/lib/app/AcApContext.js.map +1 -0
  9. package/lib/app/AcApDocCreator.d.ts +17 -0
  10. package/lib/app/AcApDocCreator.d.ts.map +1 -0
  11. package/lib/app/AcApDocCreator.js +140 -0
  12. package/lib/app/AcApDocCreator.js.map +1 -0
  13. package/lib/app/AcApDocManager.d.ts +60 -0
  14. package/lib/app/AcApDocManager.d.ts.map +1 -0
  15. package/lib/app/AcApDocManager.js +275 -0
  16. package/lib/app/AcApDocManager.js.map +1 -0
  17. package/lib/app/AcApDocument.d.ts +27 -0
  18. package/lib/app/AcApDocument.d.ts.map +1 -0
  19. package/lib/app/AcApDocument.js +165 -0
  20. package/lib/app/AcApDocument.js.map +1 -0
  21. package/lib/app/AcApFontLoader.d.ts +20 -0
  22. package/lib/app/AcApFontLoader.d.ts.map +1 -0
  23. package/lib/app/AcApFontLoader.js +135 -0
  24. package/lib/app/AcApFontLoader.js.map +1 -0
  25. package/lib/app/AcApSettingManager.d.ts +44 -0
  26. package/lib/app/AcApSettingManager.d.ts.map +1 -0
  27. package/lib/app/AcApSettingManager.js +122 -0
  28. package/lib/app/AcApSettingManager.js.map +1 -0
  29. package/lib/app/index.d.ts +5 -0
  30. package/lib/app/index.d.ts.map +1 -0
  31. package/lib/app/index.js +5 -0
  32. package/lib/app/index.js.map +1 -0
  33. package/lib/command/AcApConvertToSvgCmd.d.ts +6 -0
  34. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
  35. package/lib/command/AcApConvertToSvgCmd.js +30 -0
  36. package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
  37. package/lib/command/AcApOpenCmd.d.ts +6 -0
  38. package/lib/command/AcApOpenCmd.d.ts.map +1 -0
  39. package/lib/command/AcApOpenCmd.js +29 -0
  40. package/lib/command/AcApOpenCmd.js.map +1 -0
  41. package/lib/command/AcApPanCmd.d.ts +6 -0
  42. package/lib/command/AcApPanCmd.d.ts.map +1 -0
  43. package/lib/command/AcApPanCmd.js +30 -0
  44. package/lib/command/AcApPanCmd.js.map +1 -0
  45. package/lib/command/AcApQNewCmd.d.ts +6 -0
  46. package/lib/command/AcApQNewCmd.d.ts.map +1 -0
  47. package/lib/command/AcApQNewCmd.js +30 -0
  48. package/lib/command/AcApQNewCmd.js.map +1 -0
  49. package/lib/command/AcApSelectCmd.d.ts +6 -0
  50. package/lib/command/AcApSelectCmd.d.ts.map +1 -0
  51. package/lib/command/AcApSelectCmd.js +30 -0
  52. package/lib/command/AcApSelectCmd.js.map +1 -0
  53. package/lib/command/AcApSvgConvertor.d.ts +5 -0
  54. package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
  55. package/lib/command/AcApSvgConvertor.js +55 -0
  56. package/lib/command/AcApSvgConvertor.js.map +1 -0
  57. package/lib/command/AcApZoomCmd.d.ts +6 -0
  58. package/lib/command/AcApZoomCmd.d.ts.map +1 -0
  59. package/lib/command/AcApZoomCmd.js +28 -0
  60. package/lib/command/AcApZoomCmd.js.map +1 -0
  61. package/lib/command/AcApZoomToBoxCmd.d.ts +11 -0
  62. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
  63. package/lib/command/AcApZoomToBoxCmd.js +101 -0
  64. package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
  65. package/lib/command/index.d.ts +10 -0
  66. package/lib/command/index.d.ts.map +1 -0
  67. package/lib/command/index.js +10 -0
  68. package/lib/command/index.js.map +1 -0
  69. package/lib/editor/command/AcEdCommand.d.ts +42 -0
  70. package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
  71. package/lib/editor/command/AcEdCommand.js +60 -0
  72. package/lib/editor/command/AcEdCommand.js.map +1 -0
  73. package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
  74. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
  75. package/lib/editor/command/AcEdCommandIterator.js +65 -0
  76. package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
  77. package/lib/editor/command/AcEdCommandStack.d.ts +66 -0
  78. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
  79. package/lib/editor/command/AcEdCommandStack.js +192 -0
  80. package/lib/editor/command/AcEdCommandStack.js.map +1 -0
  81. package/lib/editor/command/index.d.ts +3 -0
  82. package/lib/editor/command/index.d.ts.map +1 -0
  83. package/lib/editor/command/index.js +3 -0
  84. package/lib/editor/command/index.js.map +1 -0
  85. package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
  86. package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
  87. package/lib/editor/global/AcEdGlobalFunc.js +14 -0
  88. package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
  89. package/lib/editor/global/AcEdMessage.d.ts +5 -0
  90. package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
  91. package/lib/editor/global/AcEdMessage.js +6 -0
  92. package/lib/editor/global/AcEdMessage.js.map +1 -0
  93. package/lib/editor/global/eventBus.d.ts +34 -0
  94. package/lib/editor/global/eventBus.d.ts.map +1 -0
  95. package/lib/editor/global/eventBus.js +3 -0
  96. package/lib/editor/global/eventBus.js.map +1 -0
  97. package/lib/editor/global/index.d.ts +3 -0
  98. package/lib/editor/global/index.d.ts.map +1 -0
  99. package/lib/editor/global/index.js +3 -0
  100. package/lib/editor/global/index.js.map +1 -0
  101. package/lib/editor/index.d.ts +5 -0
  102. package/lib/editor/index.d.ts.map +1 -0
  103. package/lib/editor/index.js +5 -0
  104. package/lib/editor/index.js.map +1 -0
  105. package/lib/editor/input/AcEdBaseInput.d.ts +25 -0
  106. package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
  107. package/lib/editor/input/AcEdBaseInput.js +105 -0
  108. package/lib/editor/input/AcEdBaseInput.js.map +1 -0
  109. package/lib/editor/input/AcEdBoxSelector.d.ts +27 -0
  110. package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
  111. package/lib/editor/input/AcEdBoxSelector.js +140 -0
  112. package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
  113. package/lib/editor/input/AcEdCursorManager.d.ts +43 -0
  114. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
  115. package/lib/editor/input/AcEdCursorManager.js +71 -0
  116. package/lib/editor/input/AcEdCursorManager.js.map +1 -0
  117. package/lib/editor/input/AcEdInputPoint.d.ts +14 -0
  118. package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
  119. package/lib/editor/input/AcEdInputPoint.js +41 -0
  120. package/lib/editor/input/AcEdInputPoint.js.map +1 -0
  121. package/lib/editor/input/AcEdJig.d.ts +14 -0
  122. package/lib/editor/input/AcEdJig.d.ts.map +1 -0
  123. package/lib/editor/input/AcEdJig.js +92 -0
  124. package/lib/editor/input/AcEdJig.js.map +1 -0
  125. package/lib/editor/input/AcEdJigLoop.d.ts +14 -0
  126. package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
  127. package/lib/editor/input/AcEdJigLoop.js +43 -0
  128. package/lib/editor/input/AcEdJigLoop.js.map +1 -0
  129. package/lib/editor/input/AcEdSelectionSet.d.ts +26 -0
  130. package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
  131. package/lib/editor/input/AcEdSelectionSet.js +63 -0
  132. package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
  133. package/lib/editor/input/AcEditor.d.ts +27 -0
  134. package/lib/editor/input/AcEditor.d.ts.map +1 -0
  135. package/lib/editor/input/AcEditor.js +103 -0
  136. package/lib/editor/input/AcEditor.js.map +1 -0
  137. package/lib/editor/input/index.d.ts +5 -0
  138. package/lib/editor/input/index.d.ts.map +1 -0
  139. package/lib/editor/input/index.js +5 -0
  140. package/lib/editor/input/index.js.map +1 -0
  141. package/lib/editor/view/AcEdBaseView.d.ts +261 -0
  142. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
  143. package/lib/editor/view/AcEdBaseView.js +260 -0
  144. package/lib/editor/view/AcEdBaseView.js.map +1 -0
  145. package/lib/editor/view/index.d.ts +2 -0
  146. package/lib/editor/view/index.d.ts.map +1 -0
  147. package/lib/editor/view/index.js +2 -0
  148. package/lib/editor/view/index.js.map +1 -0
  149. package/lib/index.d.ts +5 -0
  150. package/lib/index.d.ts.map +1 -0
  151. package/lib/index.js +5 -0
  152. package/lib/index.js.map +1 -0
  153. package/lib/util/AcTrGeometryUtil.d.ts +18 -0
  154. package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
  155. package/lib/util/AcTrGeometryUtil.js +33 -0
  156. package/lib/util/AcTrGeometryUtil.js.map +1 -0
  157. package/lib/util/index.d.ts +2 -0
  158. package/lib/util/index.d.ts.map +1 -0
  159. package/lib/util/index.js +2 -0
  160. package/lib/util/index.js.map +1 -0
  161. package/lib/view/AcTrLayer.d.ts +97 -0
  162. package/lib/view/AcTrLayer.d.ts.map +1 -0
  163. package/lib/view/AcTrLayer.js +170 -0
  164. package/lib/view/AcTrLayer.js.map +1 -0
  165. package/lib/view/AcTrLayout.d.ts +114 -0
  166. package/lib/view/AcTrLayout.d.ts.map +1 -0
  167. package/lib/view/AcTrLayout.js +344 -0
  168. package/lib/view/AcTrLayout.js.map +1 -0
  169. package/lib/view/AcTrLayoutView.d.ts +57 -0
  170. package/lib/view/AcTrLayoutView.d.ts.map +1 -0
  171. package/lib/view/AcTrLayoutView.js +151 -0
  172. package/lib/view/AcTrLayoutView.js.map +1 -0
  173. package/lib/view/AcTrLayoutViewManager.d.ts +43 -0
  174. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
  175. package/lib/view/AcTrLayoutViewManager.js +74 -0
  176. package/lib/view/AcTrLayoutViewManager.js.map +1 -0
  177. package/lib/view/AcTrScene.d.ts +115 -0
  178. package/lib/view/AcTrScene.d.ts.map +1 -0
  179. package/lib/view/AcTrScene.js +319 -0
  180. package/lib/view/AcTrScene.js.map +1 -0
  181. package/lib/view/AcTrView2d.d.ts +160 -0
  182. package/lib/view/AcTrView2d.d.ts.map +1 -0
  183. package/lib/view/AcTrView2d.js +473 -0
  184. package/lib/view/AcTrView2d.js.map +1 -0
  185. package/lib/view/index.d.ts +2 -0
  186. package/lib/view/index.d.ts.map +1 -0
  187. package/lib/view/index.js +2 -0
  188. package/lib/view/index.js.map +1 -0
  189. package/package.json +55 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrView2d.d.ts","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,YAAY,EAKZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,UAAU,EACV,YAAY,EAEb,MAAM,2BAA2B,CAAA;AAKlC,OAAO,EACL,YAAY,EACZ,yBAAyB,EAEzB,YAAY,EAEb,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,yBAAyB,CAAA;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,iBAErC,CAAA;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,QAA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S,CAAC,MAAM,EAAE,UAAU;IAyC5B;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY;IAInC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU;IAkB/B;;OAEG;IACH,KAAK;IAOL;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,YAAY,EAAE;IAI7B;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE;IAI/B;;OAEG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAItD;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY;IAIlC;;OAEG;IACH,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY;IAIpC,SAAS,CAAC,WAAW;IAQrB,OAAO,CAAC,WAAW;IAcnB,SAAS,CAAC,cAAc;IAOxB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAiBhC;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAO9B"}
@@ -0,0 +1,473 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ import { acdbHostApplicationServices, AcDbRasterImage, AcDbRay, AcDbViewport, AcDbXline, AcGePoint2d } from '@mlightcad/data-model';
28
+ import { AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
29
+ import * as THREE from 'three';
30
+ import Stats from 'three/examples/jsm/libs/stats.module';
31
+ import { AcApSettingManager } from '../app';
32
+ import { AcEdBaseView, AcEdCorsorType, AcEdViewMode, eventBus } from '../editor';
33
+ import { AcTrGeometryUtil } from '../util';
34
+ import { AcTrLayoutView } from './AcTrLayoutView';
35
+ import { AcTrLayoutViewManager } from './AcTrLayoutViewManager';
36
+ import { AcTrScene } from './AcTrScene';
37
+ /**
38
+ * Default view option values
39
+ */
40
+ export var DEFAULT_VIEW_2D_OPTIONS = {
41
+ background: 0x000000
42
+ };
43
+ var AcTrView2d = /** @class */ (function (_super) {
44
+ __extends(AcTrView2d, _super);
45
+ function AcTrView2d(options) {
46
+ if (options === void 0) { options = DEFAULT_VIEW_2D_OPTIONS; }
47
+ var _this = this;
48
+ var mergedOptions = __assign(__assign({}, DEFAULT_VIEW_2D_OPTIONS), options);
49
+ var renderer = new THREE.WebGLRenderer({
50
+ antialias: true,
51
+ alpha: true,
52
+ canvas: options.canvas
53
+ });
54
+ if (mergedOptions.canvas == null) {
55
+ mergedOptions.canvas = renderer.domElement;
56
+ }
57
+ _this = _super.call(this, mergedOptions.canvas) || this;
58
+ if (options.calculateSizeCallback) {
59
+ _this.setCalculateSizeCallback(options.calculateSizeCallback);
60
+ }
61
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
62
+ renderer.setSize(_this.width, _this.height);
63
+ renderer.setClearColor(mergedOptions.background || 0x000000);
64
+ _this._renderer = new AcTrRenderer(renderer);
65
+ var fontMapping = AcApSettingManager.instance.fontMapping;
66
+ _this._renderer.setFontMapping(fontMapping);
67
+ _this._renderer.events.fontNotFound.addEventListener(function (args) {
68
+ var _a;
69
+ eventBus.emit('font-not-found', {
70
+ fontName: args.fontName,
71
+ count: (_a = args.count) !== null && _a !== void 0 ? _a : 0
72
+ });
73
+ });
74
+ _this._scene = _this.createScene();
75
+ _this._stats = _this.createStats(AcApSettingManager.instance.isShowStats);
76
+ AcApSettingManager.instance.events.modified.addEventListener(function (args) {
77
+ if (args.key == 'isShowStats') {
78
+ _this.toggleStatsVisibility(_this._stats, args.value);
79
+ }
80
+ });
81
+ _this.canvas.addEventListener('click', function () {
82
+ if (_this.mode == AcEdViewMode.SELECTION) {
83
+ _this.select();
84
+ }
85
+ });
86
+ // When using OrbitControls in THREE.js, it attaches its own event listeners to the DOM elements,
87
+ // such as the canvas or the entire document. This can interfere with other event listeners you
88
+ // add, including the keydown event.
89
+ document.addEventListener('keydown', function (e) {
90
+ if (e.code === 'Escape') {
91
+ _this.selectionSet.clear();
92
+ }
93
+ });
94
+ acdbHostApplicationServices().layoutManager.events.layoutSwitched.addEventListener(function (args) {
95
+ _this.activeLayoutBtrId = args.newLayout.blockTableRecordId;
96
+ });
97
+ _this._missedImages = new Map();
98
+ _this._layoutViewManager = new AcTrLayoutViewManager();
99
+ _this.initialize();
100
+ _this.onWindowResize();
101
+ _this.animate();
102
+ _this._isDirty = true;
103
+ return _this;
104
+ }
105
+ AcTrView2d.prototype.initialize = function () {
106
+ // This method is called after camera and render are created.
107
+ // Children class can override this method to add its own logic
108
+ this.setCursor(AcEdCorsorType.Crosshair);
109
+ };
110
+ Object.defineProperty(AcTrView2d.prototype, "mode", {
111
+ /**
112
+ * @inheritdoc
113
+ */
114
+ get: function () {
115
+ var activeLayoutView = this.activeLayoutView;
116
+ return activeLayoutView ? activeLayoutView.mode : AcEdViewMode.SELECTION;
117
+ },
118
+ set: function (value) {
119
+ this.activeLayoutView.mode = value;
120
+ this.editor.getPoint();
121
+ },
122
+ enumerable: false,
123
+ configurable: true
124
+ });
125
+ Object.defineProperty(AcTrView2d.prototype, "renderer", {
126
+ get: function () {
127
+ return this._renderer;
128
+ },
129
+ enumerable: false,
130
+ configurable: true
131
+ });
132
+ Object.defineProperty(AcTrView2d.prototype, "isDirty", {
133
+ get: function () {
134
+ return this._isDirty;
135
+ },
136
+ set: function (value) {
137
+ this._isDirty = value;
138
+ },
139
+ enumerable: false,
140
+ configurable: true
141
+ });
142
+ Object.defineProperty(AcTrView2d.prototype, "missedData", {
143
+ get: function () {
144
+ return {
145
+ fonts: this._renderer.missedFonts,
146
+ images: this._missedImages
147
+ };
148
+ },
149
+ enumerable: false,
150
+ configurable: true
151
+ });
152
+ Object.defineProperty(AcTrView2d.prototype, "center", {
153
+ get: function () {
154
+ return this.activeLayoutView.center;
155
+ },
156
+ set: function (value) {
157
+ this.activeLayoutView.center = value;
158
+ },
159
+ enumerable: false,
160
+ configurable: true
161
+ });
162
+ Object.defineProperty(AcTrView2d.prototype, "modelSpaceBtrId", {
163
+ /**
164
+ * The block table record id of the model space
165
+ */
166
+ get: function () {
167
+ return this._scene.modelSpaceBtrId;
168
+ },
169
+ set: function (value) {
170
+ this._scene.modelSpaceBtrId = value;
171
+ },
172
+ enumerable: false,
173
+ configurable: true
174
+ });
175
+ Object.defineProperty(AcTrView2d.prototype, "activeLayoutBtrId", {
176
+ /**
177
+ * The block table record id associated with the active layout
178
+ */
179
+ get: function () {
180
+ return this._scene.activeLayoutBtrId;
181
+ },
182
+ set: function (value) {
183
+ this._layoutViewManager.activeLayoutBtrId = value;
184
+ this._scene.activeLayoutBtrId = value;
185
+ this._isDirty = true;
186
+ },
187
+ enumerable: false,
188
+ configurable: true
189
+ });
190
+ Object.defineProperty(AcTrView2d.prototype, "activeLayoutView", {
191
+ /**
192
+ * The active layout view
193
+ */
194
+ get: function () {
195
+ return this._layoutViewManager.activeLayoutView;
196
+ },
197
+ enumerable: false,
198
+ configurable: true
199
+ });
200
+ Object.defineProperty(AcTrView2d.prototype, "stats", {
201
+ /**
202
+ * The statistics of the current scene
203
+ */
204
+ get: function () {
205
+ return this._scene.stats;
206
+ },
207
+ enumerable: false,
208
+ configurable: true
209
+ });
210
+ AcTrView2d.prototype.animate = function () {
211
+ var _a;
212
+ requestAnimationFrame(this.animate.bind(this));
213
+ if (this._isDirty) {
214
+ this._layoutViewManager.render(this._scene);
215
+ (_a = this._stats) === null || _a === void 0 ? void 0 : _a.update();
216
+ this._isDirty = false;
217
+ }
218
+ };
219
+ /**
220
+ * @inheritdoc
221
+ */
222
+ AcTrView2d.prototype.cwcs2Wcs = function (point) {
223
+ var activeLayoutView = this.activeLayoutView;
224
+ return activeLayoutView
225
+ ? activeLayoutView.cwcs2Wcs(point)
226
+ : new AcGePoint2d(point);
227
+ };
228
+ /**
229
+ * @inheritdoc
230
+ */
231
+ AcTrView2d.prototype.wcs2Cwcs = function (point) {
232
+ var activeLayoutView = this.activeLayoutView;
233
+ return activeLayoutView
234
+ ? activeLayoutView.wcs2Cwcs(point)
235
+ : new AcGePoint2d(point);
236
+ };
237
+ /**
238
+ * @inheritdoc
239
+ */
240
+ AcTrView2d.prototype.zoomTo = function (box, margin) {
241
+ if (margin === void 0) { margin = 1.1; }
242
+ this.activeLayoutView.zoomTo(box, margin);
243
+ this._isDirty = true;
244
+ };
245
+ /**
246
+ * Re-render points with latest point style settings
247
+ * @param displayMode Input display mode of points
248
+ */
249
+ AcTrView2d.prototype.rerenderPoints = function (displayMode) {
250
+ var activeLayout = this._scene.activeLayout;
251
+ if (activeLayout) {
252
+ activeLayout.rerenderPoints(displayMode);
253
+ this._isDirty = true;
254
+ }
255
+ };
256
+ /**
257
+ * @inheritdoc
258
+ */
259
+ AcTrView2d.prototype.zoomToFit = function () {
260
+ if (this._scene.box) {
261
+ var box = AcTrGeometryUtil.threeBox3dToGeBox2d(this._scene.box);
262
+ this.zoomTo(box);
263
+ this._isDirty = true;
264
+ }
265
+ };
266
+ /**
267
+ * @inheritdoc
268
+ */
269
+ AcTrView2d.prototype.pick = function (point) {
270
+ if (point == null)
271
+ point = this.curPos;
272
+ var results = [];
273
+ var activeLayout = this._scene.activeLayout;
274
+ if (activeLayout) {
275
+ var activeLayoutView = this.activeLayoutView;
276
+ var box = activeLayoutView.pointToBox(point, this.selectionBoxSize);
277
+ var firstQueryResults = this._scene.search(box);
278
+ var threshold = Math.max(box.size.width / 2, box.size.height / 2);
279
+ var raycaster_1 = activeLayoutView.resetRaycaster(point, threshold);
280
+ firstQueryResults.forEach(function (item) {
281
+ var objectId = item.id;
282
+ if (activeLayout.isIntersectWith(objectId, raycaster_1)) {
283
+ results.push(objectId);
284
+ }
285
+ });
286
+ }
287
+ return results;
288
+ };
289
+ /**
290
+ * @inheritdoc
291
+ */
292
+ AcTrView2d.prototype.search = function (box) {
293
+ return this._scene.search(box);
294
+ };
295
+ /**
296
+ * @inheritdoc
297
+ */
298
+ AcTrView2d.prototype.select = function (point) {
299
+ var idsAdded = [];
300
+ var results = this.pick(point);
301
+ results.forEach(function (id) { return idsAdded.push(id); });
302
+ if (idsAdded.length > 0)
303
+ this.selectionSet.add(idsAdded);
304
+ };
305
+ /**
306
+ * @inheritdoc
307
+ */
308
+ AcTrView2d.prototype.selectByBox = function (box) {
309
+ var idsAdded = [];
310
+ var results = this._scene.search(box);
311
+ results.forEach(function (item) { return idsAdded.push(item.id); });
312
+ this.selectionSet.add(idsAdded);
313
+ };
314
+ /**
315
+ * @inheritdoc
316
+ */
317
+ AcTrView2d.prototype.addEntity = function (entity) {
318
+ // Create the layout view of this entity if it doesn't exist yet
319
+ var layoutView = this.createLayoutViewIfNeeded(entity.ownerId);
320
+ var threeEntity = entity.draw(this._renderer);
321
+ if (threeEntity) {
322
+ threeEntity.objectId = entity.objectId;
323
+ threeEntity.ownerId = entity.ownerId;
324
+ threeEntity.layerName = entity.layer;
325
+ threeEntity.visible = entity.visibility;
326
+ var extendBbox = !(entity instanceof AcDbRay || entity instanceof AcDbXline);
327
+ this._scene.addEntity(threeEntity, extendBbox);
328
+ this._isDirty = true;
329
+ // Release memory occupied by this entity
330
+ threeEntity.dispose();
331
+ threeEntity = null;
332
+ }
333
+ if (entity instanceof AcDbViewport) {
334
+ // In paper space layouts, there is always a system-defined "default" viewport that exists as
335
+ // the bottom-most item. This viewport doesn't show any entities and is mainly for internal
336
+ // AutoCAD purposes. The viewport id number of this system-defined "default" viewport is 1.
337
+ if (entity.number > 1) {
338
+ var viewportView = new AcTrViewportView(layoutView, entity.toGiViewport(), this._renderer);
339
+ layoutView.addViewport(viewportView);
340
+ }
341
+ }
342
+ else if (entity instanceof AcDbRasterImage) {
343
+ var fileName = entity.imageFileName;
344
+ if (fileName)
345
+ this._missedImages.set(entity.objectId, fileName);
346
+ }
347
+ };
348
+ /**
349
+ * Remove the specified entity from this view.
350
+ * @param objectId Input the object id of the entity to remove
351
+ */
352
+ AcTrView2d.prototype.removeEntity = function (objectId) {
353
+ this._scene.remove(objectId);
354
+ };
355
+ /**
356
+ * @inheritdoc
357
+ */
358
+ AcTrView2d.prototype.updateEntity = function (entity) {
359
+ var _this = this;
360
+ var threeEntity = entity.draw(this._renderer);
361
+ if (threeEntity) {
362
+ threeEntity.objectId = entity.objectId;
363
+ threeEntity.ownerId = entity.ownerId;
364
+ threeEntity.layerName = entity.layer;
365
+ threeEntity.visible = entity.visibility;
366
+ this._scene.update(threeEntity);
367
+ this._isDirty = true;
368
+ // Not sure why texture for image entity isn't updated even if 'isDirty' flag is already set to true.
369
+ // So add one timeout event to set 'isDirty' flag to true again to make it work
370
+ setTimeout(function () {
371
+ _this._isDirty = true;
372
+ }, 100);
373
+ }
374
+ return threeEntity;
375
+ };
376
+ /**
377
+ * @inheritdoc
378
+ */
379
+ AcTrView2d.prototype.clear = function () {
380
+ this._scene.clear();
381
+ this._isDirty = true;
382
+ this._missedImages.clear();
383
+ this._renderer.clearMissedFonts();
384
+ };
385
+ /**
386
+ * @inheritdoc
387
+ */
388
+ AcTrView2d.prototype.highlight = function (ids) {
389
+ this._isDirty = this._scene.select(ids);
390
+ };
391
+ /**
392
+ * @inheritdoc
393
+ */
394
+ AcTrView2d.prototype.unhighlight = function (ids) {
395
+ this._isDirty = this._scene.unselect(ids);
396
+ };
397
+ /**
398
+ * @inheritdoc
399
+ */
400
+ AcTrView2d.prototype.setLayerVisibility = function (layerName, visible) {
401
+ this._isDirty = this._scene.setLayerVisibility(layerName, visible);
402
+ };
403
+ /**
404
+ * @inheritdoc
405
+ */
406
+ AcTrView2d.prototype.onHover = function (id) {
407
+ this._isDirty = this._scene.hover([id]);
408
+ };
409
+ /**
410
+ * @inheritdoc
411
+ */
412
+ AcTrView2d.prototype.onUnhover = function (id) {
413
+ this._isDirty = this._scene.unhover([id]);
414
+ };
415
+ AcTrView2d.prototype.createScene = function () {
416
+ var _this = this;
417
+ var scene = new AcTrScene();
418
+ scene.layouts.forEach(function (layout) {
419
+ layout.setSnapObject(_this.renderer.createObject());
420
+ });
421
+ return scene;
422
+ };
423
+ AcTrView2d.prototype.createStats = function (show) {
424
+ var stats = new Stats();
425
+ document.body.appendChild(stats.dom);
426
+ // Show Stats component at the right-bottom corner of the window
427
+ var statsDom = stats.dom;
428
+ statsDom.style.position = 'fixed';
429
+ statsDom.style.inset = 'unset';
430
+ statsDom.style.bottom = '30px';
431
+ statsDom.style.right = '0px';
432
+ this.toggleStatsVisibility(stats, show);
433
+ return stats;
434
+ };
435
+ AcTrView2d.prototype.onWindowResize = function () {
436
+ _super.prototype.onWindowResize.call(this);
437
+ this._renderer.setSize(this.width, this.height);
438
+ this._layoutViewManager.resize(this.width, this.height);
439
+ this._isDirty = true;
440
+ };
441
+ /**
442
+ * Create the layout view with the specified block table record id.
443
+ * @param layoutBtrId Input the block table record id associated with the layout view.
444
+ */
445
+ AcTrView2d.prototype.createLayoutViewIfNeeded = function (layoutBtrId) {
446
+ var _this = this;
447
+ var layoutView = this._layoutViewManager.getAt(layoutBtrId);
448
+ if (layoutView == null) {
449
+ layoutView = new AcTrLayoutView(this._renderer, layoutBtrId, this.width, this.height);
450
+ layoutView.events.viewChanged.addEventListener(function () {
451
+ _this._isDirty = true;
452
+ });
453
+ this._layoutViewManager.add(layoutView);
454
+ }
455
+ return layoutView;
456
+ };
457
+ /**
458
+ * Show or hide stats component
459
+ * @param show If it is true, show stats component. Otherwise, hide stats component.
460
+ * Default value is false.
461
+ */
462
+ AcTrView2d.prototype.toggleStatsVisibility = function (stats, show) {
463
+ if (show) {
464
+ stats.dom.style.display = 'block'; // Show the stats
465
+ }
466
+ else {
467
+ stats.dom.style.display = 'none'; // Hide the stats
468
+ }
469
+ };
470
+ return AcTrView2d;
471
+ }(AcEdBaseView));
472
+ export { AcTrView2d };
473
+ //# sourceMappingURL=AcTrView2d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrView2d.js","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAEL,2BAA2B,EAE3B,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EAGT,WAAW,EAEZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAEL,YAAY,EACZ,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,MAAM,sCAAsC,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EACL,YAAY,EAEZ,cAAc,EACd,YAAY,EACZ,QAAQ,EACT,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAoBvC;;GAEG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAsB;IACxD,UAAU,EAAE,QAAQ;CACrB,CAAA;AAED;IAAgC,8BAAY;IAQ1C,oBAAY,OAAoD;QAApD,wBAAA,EA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AAK,EACV,IAAI,CAAC,MAAM,CACZ,CAAA;YACD,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC;gBAC7C,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;YACtB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QACzC,CAAC;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAED;;;;OAIG;IACK,0CAAqB,GAA7B,UAA8B,KAAY,EAAE,IAAc;QACxD,IAAI,IAAI,EAAE,CAAC;YACT,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA,CAAC,iBAAiB;QACrD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA,CAAC,iBAAiB;QACpD,CAAC;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AA7bD,CAAgC,YAAY,GA6b3C"}
@@ -0,0 +1,2 @@
1
+ export * from './AcTrView2d';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './AcTrView2d';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@mlightcad/cad-simple-viewer",
3
+ "private": false,
4
+ "version": "1.0.0",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "autocad",
9
+ "cad",
10
+ "cad-viewer",
11
+ "dwg",
12
+ "dwg-viewer",
13
+ "dxf",
14
+ "dxf-viewer",
15
+ "mlight",
16
+ "mlightcad"
17
+ ],
18
+ "files": [
19
+ "dist",
20
+ "lib",
21
+ "README.md",
22
+ "package.json"
23
+ ],
24
+ "main": "./dist/index.umd.cjs",
25
+ "module": "./dist/index.js",
26
+ "types": "./lib/index.d.ts",
27
+ "exports": {
28
+ "types": "./lib/index.d.ts",
29
+ "import": "./dist/index.js",
30
+ "require": "./dist/index.umd.cjs"
31
+ },
32
+ "devDependencies": {
33
+ "@types/lodash-es": "^4.17.12",
34
+ "@types/rbush": "^3.0.4",
35
+ "@types/three": "^0.172.0"
36
+ },
37
+ "dependencies": {
38
+ "mitt": "^3.0.1",
39
+ "rbush": "^4.0.1"
40
+ },
41
+ "peerDependencies": {
42
+ "@mlightcad/data-model": "1.1.1",
43
+ "@mlightcad/three-viewcube": "0.0.9",
44
+ "three": "^0.172.0",
45
+ "lodash-es": "4.17.21",
46
+ "@mlightcad/svg-renderer": "0.0.1",
47
+ "@mlightcad/three-renderer": "1.0.0"
48
+ },
49
+ "scripts": {
50
+ "clean": "rimraf dist lib tsconfig.tsbuildinfo",
51
+ "build": "tsc && vite build",
52
+ "lint": "eslint src/",
53
+ "lint:fix": "eslint --fix --quiet src/"
54
+ }
55
+ }