@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,8 @@
1
+ /**
2
+ * Display an error or warning message. In order to decouple UI from this module,
3
+ * this function justs trigger one 'message' event through event bus instead of
4
+ * showing one message directly. It is UI module's resposiblity to listen this event
5
+ * and show message.
6
+ */
7
+ export declare function acedAlert(message: string): void;
8
+ //# sourceMappingURL=AcEdGlobalFunc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdGlobalFunc.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdGlobalFunc.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,QAKxC"}
@@ -0,0 +1,14 @@
1
+ import { eventBus } from './eventBus';
2
+ /**
3
+ * Display an error or warning message. In order to decouple UI from this module,
4
+ * this function justs trigger one 'message' event through event bus instead of
5
+ * showing one message directly. It is UI module's resposiblity to listen this event
6
+ * and show message.
7
+ */
8
+ export function acedAlert(message) {
9
+ eventBus.emit('message', {
10
+ message: message,
11
+ type: 'warning'
12
+ });
13
+ }
14
+ //# sourceMappingURL=AcEdGlobalFunc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdGlobalFunc.js","sourceRoot":"","sources":["../../../src/editor/global/AcEdGlobalFunc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAS;KAChB,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file defines ids of messages used in this module. The application can localize
3
+ * messages based on their id.
4
+ */
5
+ //# sourceMappingURL=AcEdMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdMessage.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdMessage.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * This file defines ids of messages used in this module. The application can localize
4
+ * messages based on their id.
5
+ */
6
+ //# sourceMappingURL=AcEdMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdMessage.js","sourceRoot":"","sources":["../../../src/editor/global/AcEdMessage.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,34 @@
1
+ import { AcDbConversionStage, AcDbConversionStageStatus } from '@mlightcad/data-model';
2
+ import { type Emitter } from 'mitt';
3
+ /**
4
+ * Message type
5
+ */
6
+ export type AcEdMessageType = 'success' | 'warning' | 'info' | 'error';
7
+ export type AcEdEvents = {
8
+ 'open-file': {};
9
+ 'open-file-progress': {
10
+ percentage: number;
11
+ stage: AcDbConversionStage;
12
+ stageStatus: AcDbConversionStageStatus;
13
+ };
14
+ message: {
15
+ message: string;
16
+ type: AcEdMessageType;
17
+ };
18
+ 'font-not-loaded': {
19
+ fontName: string;
20
+ url: string;
21
+ };
22
+ 'failed-to-get-avaiable-fonts': {
23
+ url: string;
24
+ };
25
+ 'failed-to-open-file': {
26
+ fileName: string;
27
+ };
28
+ 'font-not-found': {
29
+ fontName: string;
30
+ count: number;
31
+ };
32
+ };
33
+ export declare const eventBus: Emitter<AcEdEvents>;
34
+ //# sourceMappingURL=eventBus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAa,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAEzC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEtE,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,EAAE,CAAA;IACf,oBAAoB,EAAE;QACpB,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,mBAAmB,CAAA;QAC1B,WAAW,EAAE,yBAAyB,CAAA;KACvC,CAAA;IACD,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAA;IACnD,iBAAiB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACpD,8BAA8B,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,qBAAqB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,gBAAgB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACtD,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAsB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import mitt from 'mitt';
2
+ export var eventBus = mitt();
3
+ //# sourceMappingURL=eventBus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAIA,OAAO,IAAsB,MAAM,MAAM,CAAA;AAqBzC,MAAM,CAAC,IAAM,QAAQ,GAAwB,IAAI,EAAc,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdGlobalFunc';
2
+ export * from './eventBus';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdGlobalFunc';
2
+ export * from './eventBus';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './command';
2
+ export * from './global';
3
+ export * from './input';
4
+ export * from './view';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './command';
2
+ export * from './global';
3
+ export * from './input';
4
+ export * from './view';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { AcEdBaseView } from '../view/AcEdBaseView';
2
+ /**
3
+ * The base class for all of classes to get user inputs such as string, angle, number, point, selection,
4
+ * and so on.
5
+ * @internal
6
+ */
7
+ export declare abstract class AcEdBaseInput<TResult> {
8
+ protected view: AcEdBaseView;
9
+ protected active: boolean;
10
+ protected isResolvedOrRejected: boolean;
11
+ private _resolve?;
12
+ private _reject?;
13
+ constructor(view: AcEdBaseView);
14
+ get isActive(): boolean;
15
+ activate(): void;
16
+ deactivate(): void;
17
+ resolve(result: TResult): void;
18
+ reject(reason: string): void;
19
+ private onKeyDown;
20
+ /**
21
+ * Start inputting
22
+ */
23
+ start(): Promise<TResult>;
24
+ }
25
+ //# sourceMappingURL=AcEdBaseInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdBaseInput.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBaseInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;;;GAIG;AACH,8BAAsB,aAAa,CAAC,OAAO;IACzC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAA;IAC5B,SAAS,CAAC,MAAM,UAAQ;IACxB,SAAS,CAAC,oBAAoB,UAAQ;IAEtC,OAAO,CAAC,QAAQ,CAAC,CAA0B;IAC3C,OAAO,CAAC,OAAO,CAAC,CAA0B;gBAE9B,IAAI,EAAE,YAAY;IAI9B,IAAI,QAAQ,YAEX;IAED,QAAQ;IAQR,UAAU;IAKV,OAAO,CAAC,MAAM,EAAE,OAAO;IAQvB,MAAM,CAAC,MAAM,EAAE,MAAM;IAQrB,OAAO,CAAC,SAAS,CAIhB;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;CAQhC"}
@@ -0,0 +1,105 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ /**
38
+ * The base class for all of classes to get user inputs such as string, angle, number, point, selection,
39
+ * and so on.
40
+ * @internal
41
+ */
42
+ var AcEdBaseInput = /** @class */ (function () {
43
+ function AcEdBaseInput(view) {
44
+ var _this = this;
45
+ this.active = false;
46
+ this.isResolvedOrRejected = false;
47
+ this.onKeyDown = function (e) {
48
+ if (e.code === 'Escape') {
49
+ _this.reject('Canceled by user!');
50
+ }
51
+ };
52
+ this.view = view;
53
+ }
54
+ Object.defineProperty(AcEdBaseInput.prototype, "isActive", {
55
+ get: function () {
56
+ return this.active;
57
+ },
58
+ enumerable: false,
59
+ configurable: true
60
+ });
61
+ AcEdBaseInput.prototype.activate = function () {
62
+ if (this.isActive) {
63
+ console.warn('Something wrong here!');
64
+ }
65
+ this.active = true;
66
+ this.view.canvas.addEventListener('keydown', this.onKeyDown);
67
+ };
68
+ AcEdBaseInput.prototype.deactivate = function () {
69
+ this.active = false;
70
+ this.view.canvas.removeEventListener('keydown', this.onKeyDown);
71
+ };
72
+ AcEdBaseInput.prototype.resolve = function (result) {
73
+ this.deactivate();
74
+ if (this._resolve && !this.isResolvedOrRejected) {
75
+ this._resolve(result);
76
+ this.isResolvedOrRejected = true;
77
+ }
78
+ };
79
+ AcEdBaseInput.prototype.reject = function (reason) {
80
+ this.deactivate();
81
+ if (this._reject && !this.isResolvedOrRejected) {
82
+ this._reject(reason);
83
+ this.isResolvedOrRejected = true;
84
+ }
85
+ };
86
+ /**
87
+ * Start inputting
88
+ */
89
+ AcEdBaseInput.prototype.start = function () {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var _this = this;
92
+ return __generator(this, function (_a) {
93
+ this.isResolvedOrRejected = false;
94
+ return [2 /*return*/, new Promise(function (resolve, reject) {
95
+ _this._resolve = resolve;
96
+ _this._reject = reject;
97
+ _this.activate();
98
+ })];
99
+ });
100
+ });
101
+ };
102
+ return AcEdBaseInput;
103
+ }());
104
+ export { AcEdBaseInput };
105
+ //# sourceMappingURL=AcEdBaseInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdBaseInput.js","sourceRoot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M,GAAN,UAAO,MAAc;QACnB,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAA;QAClC,CAAC;IACH,CAAC;IAQD;;OAEG;IACG,6BAAK,GAAX;;;;gBACE,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAA;gBACjC,sBAAO,IAAI,OAAO,CAAU,UAAC,OAAO,EAAE,MAAM;wBAC1C,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;wBACvB,KAAI,CAAC,OAAO,GAAG,MAAM,CAAA;wBACrB,KAAI,CAAC,QAAQ,EAAE,CAAA;oBACjB,CAAC,CAAC,EAAA;;;KACH;IACH,oBAAC;AAAD,CAAC,AA9DD,IA8DC"}
@@ -0,0 +1,27 @@
1
+ import { AcGeBox2d } from '@mlightcad/data-model';
2
+ import { AcEdBaseView } from '../view';
3
+ import { AcEdBaseInput } from './AcEdBaseInput';
4
+ /**
5
+ * Selector used to select entities by a box.
6
+ * @internal
7
+ */
8
+ export declare class AcEdBoxSelector extends AcEdBaseInput<AcGeBox2d> {
9
+ private mouseDown;
10
+ private mouseMove;
11
+ private mouseDownPositionX;
12
+ private mouseDownPositionY;
13
+ private boxDom?;
14
+ color: number;
15
+ private container;
16
+ constructor(view: AcEdBaseView);
17
+ activate(): void;
18
+ deactivate(): void;
19
+ reject(reason: string): void;
20
+ private mousedown;
21
+ private mousemove;
22
+ private mouseup;
23
+ private drawRect;
24
+ private setRectDomVisible;
25
+ private toWcs;
26
+ }
27
+ //# sourceMappingURL=AcEdBoxSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdBoxSelector.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAK/C;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,aAAa,CAAC,SAAS,CAAC;IAC3D,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,kBAAkB,CAAK;IAG/B,OAAO,CAAC,MAAM,CAAC,CAAgB;IAExB,KAAK,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,SAAS,CAAa;gBAElB,IAAI,EAAE,YAAY;IAM9B,QAAQ;IAQR,UAAU;IAQV,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB,OAAO,CAAC,SAAS,CAOhB;IAED,OAAO,CAAC,SAAS,CAuBhB;IAED,OAAO,CAAC,OAAO,CAmBd;IAED,OAAO,CAAC,QAAQ;IAiChB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,KAAK;CAQd"}
@@ -0,0 +1,140 @@
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
+ import { AcCmColor, AcGeBox2d, AcGePoint2d } from '@mlightcad/data-model';
17
+ import { AcEdBaseInput } from './AcEdBaseInput';
18
+ var BORDER_COLOR = 0xffffff;
19
+ var BORDER_WIDTH = '1px';
20
+ /**
21
+ * Selector used to select entities by a box.
22
+ * @internal
23
+ */
24
+ var AcEdBoxSelector = /** @class */ (function (_super) {
25
+ __extends(AcEdBoxSelector, _super);
26
+ function AcEdBoxSelector(view) {
27
+ var _this = _super.call(this, view) || this;
28
+ _this.mouseDown = false;
29
+ _this.mouseMove = false;
30
+ _this.mouseDownPositionX = -1; // -1 means invalid point
31
+ _this.mouseDownPositionY = -1;
32
+ _this.mousedown = function (e) {
33
+ if (e.button === 0) {
34
+ _this.mouseDown = true;
35
+ var point = new AcGePoint2d(e.x, e.y);
36
+ _this.mouseDownPositionX = point.x;
37
+ _this.mouseDownPositionY = point.y;
38
+ }
39
+ };
40
+ _this.mousemove = function (e) {
41
+ if (!_this.mouseDown) {
42
+ return;
43
+ }
44
+ var point = new AcGePoint2d(e.x, e.y);
45
+ if (_this.mouseDownPositionX >= 0 && _this.mouseDownPositionY >= 0) {
46
+ var TOLERANCE = 5;
47
+ if (Math.abs(point.x - _this.mouseDownPositionX) >= TOLERANCE ||
48
+ Math.abs(point.y - _this.mouseDownPositionY) >= TOLERANCE) {
49
+ _this.mouseMove = true;
50
+ var leftTop = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
51
+ var rightBottom = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
52
+ _this.drawRect(leftTop, rightBottom);
53
+ }
54
+ }
55
+ };
56
+ _this.mouseup = function (e) {
57
+ if (_this.mouseDown && _this.mouseMove) {
58
+ var point = new AcGePoint2d(e.x, e.y);
59
+ var min = new AcGePoint2d(Math.min(_this.mouseDownPositionX, point.x), Math.min(_this.mouseDownPositionY, point.y));
60
+ var max = new AcGePoint2d(Math.max(_this.mouseDownPositionX, point.x), Math.max(_this.mouseDownPositionY, point.y));
61
+ var bbox = new AcGeBox2d(min, max);
62
+ _this.resolve(_this.toWcs(bbox));
63
+ }
64
+ _this.mouseDown = false;
65
+ _this.mouseMove = false;
66
+ // reset
67
+ _this.mouseDownPositionX = -1;
68
+ _this.mouseDownPositionY = -1;
69
+ };
70
+ _this.container = view.canvas;
71
+ _this.color = BORDER_COLOR;
72
+ return _this;
73
+ }
74
+ AcEdBoxSelector.prototype.activate = function () {
75
+ _super.prototype.activate.call(this);
76
+ this.active = true;
77
+ this.container.addEventListener('pointerdown', this.mousedown);
78
+ this.container.addEventListener('pointermove', this.mousemove);
79
+ this.container.addEventListener('pointerup', this.mouseup);
80
+ };
81
+ AcEdBoxSelector.prototype.deactivate = function () {
82
+ _super.prototype.deactivate.call(this);
83
+ this.container.removeEventListener('pointerdown', this.mousedown);
84
+ this.container.removeEventListener('pointermove', this.mousemove);
85
+ this.container.removeEventListener('pointerup', this.mouseup);
86
+ this.setRectDomVisible(false);
87
+ };
88
+ AcEdBoxSelector.prototype.reject = function (reason) {
89
+ var _a;
90
+ _super.prototype.reject.call(this, reason);
91
+ (_a = this.boxDom) === null || _a === void 0 ? void 0 : _a.remove();
92
+ this.boxDom = undefined;
93
+ };
94
+ AcEdBoxSelector.prototype.drawRect = function (leftTop, rightBottom) {
95
+ if (!this.boxDom) {
96
+ var color = new AcCmColor();
97
+ color.color = this.color;
98
+ this.boxDom = document.createElement('div');
99
+ this.boxDom.style.cssText = "position: absolute;border: ".concat(BORDER_WIDTH, " solid ").concat(color.cssColor, ";");
100
+ document.body.appendChild(this.boxDom);
101
+ }
102
+ this.setRectDomVisible(true);
103
+ // Adjust leftTop and rightBottom position to make them always in container bounding box
104
+ // Otherwise, the box may exceed the container bounding box and scrollbar will be shown.
105
+ if (leftTop.x <= 0) {
106
+ leftTop.x = 0;
107
+ }
108
+ if (leftTop.y <= 0) {
109
+ leftTop.y = 0;
110
+ }
111
+ if (rightBottom.x >= this.container.clientWidth - 2) {
112
+ rightBottom.x = this.container.clientWidth - 2;
113
+ }
114
+ if (rightBottom.y >= this.container.clientHeight - 2) {
115
+ rightBottom.y = this.container.clientHeight - 2;
116
+ }
117
+ this.boxDom.style.left = "".concat(leftTop.x, "px");
118
+ this.boxDom.style.top = "".concat(leftTop.y, "px");
119
+ var width = Math.abs(rightBottom.x - leftTop.x);
120
+ var height = Math.abs(rightBottom.y - leftTop.y);
121
+ this.boxDom.style.width = "".concat(width, "px");
122
+ this.boxDom.style.height = "".concat(height, "px");
123
+ };
124
+ AcEdBoxSelector.prototype.setRectDomVisible = function (visible) {
125
+ if (this.boxDom) {
126
+ this.boxDom.style.display = visible ? 'inline-block' : 'none';
127
+ }
128
+ };
129
+ AcEdBoxSelector.prototype.toWcs = function (box) {
130
+ var wcsBox = new AcGeBox2d();
131
+ var p1 = new AcGePoint2d(box.min.x, box.min.y);
132
+ var p2 = new AcGePoint2d(box.max.x, box.max.y);
133
+ wcsBox.expandByPoint(this.view.cwcs2Wcs(p1));
134
+ wcsBox.expandByPoint(this.view.cwcs2Wcs(p2));
135
+ return wcsBox;
136
+ };
137
+ return AcEdBoxSelector;
138
+ }(AcEdBaseInput));
139
+ export { AcEdBoxSelector };
140
+ //# sourceMappingURL=AcEdBoxSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdBoxSelector.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdBoxSelector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,IAAM,YAAY,GAAG,QAAQ,CAAA;AAC7B,IAAM,YAAY,GAAG,KAAK,CAAA;AAE1B;;;GAGG;AACH;IAAqC,mCAAwB;IAY3D,yBAAY,IAAkB;QAC5B,YAAA,MAAK,YAAC,IAAI,CAAC,SAAA;QAZL,eAAS,GAAG,KAAK,CAAA;QACjB,eAAS,GAAG,KAAK,CAAA;QACjB,wBAAkB,GAAG,CAAC,CAAC,CAAA,CAAC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ursor = 1,
5
+ RubberBand = 2,
6
+ NotRotated = 3,
7
+ TargetBox = 4,
8
+ RotatedCrosshair = 5,
9
+ CrosshairNoRotate = 6,
10
+ Invisible = 7,
11
+ EntitySelect = 8,
12
+ Parallelogram = 9,
13
+ EntitySelectNoPersp = 10,
14
+ PkfirstOrGrips = 11,
15
+ CrosshairDashed = 12,
16
+ Grab = 13
17
+ }
18
+ /**
19
+ * The class to create and manage cursor
20
+ * @internal
21
+ */
22
+ export declare class AcEdCursorManager {
23
+ private _cursorMap;
24
+ constructor();
25
+ setCursor(cursorType: AcEdCorsorType, element: HTMLElement): void;
26
+ /**
27
+ * Encode SVG string to one cursor defined using url() in CSS
28
+ * @param svgString Input svg string
29
+ * @param xOffset Input x offset for cursor hotspot
30
+ * @param yOffset Input y offset for cursor hotspot
31
+ * @returns
32
+ */
33
+ private encodeSvg;
34
+ /**
35
+ * Create one svg icon with one rectangle plus two cross lines
36
+ * @param rectSize Input the width and height of rectangle
37
+ * @param crossLineLength Input the length of one cross line
38
+ * @param lineColor Input line color
39
+ * @returns Return svg string of the icon
40
+ */
41
+ private createRectCrossIcon;
42
+ }
43
+ //# sourceMappingURL=AcEdCursorManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdCursorManager.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,eAAe,KAAK;IACpB,SAAS,IAAI;IACb,UAAU,IAAA;IACV,UAAU,IAAA;IACV,UAAU,IAAA;IACV,SAAS,IAAA;IACT,gBAAgB,IAAA;IAChB,iBAAiB,IAAA;IACjB,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,aAAa,IAAA;IACb,mBAAmB,KAAA;IACnB,cAAc,KAAA;IACd,eAAe,KAAA;IACf,IAAI,KAAA;CACL;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAA6B;;IAS/C,SAAS,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW;IAa1D;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAQjB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAkB5B"}
@@ -0,0 +1,71 @@
1
+ export var AcEdCorsorType;
2
+ (function (AcEdCorsorType) {
3
+ AcEdCorsorType[AcEdCorsorType["NoSpecialCursor"] = -1] = "NoSpecialCursor";
4
+ AcEdCorsorType[AcEdCorsorType["Crosshair"] = 0] = "Crosshair";
5
+ AcEdCorsorType[AcEdCorsorType["RectCursor"] = 1] = "RectCursor";
6
+ AcEdCorsorType[AcEdCorsorType["RubberBand"] = 2] = "RubberBand";
7
+ AcEdCorsorType[AcEdCorsorType["NotRotated"] = 3] = "NotRotated";
8
+ AcEdCorsorType[AcEdCorsorType["TargetBox"] = 4] = "TargetBox";
9
+ AcEdCorsorType[AcEdCorsorType["RotatedCrosshair"] = 5] = "RotatedCrosshair";
10
+ AcEdCorsorType[AcEdCorsorType["CrosshairNoRotate"] = 6] = "CrosshairNoRotate";
11
+ AcEdCorsorType[AcEdCorsorType["Invisible"] = 7] = "Invisible";
12
+ AcEdCorsorType[AcEdCorsorType["EntitySelect"] = 8] = "EntitySelect";
13
+ AcEdCorsorType[AcEdCorsorType["Parallelogram"] = 9] = "Parallelogram";
14
+ AcEdCorsorType[AcEdCorsorType["EntitySelectNoPersp"] = 10] = "EntitySelectNoPersp";
15
+ AcEdCorsorType[AcEdCorsorType["PkfirstOrGrips"] = 11] = "PkfirstOrGrips";
16
+ AcEdCorsorType[AcEdCorsorType["CrosshairDashed"] = 12] = "CrosshairDashed";
17
+ AcEdCorsorType[AcEdCorsorType["Grab"] = 13] = "Grab";
18
+ })(AcEdCorsorType || (AcEdCorsorType = {}));
19
+ /**
20
+ * The class to create and manage cursor
21
+ * @internal
22
+ */
23
+ var AcEdCursorManager = /** @class */ (function () {
24
+ function AcEdCursorManager() {
25
+ this._cursorMap = new Map();
26
+ this._cursorMap.set(AcEdCorsorType.Crosshair, this.createRectCrossIcon(10, 10));
27
+ }
28
+ AcEdCursorManager.prototype.setCursor = function (cursorType, element) {
29
+ if (cursorType <= AcEdCorsorType.NoSpecialCursor) {
30
+ element.style.cursor = 'default';
31
+ }
32
+ else if (cursorType == AcEdCorsorType.Grab) {
33
+ element.style.cursor = 'grab';
34
+ }
35
+ else {
36
+ var cursor = this._cursorMap.get(cursorType);
37
+ if (cursor) {
38
+ element.style.cursor = cursor;
39
+ }
40
+ }
41
+ };
42
+ /**
43
+ * Encode SVG string to one cursor defined using url() in CSS
44
+ * @param svgString Input svg string
45
+ * @param xOffset Input x offset for cursor hotspot
46
+ * @param yOffset Input y offset for cursor hotspot
47
+ * @returns
48
+ */
49
+ AcEdCursorManager.prototype.encodeSvg = function (svgString, xOffset, yOffset) {
50
+ if (xOffset === void 0) { xOffset = 0; }
51
+ if (yOffset === void 0) { yOffset = 0; }
52
+ return "url('data:image/svg+xml;base64,".concat(btoa(svgString), "') ").concat(xOffset, " ").concat(yOffset, ", auto");
53
+ };
54
+ /**
55
+ * Create one svg icon with one rectangle plus two cross lines
56
+ * @param rectSize Input the width and height of rectangle
57
+ * @param crossLineLength Input the length of one cross line
58
+ * @param lineColor Input line color
59
+ * @returns Return svg string of the icon
60
+ */
61
+ AcEdCursorManager.prototype.createRectCrossIcon = function (rectSize, lineLength, lineColor) {
62
+ if (lineColor === void 0) { lineColor = 'white'; }
63
+ var halfSize = rectSize / 2;
64
+ var svgSize = rectSize + 2 * lineLength;
65
+ var svg = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(svgSize, "\" height=\"").concat(svgSize, "\" viewBox=\"0 0 ").concat(svgSize, " ").concat(svgSize, "\">\n <rect x=\"").concat(lineLength, "\" y=\"").concat(lineLength, "\" width=\"").concat(rectSize, "\" height=\"").concat(rectSize, "\" fill=\"none\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(halfSize + lineLength, "\" y1=\"0\" x2=\"").concat(halfSize + lineLength, "\" y2=\"").concat(lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(rectSize + lineLength, "\" y1=\"").concat(halfSize + lineLength, "\" x2=\"").concat(rectSize + 2 * lineLength, "\" y2=\"").concat(halfSize + lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(halfSize + lineLength, "\" y1=\"").concat(rectSize + lineLength, "\" x2=\"").concat(halfSize + lineLength, "\" y2=\"").concat(rectSize + 2 * lineLength, "\" stroke=\"").concat(lineColor, "\" />\n <line x1=\"0\" y1=\"").concat(halfSize + lineLength, "\" x2=\"").concat(lineLength, "\" y2=\"").concat(halfSize + lineLength, "\" stroke=\"").concat(lineColor, "\" />\n </svg>\n ");
66
+ return this.encodeSvg(svg, halfSize + lineLength, halfSize + lineLength);
67
+ };
68
+ return AcEdCursorManager;
69
+ }());
70
+ export { AcEdCursorManager };
71
+ //# sourceMappingURL=AcEdCursorManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,0EAAoB,CAAA;IACpB,6DAAa,CAAA;IACb,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,6DAAS,CAAA;IACT,2EAAgB,CAAA;IAChB,6EAAiB,CAAA;IACjB,6DAAS,CAAA;IACT,mEAAY,CAAA;IACZ,qEAAa,CAAA;IACb,kFAAmB,CAAA;IACnB,wEAAc,CAAA;IACd,0EAAe,CAAA;IACf,oDAAI,CAAA;AACN,CAAC,EAhBW,cAAc,KAAd,cAAc,QAgBzB;AAED;;;GAGG;AACH;IAEE;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CACjB,cAAc,CAAC,SAAS,EACxB,IAAI,CAAC,mB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nG,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,CAAC,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,uCACzI,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,UAAU,qBAAS,QAAQ,GAAG,CAAC,GAAG,UAAU,yBAAa,SAAS,gDAClI,QAAQ,GAAG,UAAU,qBAAS,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,8BAElH,CAAA;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAA;IAC1E,CAAC;IACH,wBAAC;AAAD,CAAC,AA/DD,IA+DC"}
@@ -0,0 +1,14 @@
1
+ import { AcGePoint2d } from '@mlightcad/data-model';
2
+ import { AcEdBaseView } from '../view/AcEdBaseView';
3
+ import { AcEdBaseInput } from './AcEdBaseInput';
4
+ /**
5
+ * Class used to input one point
6
+ * @internal
7
+ */
8
+ export declare class AcEdInputPoint extends AcEdBaseInput<AcGePoint2d> {
9
+ constructor(view: AcEdBaseView);
10
+ activate(): void;
11
+ deactivate(): void;
12
+ private onClick;
13
+ }
14
+ //# sourceMappingURL=AcEdInputPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdInputPoint.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdInputPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;GAGG;AACH,qBAAa,cAAe,SAAQ,aAAa,CAAC,WAAW,CAAC;gBAChD,IAAI,EAAE,YAAY;IAI9B,QAAQ;IAKR,UAAU;IAKV,OAAO,CAAC,OAAO,CAEd;CACF"}