@mlightcad/cad-simple-viewer 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +2 -1
  2. package/dist/index.js +25678 -48997
  3. package/dist/index.umd.cjs +571 -603
  4. package/dist/libredwg-parser-worker.js +3955 -7422
  5. package/dist/mtext-renderer-worker.js +2727 -2539
  6. package/lib/app/AcApAnnotation.js +4 -4
  7. package/lib/app/AcApAnnotation.js.map +1 -1
  8. package/lib/app/AcApDocManager.d.ts +56 -2
  9. package/lib/app/AcApDocManager.d.ts.map +1 -1
  10. package/lib/app/AcApDocManager.js +182 -31
  11. package/lib/app/AcApDocManager.js.map +1 -1
  12. package/lib/app/index.d.ts +1 -0
  13. package/lib/app/index.d.ts.map +1 -1
  14. package/lib/app/index.js +1 -0
  15. package/lib/app/index.js.map +1 -1
  16. package/lib/app/openFileProgress.d.ts +10 -0
  17. package/lib/app/openFileProgress.d.ts.map +1 -0
  18. package/lib/app/openFileProgress.js +20 -0
  19. package/lib/app/openFileProgress.js.map +1 -0
  20. package/lib/command/AcApSwitchBgCmd.d.ts +3 -0
  21. package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -1
  22. package/lib/command/AcApSwitchBgCmd.js +14 -7
  23. package/lib/command/AcApSwitchBgCmd.js.map +1 -1
  24. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  25. package/lib/command/AcApZoomCmd.js +3 -3
  26. package/lib/command/AcApZoomCmd.js.map +1 -1
  27. package/lib/command/convert/index.d.ts +0 -1
  28. package/lib/command/convert/index.d.ts.map +1 -1
  29. package/lib/command/convert/index.js +0 -1
  30. package/lib/command/convert/index.js.map +1 -1
  31. package/lib/command/draw/AcApArcCmd.d.ts.map +1 -1
  32. package/lib/command/draw/AcApArcCmd.js +47 -20
  33. package/lib/command/draw/AcApArcCmd.js.map +1 -1
  34. package/lib/command/draw/AcApCircleCmd.d.ts.map +1 -1
  35. package/lib/command/draw/AcApCircleCmd.js +5 -6
  36. package/lib/command/draw/AcApCircleCmd.js.map +1 -1
  37. package/lib/command/draw/AcApEllipseCmd.d.ts.map +1 -1
  38. package/lib/command/draw/AcApEllipseCmd.js +4 -6
  39. package/lib/command/draw/AcApEllipseCmd.js.map +1 -1
  40. package/lib/command/draw/AcApMLineCmd.d.ts.map +1 -1
  41. package/lib/command/draw/AcApMLineCmd.js +4 -7
  42. package/lib/command/draw/AcApMLineCmd.js.map +1 -1
  43. package/lib/command/draw/AcApMTextCmd.d.ts.map +1 -1
  44. package/lib/command/draw/AcApMTextCmd.js +3 -1
  45. package/lib/command/draw/AcApMTextCmd.js.map +1 -1
  46. package/lib/command/draw/AcApPolygonCmd.d.ts.map +1 -1
  47. package/lib/command/draw/AcApPolygonCmd.js +4 -5
  48. package/lib/command/draw/AcApPolygonCmd.js.map +1 -1
  49. package/lib/command/draw/AcApPolylineCmd.d.ts +49 -0
  50. package/lib/command/draw/AcApPolylineCmd.d.ts.map +1 -1
  51. package/lib/command/draw/AcApPolylineCmd.js +200 -18
  52. package/lib/command/draw/AcApPolylineCmd.js.map +1 -1
  53. package/lib/command/draw/AcApRayCmd.d.ts.map +1 -1
  54. package/lib/command/draw/AcApRayCmd.js +2 -3
  55. package/lib/command/draw/AcApRayCmd.js.map +1 -1
  56. package/lib/command/draw/AcApRectCmd.d.ts.map +1 -1
  57. package/lib/command/draw/AcApRectCmd.js +10 -10
  58. package/lib/command/draw/AcApRectCmd.js.map +1 -1
  59. package/lib/command/draw/AcApSplineCmd.d.ts.map +1 -1
  60. package/lib/command/draw/AcApSplineCmd.js +3 -6
  61. package/lib/command/draw/AcApSplineCmd.js.map +1 -1
  62. package/lib/command/draw/AcApXLineCmd.d.ts.map +1 -1
  63. package/lib/command/draw/AcApXLineCmd.js +2 -3
  64. package/lib/command/draw/AcApXLineCmd.js.map +1 -1
  65. package/lib/command/measure/AcApClearMeasurementsCmd.d.ts +11 -0
  66. package/lib/command/measure/AcApClearMeasurementsCmd.d.ts.map +1 -1
  67. package/lib/command/measure/AcApClearMeasurementsCmd.js +15 -4
  68. package/lib/command/measure/AcApClearMeasurementsCmd.js.map +1 -1
  69. package/lib/command/measure/AcApMeasureAngleCmd.d.ts.map +1 -1
  70. package/lib/command/measure/AcApMeasureAngleCmd.js +15 -6
  71. package/lib/command/measure/AcApMeasureAngleCmd.js.map +1 -1
  72. package/lib/command/measure/AcApMeasureArcCmd.d.ts.map +1 -1
  73. package/lib/command/measure/AcApMeasureArcCmd.js +11 -4
  74. package/lib/command/measure/AcApMeasureArcCmd.js.map +1 -1
  75. package/lib/command/measure/AcApMeasureAreaCmd.d.ts.map +1 -1
  76. package/lib/command/measure/AcApMeasureAreaCmd.js +11 -4
  77. package/lib/command/measure/AcApMeasureAreaCmd.js.map +1 -1
  78. package/lib/command/measure/AcApMeasureDistanceCmd.d.ts +3 -2
  79. package/lib/command/measure/AcApMeasureDistanceCmd.d.ts.map +1 -1
  80. package/lib/command/measure/AcApMeasureDistanceCmd.js +14 -6
  81. package/lib/command/measure/AcApMeasureDistanceCmd.js.map +1 -1
  82. package/lib/command/modify/AcApOffsetCmd.d.ts +30 -0
  83. package/lib/command/modify/AcApOffsetCmd.d.ts.map +1 -0
  84. package/lib/command/modify/AcApOffsetCmd.js +425 -0
  85. package/lib/command/modify/AcApOffsetCmd.js.map +1 -0
  86. package/lib/command/modify/AcApRotateCmd.d.ts.map +1 -1
  87. package/lib/command/modify/AcApRotateCmd.js +3 -4
  88. package/lib/command/modify/AcApRotateCmd.js.map +1 -1
  89. package/lib/command/modify/index.d.ts +1 -0
  90. package/lib/command/modify/index.d.ts.map +1 -1
  91. package/lib/command/modify/index.js +1 -0
  92. package/lib/command/modify/index.js.map +1 -1
  93. package/lib/command/review/AcApRevCircleCmd.d.ts.map +1 -1
  94. package/lib/command/review/AcApRevCircleCmd.js +4 -1
  95. package/lib/command/review/AcApRevCircleCmd.js.map +1 -1
  96. package/lib/editor/global/AcEdUiColor.d.ts +183 -0
  97. package/lib/editor/global/AcEdUiColor.d.ts.map +1 -0
  98. package/lib/editor/global/AcEdUiColor.js +224 -0
  99. package/lib/editor/global/AcEdUiColor.js.map +1 -0
  100. package/lib/editor/global/AcEdUiTheme.d.ts +0 -1
  101. package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -1
  102. package/lib/editor/global/AcEdUiTheme.js +0 -5
  103. package/lib/editor/global/AcEdUiTheme.js.map +1 -1
  104. package/lib/editor/global/eventBus.d.ts +3 -0
  105. package/lib/editor/global/eventBus.d.ts.map +1 -1
  106. package/lib/editor/global/eventBus.js.map +1 -1
  107. package/lib/editor/global/index.d.ts +1 -0
  108. package/lib/editor/global/index.d.ts.map +1 -1
  109. package/lib/editor/global/index.js +1 -0
  110. package/lib/editor/global/index.js.map +1 -1
  111. package/lib/editor/input/AcEdCursorManager.d.ts +4 -0
  112. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  113. package/lib/editor/input/AcEdCursorManager.js +11 -8
  114. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  115. package/lib/editor/input/AcEdOrthoMode.d.ts +11 -0
  116. package/lib/editor/input/AcEdOrthoMode.d.ts.map +1 -0
  117. package/lib/editor/input/AcEdOrthoMode.js +22 -0
  118. package/lib/editor/input/AcEdOrthoMode.js.map +1 -0
  119. package/lib/editor/input/AcEdPolarTracking.d.ts +107 -0
  120. package/lib/editor/input/AcEdPolarTracking.d.ts.map +1 -0
  121. package/lib/editor/input/AcEdPolarTracking.js +398 -0
  122. package/lib/editor/input/AcEdPolarTracking.js.map +1 -0
  123. package/lib/editor/input/AcEdSelectionFilter.js +7 -6
  124. package/lib/editor/input/AcEdSelectionFilter.js.map +1 -1
  125. package/lib/editor/input/AcEditor.d.ts +4 -0
  126. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  127. package/lib/editor/input/AcEditor.js +6 -0
  128. package/lib/editor/input/AcEditor.js.map +1 -1
  129. package/lib/editor/input/index.d.ts +2 -0
  130. package/lib/editor/input/index.d.ts.map +1 -1
  131. package/lib/editor/input/index.js +2 -0
  132. package/lib/editor/input/index.js.map +1 -1
  133. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  134. package/lib/editor/input/marker/AcEdMarker.js +3 -2
  135. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  136. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +4 -0
  137. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -1
  138. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +11 -0
  139. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -1
  140. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -1
  141. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +1 -1
  142. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -1
  143. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  144. package/lib/editor/input/ui/AcEdCommandLine.js +1 -1
  145. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  146. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +13 -0
  147. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  148. package/lib/editor/input/ui/AcEdFloatingInput.js +48 -3
  149. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  150. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +5 -0
  151. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  152. package/lib/editor/input/ui/AcEdFloatingMessage.js +1 -1
  153. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  154. package/lib/editor/input/ui/AcEdInputManager.d.ts +25 -6
  155. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  156. package/lib/editor/input/ui/AcEdInputManager.js +164 -63
  157. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  158. package/lib/editor/input/ui/AcEdMTextEditor.d.ts +67 -2
  159. package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -1
  160. package/lib/editor/input/ui/AcEdMTextEditor.js +213 -21
  161. package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -1
  162. package/lib/editor/input/ui/AcEdRubberBand.d.ts +8 -0
  163. package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
  164. package/lib/editor/input/ui/AcEdRubberBand.js +62 -37
  165. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  166. package/lib/i18n/en/command.d.ts +71 -11
  167. package/lib/i18n/en/command.d.ts.map +1 -1
  168. package/lib/i18n/en/command.js +74 -14
  169. package/lib/i18n/en/command.js.map +1 -1
  170. package/lib/i18n/en/jig.d.ts +8 -0
  171. package/lib/i18n/en/jig.d.ts.map +1 -1
  172. package/lib/i18n/en/jig.js +8 -0
  173. package/lib/i18n/en/jig.js.map +1 -1
  174. package/lib/i18n/zh/command.d.ts +71 -11
  175. package/lib/i18n/zh/command.d.ts.map +1 -1
  176. package/lib/i18n/zh/command.js +74 -14
  177. package/lib/i18n/zh/command.js.map +1 -1
  178. package/lib/i18n/zh/jig.d.ts +8 -0
  179. package/lib/i18n/zh/jig.d.ts.map +1 -1
  180. package/lib/i18n/zh/jig.js +8 -0
  181. package/lib/i18n/zh/jig.js.map +1 -1
  182. package/lib/index.d.ts +2 -1
  183. package/lib/index.d.ts.map +1 -1
  184. package/lib/index.js +2 -1
  185. package/lib/index.js.map +1 -1
  186. package/lib/plugin/AcApLazyPluginRegistration.d.ts +28 -0
  187. package/lib/plugin/AcApLazyPluginRegistration.d.ts.map +1 -0
  188. package/lib/plugin/AcApLazyPluginRegistration.js +2 -0
  189. package/lib/plugin/AcApLazyPluginRegistration.js.map +1 -0
  190. package/lib/plugin/AcApPluginManager.d.ts +38 -0
  191. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  192. package/lib/plugin/AcApPluginManager.js +147 -22
  193. package/lib/plugin/AcApPluginManager.js.map +1 -1
  194. package/lib/plugin/index.d.ts +1 -0
  195. package/lib/plugin/index.d.ts.map +1 -1
  196. package/lib/plugin/index.js +1 -0
  197. package/lib/plugin/index.js.map +1 -1
  198. package/lib/util/AcApExportFileNameUtil.d.ts +22 -0
  199. package/lib/util/AcApExportFileNameUtil.d.ts.map +1 -0
  200. package/lib/util/AcApExportFileNameUtil.js +49 -0
  201. package/lib/util/AcApExportFileNameUtil.js.map +1 -0
  202. package/lib/util/AcApFontUtil.d.ts +79 -0
  203. package/lib/util/AcApFontUtil.d.ts.map +1 -0
  204. package/lib/util/AcApFontUtil.js +173 -0
  205. package/lib/util/AcApFontUtil.js.map +1 -0
  206. package/lib/util/index.d.ts +3 -0
  207. package/lib/util/index.d.ts.map +1 -1
  208. package/lib/util/index.js +3 -0
  209. package/lib/util/index.js.map +1 -1
  210. package/lib/util/yieldToMain.d.ts +5 -0
  211. package/lib/util/yieldToMain.d.ts.map +1 -0
  212. package/lib/util/yieldToMain.js +11 -0
  213. package/lib/util/yieldToMain.js.map +1 -0
  214. package/lib/view/AcTrLayoutView.d.ts +13 -1
  215. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  216. package/lib/view/AcTrLayoutView.js +20 -1
  217. package/lib/view/AcTrLayoutView.js.map +1 -1
  218. package/lib/view/AcTrLayoutViewManager.d.ts +3 -1
  219. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
  220. package/lib/view/AcTrLayoutViewManager.js +4 -2
  221. package/lib/view/AcTrLayoutViewManager.js.map +1 -1
  222. package/lib/view/AcTrScene.d.ts +38 -6
  223. package/lib/view/AcTrScene.d.ts.map +1 -1
  224. package/lib/view/AcTrScene.js +57 -30
  225. package/lib/view/AcTrScene.js.map +1 -1
  226. package/lib/view/AcTrView2d.d.ts +184 -1
  227. package/lib/view/AcTrView2d.d.ts.map +1 -1
  228. package/lib/view/AcTrView2d.js +657 -104
  229. package/lib/view/AcTrView2d.js.map +1 -1
  230. package/lib/view/index.d.ts +1 -0
  231. package/lib/view/index.d.ts.map +1 -1
  232. package/lib/view/index.js +1 -0
  233. package/lib/view/index.js.map +1 -1
  234. package/package.json +12 -9
  235. package/lib/command/convert/AcApConvertToSvgCmd.d.ts +0 -32
  236. package/lib/command/convert/AcApConvertToSvgCmd.d.ts.map +0 -1
  237. package/lib/command/convert/AcApConvertToSvgCmd.js +0 -98
  238. package/lib/command/convert/AcApConvertToSvgCmd.js.map +0 -1
  239. package/lib/command/convert/AcApSvgConvertor.d.ts +0 -53
  240. package/lib/command/convert/AcApSvgConvertor.d.ts.map +0 -1
  241. package/lib/command/convert/AcApSvgConvertor.js +0 -103
  242. package/lib/command/convert/AcApSvgConvertor.js.map +0 -1
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Canvas and drawing-display colours that are independent of {@link AcEdUiTheme}.
3
+ *
4
+ * `AcEdUiTheme` and the `COLORTHEME` sysvar drive chrome tokens (CSS
5
+ * variables). This module holds helpers for the CAD viewport:
6
+ *
7
+ * - **Layout background** — `MODELBKCOLOR` / `PAPERBKCOLOR` control the
8
+ * canvas clear colour and ACI-7 foreground inversion.
9
+ * - **UI colour theme** — `COLORTHEME` only affects viewer chrome, not
10
+ * canvas or ACI-7 rendering.
11
+ *
12
+ * Shared colour constants and luminance helpers live in
13
+ * `@mlightcad/three-renderer` (`AcTrDisplayColors`) and are re-exported
14
+ * here for editor callers.
15
+ */
16
+ export { contrastingForegroundColor, DARK_THEME_FOREGROUND, foregroundColorForBackground, isLightBackground, LIGHT_THEME_FOREGROUND, MODEL_SPACE_BACKGROUND, PAPER_SPACE_BACKGROUND } from '@mlightcad/three-renderer';
17
+ import { AcCmColor, AcDbDatabase } from '@mlightcad/data-model';
18
+ /**
19
+ * Returns the UI chrome foreground colour that matches `COLORTHEME`.
20
+ *
21
+ * This maps the UI light/dark theme flag to shared constants. It does
22
+ * **not** drive ACI-7 drawing colours — use
23
+ * {@link foregroundColorForBackground} for canvas-linked inversion.
24
+ *
25
+ * @param isLightTheme - `true` when `COLORTHEME` indicates a light UI theme
26
+ * (value `1`); `false` for a dark UI theme (value `0`).
27
+ * @returns Packed RGB: {@link LIGHT_THEME_FOREGROUND} for light UI,
28
+ * {@link DARK_THEME_FOREGROUND} for dark UI.
29
+ *
30
+ * @see {@link isLightColorTheme} — normalises raw `COLORTHEME` sysvar values
31
+ * @see {@link foregroundColorForBackground} — ACI-7 inversion from layout bg
32
+ */
33
+ export declare function foregroundColorFromColorTheme(isLightTheme: boolean): number;
34
+ /**
35
+ * Normalises a raw `COLORTHEME` system-variable value to a boolean light UI
36
+ * theme flag.
37
+ *
38
+ * AutoCAD stores `COLORTHEME` as a number (`0` = dark, `1` = light), but the
39
+ * value may arrive from the database or event payloads as a number, boolean,
40
+ * or string. This helper accepts all common representations so callers do not
41
+ * need to duplicate parsing logic.
42
+ *
43
+ * @param value - Raw sysvar value from {@link AcDbSysVarManager} or a
44
+ * `sysVarChanged` event. Recognised forms:
45
+ * - `number` — light when equal to `1`
46
+ * - `boolean` — returned as-is
47
+ * - `string` — light when `'light'`, `'1'`, or `'true'` (case-insensitive)
48
+ * @returns `true` for a light colour theme; `false` for dark or any other value.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * isLightColorTheme(1) // true
53
+ * isLightColorTheme(0) // false
54
+ * isLightColorTheme('light') // true
55
+ * isLightColorTheme('dark') // false
56
+ * ```
57
+ */
58
+ export declare function isLightColorTheme(value: unknown): boolean;
59
+ /**
60
+ * Reports whether the given database's current space is model space.
61
+ *
62
+ * Compares `database.currentSpaceId` against the object id of the block table's
63
+ * model-space record. Used when reacting to sysvar changes or reading layout
64
+ * background colours so the correct sysvar (`MODELBKCOLOR` vs. `PAPERBKCOLOR`)
65
+ * is consulted.
66
+ *
67
+ * @param database - Active drawing database whose current space is inspected.
68
+ * @returns `true` when the database is in model space; `false` when it is in
69
+ * a paper-space layout.
70
+ *
71
+ * @see {@link layoutBackgroundSysVar} — picks the background sysvar name from
72
+ * this result
73
+ */
74
+ export declare function isModelSpaceDatabase(database: AcDbDatabase): boolean;
75
+ /**
76
+ * Returns the layout-background system-variable name for the active space.
77
+ *
78
+ * AutoCAD stores separate background colours for model space and paper space:
79
+ *
80
+ * - Model space — {@link AcDbSystemVariables.MODELBKCOLOR}
81
+ * - Paper space — {@link AcDbSystemVariables.PAPERBKCOLOR}
82
+ *
83
+ * @param isModelSpace - `true` to target model space; `false` for the active
84
+ * paper-space layout.
85
+ * @returns The sysvar name string passed to {@link AcDbSysVarManager}.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * layoutBackgroundSysVar(true) // MODELBKCOLOR
90
+ * layoutBackgroundSysVar(false) // PAPERBKCOLOR
91
+ * ```
92
+ *
93
+ * @see {@link readLayoutBackgroundColor} — reads and resolves the colour value
94
+ * @see {@link AcApSwitchBgCmd} — toggles the sysvar via this helper
95
+ */
96
+ export declare function layoutBackgroundSysVar(isModelSpace: boolean): string;
97
+ /**
98
+ * Resolves a packed RGB canvas background from an {@link AcCmColor} sysvar
99
+ * value, with space-specific defaults as fallback.
100
+ *
101
+ * When the sysvar holds a concrete RGB colour (`color.RGB` is defined), that
102
+ * value is returned directly. Otherwise the AutoCAD defaults are used:
103
+ * {@link MODEL_SPACE_BACKGROUND} (`0x000000`) for model space or
104
+ * {@link PAPER_SPACE_BACKGROUND} (`0xffffff`) for paper space.
105
+ *
106
+ * @param color - Layout background colour from `MODELBKCOLOR` or
107
+ * `PAPERBKCOLOR`, or `undefined` when the sysvar is unset.
108
+ * @param isModelSpace - `true` when resolving for model space; `false` for
109
+ * paper space (selects the default fallback).
110
+ * @returns Packed 24-bit RGB suitable for the renderer clear colour.
111
+ *
112
+ * @see {@link readLayoutBackgroundColor} — reads the sysvar then calls this
113
+ */
114
+ export declare function canvasBackgroundFromColor(color: AcCmColor | undefined, isModelSpace: boolean): number;
115
+ /**
116
+ * Reads the layout background colour from the database for the given space.
117
+ *
118
+ * Looks up `MODELBKCOLOR` or `PAPERBKCOLOR` (via
119
+ * {@link layoutBackgroundSysVar}) through {@link AcDbSysVarManager}, then
120
+ * converts the {@link AcCmColor} result to a packed RGB value with
121
+ * {@link canvasBackgroundFromColor}.
122
+ *
123
+ * @param database - Drawing database whose sysvars are read.
124
+ * @param isModelSpace - `true` to read model-space background; `false` to read
125
+ * paper-space background.
126
+ * @returns Packed 24-bit RGB canvas background colour.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const bg = readLayoutBackgroundColor(database, true)
131
+ * renderer.setClearColor(bg)
132
+ * ```
133
+ *
134
+ * @see {@link AcTrView2d.syncDisplaySysVars} — applies this on document open
135
+ */
136
+ export declare function readLayoutBackgroundColor(database: AcDbDatabase, isModelSpace: boolean): number;
137
+ /**
138
+ * Toggles a layout background colour between black and white.
139
+ *
140
+ * Inspects the current colour's perceived luminance via
141
+ * {@link isLightBackground} and returns a new {@link AcCmColor} set to pure
142
+ * black (`RGB 0, 0, 0`) when the input is light, or pure white
143
+ * (`RGB 255, 255, 255`) when the input is dark. If the source colour has no
144
+ * RGB component, {@link MODEL_SPACE_BACKGROUND} is used as the luminance
145
+ * reference.
146
+ *
147
+ * Used by {@link AcApSwitchBgCmd} to flip `MODELBKCOLOR` / `PAPERBKCOLOR`
148
+ * without disturbing other colour fields on the sysvar.
149
+ *
150
+ * @param color - Current layout background colour from the database sysvar.
151
+ * @returns New `AcCmColor` with `AcCmColorMethod.ByColor` and inverted
152
+ * black/white RGB.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * const next = toggleBlackWhiteBackgroundColor(currentColor)
157
+ * sysVarManager.setVar(variableName, next, database)
158
+ * ```
159
+ *
160
+ * @see {@link AcApSwitchBgCmd}
161
+ */
162
+ export declare function toggleBlackWhiteBackgroundColor(color: AcCmColor): AcCmColor;
163
+ /**
164
+ * Chooses a CSS cursor colour that contrasts with the canvas background.
165
+ *
166
+ * Returns `'black'` on light backgrounds and `'white'` on dark backgrounds so
167
+ * the crosshair and other SVG/CSS cursors remain visible. The decision is
168
+ * delegated to {@link isLightBackground}.
169
+ *
170
+ * @param backgroundColor - Current renderer clear colour as packed
171
+ * `0xRRGGBB` RGB.
172
+ * @returns `'black'` or `'white'` for use as a CSS colour keyword.
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * const cursor = cursorColorForBackground(view.backgroundColor)
177
+ * editor.setCursorColor(cursor)
178
+ * ```
179
+ *
180
+ * @see {@link AcEdCursorManager.syncCursorBackground}
181
+ */
182
+ export declare function cursorColorForBackground(backgroundColor: number): 'white' | 'black';
183
+ //# sourceMappingURL=AcEdUiColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdUiColor.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdUiColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,SAAS,EAET,YAAY,EAGb,MAAM,uBAAuB,CAAA;AAQ9B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,OAAO,GAAG,MAAM,CAE3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAIpE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,OAAO,GAAG,MAAM,CAIpE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,YAAY,EAAE,OAAO,GACpB,MAAM,CAMR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,OAAO,GACpB,MAAM,CAOR;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAS3E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,GACtB,OAAO,GAAG,OAAO,CAEnB"}
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Canvas and drawing-display colours that are independent of {@link AcEdUiTheme}.
3
+ *
4
+ * `AcEdUiTheme` and the `COLORTHEME` sysvar drive chrome tokens (CSS
5
+ * variables). This module holds helpers for the CAD viewport:
6
+ *
7
+ * - **Layout background** — `MODELBKCOLOR` / `PAPERBKCOLOR` control the
8
+ * canvas clear colour and ACI-7 foreground inversion.
9
+ * - **UI colour theme** — `COLORTHEME` only affects viewer chrome, not
10
+ * canvas or ACI-7 rendering.
11
+ *
12
+ * Shared colour constants and luminance helpers live in
13
+ * `@mlightcad/three-renderer` (`AcTrDisplayColors`) and are re-exported
14
+ * here for editor callers.
15
+ */
16
+ export { contrastingForegroundColor, DARK_THEME_FOREGROUND, foregroundColorForBackground, isLightBackground, LIGHT_THEME_FOREGROUND, MODEL_SPACE_BACKGROUND, PAPER_SPACE_BACKGROUND } from '@mlightcad/three-renderer';
17
+ import { AcCmColor, AcCmColorMethod, AcDbSystemVariables, AcDbSysVarManager } from '@mlightcad/data-model';
18
+ import { contrastingForegroundColor, isLightBackground, MODEL_SPACE_BACKGROUND, PAPER_SPACE_BACKGROUND } from '@mlightcad/three-renderer';
19
+ /**
20
+ * Returns the UI chrome foreground colour that matches `COLORTHEME`.
21
+ *
22
+ * This maps the UI light/dark theme flag to shared constants. It does
23
+ * **not** drive ACI-7 drawing colours — use
24
+ * {@link foregroundColorForBackground} for canvas-linked inversion.
25
+ *
26
+ * @param isLightTheme - `true` when `COLORTHEME` indicates a light UI theme
27
+ * (value `1`); `false` for a dark UI theme (value `0`).
28
+ * @returns Packed RGB: {@link LIGHT_THEME_FOREGROUND} for light UI,
29
+ * {@link DARK_THEME_FOREGROUND} for dark UI.
30
+ *
31
+ * @see {@link isLightColorTheme} — normalises raw `COLORTHEME` sysvar values
32
+ * @see {@link foregroundColorForBackground} — ACI-7 inversion from layout bg
33
+ */
34
+ export function foregroundColorFromColorTheme(isLightTheme) {
35
+ return contrastingForegroundColor(isLightTheme);
36
+ }
37
+ /**
38
+ * Normalises a raw `COLORTHEME` system-variable value to a boolean light UI
39
+ * theme flag.
40
+ *
41
+ * AutoCAD stores `COLORTHEME` as a number (`0` = dark, `1` = light), but the
42
+ * value may arrive from the database or event payloads as a number, boolean,
43
+ * or string. This helper accepts all common representations so callers do not
44
+ * need to duplicate parsing logic.
45
+ *
46
+ * @param value - Raw sysvar value from {@link AcDbSysVarManager} or a
47
+ * `sysVarChanged` event. Recognised forms:
48
+ * - `number` — light when equal to `1`
49
+ * - `boolean` — returned as-is
50
+ * - `string` — light when `'light'`, `'1'`, or `'true'` (case-insensitive)
51
+ * @returns `true` for a light colour theme; `false` for dark or any other value.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * isLightColorTheme(1) // true
56
+ * isLightColorTheme(0) // false
57
+ * isLightColorTheme('light') // true
58
+ * isLightColorTheme('dark') // false
59
+ * ```
60
+ */
61
+ export function isLightColorTheme(value) {
62
+ if (typeof value === 'number') {
63
+ return value === 1;
64
+ }
65
+ if (typeof value === 'boolean') {
66
+ return value;
67
+ }
68
+ var normalized = String(value).toLowerCase();
69
+ return normalized === 'light' || normalized === '1' || normalized === 'true';
70
+ }
71
+ /**
72
+ * Reports whether the given database's current space is model space.
73
+ *
74
+ * Compares `database.currentSpaceId` against the object id of the block table's
75
+ * model-space record. Used when reacting to sysvar changes or reading layout
76
+ * background colours so the correct sysvar (`MODELBKCOLOR` vs. `PAPERBKCOLOR`)
77
+ * is consulted.
78
+ *
79
+ * @param database - Active drawing database whose current space is inspected.
80
+ * @returns `true` when the database is in model space; `false` when it is in
81
+ * a paper-space layout.
82
+ *
83
+ * @see {@link layoutBackgroundSysVar} — picks the background sysvar name from
84
+ * this result
85
+ */
86
+ export function isModelSpaceDatabase(database) {
87
+ return (database.currentSpaceId === database.tables.blockTable.modelSpace.objectId);
88
+ }
89
+ /**
90
+ * Returns the layout-background system-variable name for the active space.
91
+ *
92
+ * AutoCAD stores separate background colours for model space and paper space:
93
+ *
94
+ * - Model space — {@link AcDbSystemVariables.MODELBKCOLOR}
95
+ * - Paper space — {@link AcDbSystemVariables.PAPERBKCOLOR}
96
+ *
97
+ * @param isModelSpace - `true` to target model space; `false` for the active
98
+ * paper-space layout.
99
+ * @returns The sysvar name string passed to {@link AcDbSysVarManager}.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * layoutBackgroundSysVar(true) // MODELBKCOLOR
104
+ * layoutBackgroundSysVar(false) // PAPERBKCOLOR
105
+ * ```
106
+ *
107
+ * @see {@link readLayoutBackgroundColor} — reads and resolves the colour value
108
+ * @see {@link AcApSwitchBgCmd} — toggles the sysvar via this helper
109
+ */
110
+ export function layoutBackgroundSysVar(isModelSpace) {
111
+ return isModelSpace
112
+ ? AcDbSystemVariables.MODELBKCOLOR
113
+ : AcDbSystemVariables.PAPERBKCOLOR;
114
+ }
115
+ /**
116
+ * Resolves a packed RGB canvas background from an {@link AcCmColor} sysvar
117
+ * value, with space-specific defaults as fallback.
118
+ *
119
+ * When the sysvar holds a concrete RGB colour (`color.RGB` is defined), that
120
+ * value is returned directly. Otherwise the AutoCAD defaults are used:
121
+ * {@link MODEL_SPACE_BACKGROUND} (`0x000000`) for model space or
122
+ * {@link PAPER_SPACE_BACKGROUND} (`0xffffff`) for paper space.
123
+ *
124
+ * @param color - Layout background colour from `MODELBKCOLOR` or
125
+ * `PAPERBKCOLOR`, or `undefined` when the sysvar is unset.
126
+ * @param isModelSpace - `true` when resolving for model space; `false` for
127
+ * paper space (selects the default fallback).
128
+ * @returns Packed 24-bit RGB suitable for the renderer clear colour.
129
+ *
130
+ * @see {@link readLayoutBackgroundColor} — reads the sysvar then calls this
131
+ */
132
+ export function canvasBackgroundFromColor(color, isModelSpace) {
133
+ var rgb = color === null || color === void 0 ? void 0 : color.RGB;
134
+ if (rgb != null) {
135
+ return rgb;
136
+ }
137
+ return isModelSpace ? MODEL_SPACE_BACKGROUND : PAPER_SPACE_BACKGROUND;
138
+ }
139
+ /**
140
+ * Reads the layout background colour from the database for the given space.
141
+ *
142
+ * Looks up `MODELBKCOLOR` or `PAPERBKCOLOR` (via
143
+ * {@link layoutBackgroundSysVar}) through {@link AcDbSysVarManager}, then
144
+ * converts the {@link AcCmColor} result to a packed RGB value with
145
+ * {@link canvasBackgroundFromColor}.
146
+ *
147
+ * @param database - Drawing database whose sysvars are read.
148
+ * @param isModelSpace - `true` to read model-space background; `false` to read
149
+ * paper-space background.
150
+ * @returns Packed 24-bit RGB canvas background colour.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const bg = readLayoutBackgroundColor(database, true)
155
+ * renderer.setClearColor(bg)
156
+ * ```
157
+ *
158
+ * @see {@link AcTrView2d.syncDisplaySysVars} — applies this on document open
159
+ */
160
+ export function readLayoutBackgroundColor(database, isModelSpace) {
161
+ var sysVar = layoutBackgroundSysVar(isModelSpace);
162
+ var color = AcDbSysVarManager.instance().getVar(sysVar, database);
163
+ return canvasBackgroundFromColor(color, isModelSpace);
164
+ }
165
+ /**
166
+ * Toggles a layout background colour between black and white.
167
+ *
168
+ * Inspects the current colour's perceived luminance via
169
+ * {@link isLightBackground} and returns a new {@link AcCmColor} set to pure
170
+ * black (`RGB 0, 0, 0`) when the input is light, or pure white
171
+ * (`RGB 255, 255, 255`) when the input is dark. If the source colour has no
172
+ * RGB component, {@link MODEL_SPACE_BACKGROUND} is used as the luminance
173
+ * reference.
174
+ *
175
+ * Used by {@link AcApSwitchBgCmd} to flip `MODELBKCOLOR` / `PAPERBKCOLOR`
176
+ * without disturbing other colour fields on the sysvar.
177
+ *
178
+ * @param color - Current layout background colour from the database sysvar.
179
+ * @returns New `AcCmColor` with `AcCmColorMethod.ByColor` and inverted
180
+ * black/white RGB.
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const next = toggleBlackWhiteBackgroundColor(currentColor)
185
+ * sysVarManager.setVar(variableName, next, database)
186
+ * ```
187
+ *
188
+ * @see {@link AcApSwitchBgCmd}
189
+ */
190
+ export function toggleBlackWhiteBackgroundColor(color) {
191
+ var _a;
192
+ var rgb = (_a = color.RGB) !== null && _a !== void 0 ? _a : MODEL_SPACE_BACKGROUND;
193
+ var next = new AcCmColor(AcCmColorMethod.ByColor);
194
+ if (isLightBackground(rgb)) {
195
+ next.setRGB(0, 0, 0);
196
+ }
197
+ else {
198
+ next.setRGB(255, 255, 255);
199
+ }
200
+ return next;
201
+ }
202
+ /**
203
+ * Chooses a CSS cursor colour that contrasts with the canvas background.
204
+ *
205
+ * Returns `'black'` on light backgrounds and `'white'` on dark backgrounds so
206
+ * the crosshair and other SVG/CSS cursors remain visible. The decision is
207
+ * delegated to {@link isLightBackground}.
208
+ *
209
+ * @param backgroundColor - Current renderer clear colour as packed
210
+ * `0xRRGGBB` RGB.
211
+ * @returns `'black'` or `'white'` for use as a CSS colour keyword.
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * const cursor = cursorColorForBackground(view.backgroundColor)
216
+ * editor.setCursorColor(cursor)
217
+ * ```
218
+ *
219
+ * @see {@link AcEdCursorManager.syncCursorBackground}
220
+ */
221
+ export function cursorColorForBackground(backgroundColor) {
222
+ return isLightBackground(backgroundColor) ? 'black' : 'white';
223
+ }
224
+ //# sourceMappingURL=AcEdUiColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdUiColor.js","sourceRoot":"","sources":["../../../src/editor/global/AcEdUiColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,iB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OAAO,CAAA;AAC/D,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export type AcEdUiTheme = 'light' | 'dark';
2
2
  export declare function applyUiTheme(theme: AcEdUiTheme, target?: HTMLElement): void;
3
- export declare function applyUiThemeFromBackground(backgroundColor: number, target?: HTMLElement): void;
4
3
  //# sourceMappingURL=AcEdUiTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdUiTheme.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdUiTheme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAuC1C,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,EAClB,MAAM,GAAE,WAAsC,QAO/C;AAED,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,WAAsC,QAI/C"}
1
+ {"version":3,"file":"AcEdUiTheme.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdUiTheme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAuC1C,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,EAClB,MAAM,GAAE,WAAsC,QAO/C"}
@@ -36,9 +36,4 @@ export function applyUiTheme(theme, target) {
36
36
  });
37
37
  target.setAttribute('data-ml-ui-theme', theme);
38
38
  }
39
- export function applyUiThemeFromBackground(backgroundColor, target) {
40
- if (target === void 0) { target = document.documentElement; }
41
- var theme = backgroundColor === 0xffffff ? 'light' : 'dark';
42
- applyUiTheme(theme, target);
43
- }
44
39
  //# sourceMappingURL=AcEdUiTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdUiTheme.js","sourceRoot":"","sources":["../../../src/editor/global/AcEdUiTheme.ts"],"names":[],"mappings":"AAEA,IAAM,YAAY,GAAgD;IAChE,KAAK,EAAE;QACL,cAAc,EAAE,uCAAuC;QACvD,oBAAoB,EAAE,uCAAuC;QAC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CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;AAChD,CAAC"}
@@ -17,6 +17,7 @@ export interface AcEdFontNotLoadedInfo {
17
17
  * - **File Operations**: `open-file`, `open-file-progress`, `failed-to-open-file`
18
18
  * - **Palette Control**: `close-layer-manager`
19
19
  * - **Font Management**: `fonts-not-loaded`, `failed-to-get-avaiable-fonts`, `font-not-found`
20
+ * - **Missing Resources**: `missed-data-changed`
20
21
  * - **User Messages**: `message`
21
22
  */
22
23
  export type AcEdEvents = {
@@ -58,6 +59,8 @@ export type AcEdEvents = {
58
59
  /** Number of entities that require this font */
59
60
  count: number;
60
61
  };
62
+ /** Emitted after missing resource caches change and UI state should refresh */
63
+ 'missed-data-changed': {};
61
64
  };
62
65
  /**
63
66
  * Global event bus for application-wide communication.
@@ -1 +1 @@
1
- {"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAa,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,MAAM,WAAW,qBAAqB;IACpC,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,+CAA+C;IAC/C,WAAW,EAAE,EAAE,CAAA;IACf,8DAA8D;IAC9D,qBAAqB,EAAE,EAAE,CAAA;IACzB,qDAAqD;IACrD,oBAAoB,EAAE,sBAAsB,CAAA;IAC5C,+CAA+C;IAC/C,OAAO,EAAE;QACP,kCAAkC;QAClC,OA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,EAAE,sBAAsB,CAAA;IAC5C,+CAA+C;IAC/C,OAAO,EAAE;QACP,kCAAkC;QAClC,OAAO,EAAE,MAAM,CAAA;QACf,uCAAuC;QACvC,IAAI,EAAE,eAAe,CAAA;KACtB,CAAA;IACD,kEAAkE;IAClE,iBAAiB,EAAE;QACjB,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD,4CAA4C;IAC5C,kBAAkB,EAAE;QAClB,KAAK,EAAE,qBAAqB,EAAE,CAAA;KAC/B,CAAA;IACD,gEAAgE;IAChE,8BAA8B,EAAE;QAC9B,kEAAkE;QAClE,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,wCAAwC;IACxC,qBAAqB,EAAE;QACrB,gDAAgD;QAChD,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,gDAAgD;IAChD,gBAAgB,EAAE;QAChB,+BAA+B;QAC/B,QAAQ,EAAE,MAAM,CAAA;QAChB,gDAAgD;QAChD,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,+EAA+E;IAC/E,qBAAqB,EAAE,EAAE,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAsB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AACA,OAAO,IAAsB,MAAM,MAAM,CAAA;AAgEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,IAAM,QAAQ,GAAwB,IAAI,EAAc,CAAA"}
1
+ {"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AACA,OAAO,IAAsB,MAAM,MAAM,CAAA;AAmEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,IAAM,QAAQ,GAAwB,IAAI,EAAc,CAAA"}
@@ -2,4 +2,5 @@ export * from './AcEdGlobalFunc';
2
2
  export * from './AcEdConditionWaiter';
3
3
  export * from './eventBus';
4
4
  export * from './AcEdUiTheme';
5
+ export * from './AcEdUiColor';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
@@ -2,4 +2,5 @@ export * from './AcEdGlobalFunc';
2
2
  export * from './AcEdConditionWaiter';
3
3
  export * from './eventBus';
4
4
  export * from './AcEdUiTheme';
5
+ export * from './AcEdUiColor';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/global/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
@@ -87,6 +87,10 @@ export declare class AcEdCursorManager {
87
87
  * @param cursorType - The type of cursor to set
88
88
  */
89
89
  setCursor(cursorType: AcEdCorsorType): void;
90
+ /**
91
+ * Syncs crosshair colour with the canvas background set by the view.
92
+ */
93
+ syncBackgroundColor(backgroundColor: number): void;
90
94
  /**
91
95
  * Sets the cursor color for the crosshair cursor
92
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdCursorManager.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,cAAc;IACxB,+CAA+C;IAC/C,eAAe,KAAK;IACpB,mDAAmD;IACnD,SAAS,IAAI;IACb,0CAA0C;IAC1C,UAAU,IAAA;IACV,6CAA6C;IAC7C,UAAU,IAAA;IACV,yBAAyB;IACzB,UAAU,IAAA;IACV,4CAA4C;IAC5C,SAAS,IAAA;IACT,+BAA+B;IAC/B,gBAAgB,IAAA;IAChB,8CAA8C;IAC9C,iBAAiB,IAAA;IACjB,yCAAyC;IACzC,SAAS,IAAA;IACT,8BAA8B;IAC9B,YAAY,IAAA;IACZ,iDAAiD;IACjD,aAAa,IAAA;IACb,+CAA+C;IAC/C,mBAAmB,KAAA;IACnB,gDAAgD;IAChD,cAAc,KAAA;IACd,8BAA8B;IAC9B,eAAe,KAAA;IACf,mCAAmC;IACnC,IAAI,KAAA;CACL;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAC5B,kDAAkD;IAClD,OAAO,CAAC,KAAK,CAAc;IAE3B,oDAAoD;IACpD,OAAO,CAAC,cAAc,CAAiB;IAEvC,wDAAwD;IACxD,OAAO,CAAC,UAAU,CAA6B;IAC/C,mCAAmC;IACnC,OAAO,CAAC,gBAAgB,CAAY;IACpC,2CAA2C;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;IAE1C;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IA0B9B;;OAEG;IACH,IAAI,aAAa,mBAEhB;IAED;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc;IAepC;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAa5B;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIrE;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAsB5B"}
1
+ {"version":3,"file":"AcEdCursorManager.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,cAAc;IACxB,+CAA+C;IAC/C,eAAe,KAAK;IACpB,mDAAmD;IACnD,SAAS,IAAI;IACb,0CAA0C;IAC1C,UAAU,IAAA;IACV,6CAA6C;IAC7C,UAAU,IAAA;IACV,yBAAyB;IACzB,UAAU,IAAA;IACV,4CAA4C;IAC5C,SAAS,IAAA;IACT,+BAA+B;IAC/B,gBAAgB,IAAA;IAChB,8CAA8C;IAC9C,iBAAiB,IAAA;IACjB,yCAAyC;IACzC,SAAS,IAAA;IACT,8BAA8B;IAC9B,YAAY,IAAA;IACZ,iDAAiD;IACjD,aAAa,IAAA;IACb,+CAA+C;IAC/C,mBAAmB,KAAA;IACnB,gDAAgD;IAChD,cAAc,KAAA;IACd,8BAA8B;IAC9B,eAAe,KAAA;IACf,mCAAmC;IACnC,IAAI,KAAA;CACL;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAC5B,kDAAkD;IAClD,OAAO,CAAC,KAAK,CAAc;IAE3B,oDAAoD;IACpD,OAAO,CAAC,cAAc,CAAiB;IAEvC,wDAAwD;IACxD,OAAO,CAAC,UAAU,CAA6B;IAC/C,mCAAmC;IACnC,OAAO,CAAC,gBAAgB,CAAiC;IACzD,2CAA2C;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;IAE1C;;;;OAIG;gBACS,IAAI,EAAE,YAAY;IAsB9B;;OAEG;IACH,IAAI,aAAa,mBAEhB;IAED;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc;IAepC;;OAEG;IACH,mBAAmB,CAAC,eAAe,EAAE,MAAM;IAK3C;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAa5B;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIrE;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAsB5B"}
@@ -1,4 +1,5 @@
1
1
  import { AcDbSystemVariables, AcDbSysVarManager } from '@mlightcad/data-model';
2
+ import { cursorColorForBackground, MODEL_SPACE_BACKGROUND } from '../global/AcEdUiColor';
2
3
  /**
3
4
  * Enumeration of cursor types available in the CAD editor.
4
5
  *
@@ -70,24 +71,19 @@ var AcEdCursorManager = /** @class */ (function () {
70
71
  function AcEdCursorManager(view) {
71
72
  var _this = this;
72
73
  /** The current background color */
73
- this._backgroundColor = 0;
74
+ this._backgroundColor = MODEL_SPACE_BACKGROUND;
74
75
  /** Total length of the cursor crosshair */
75
76
  this._totalLength = 20;
76
77
  this._view = view;
77
78
  this._cursorMap = new Map();
78
- this.setCursorColor(this._backgroundColor === 0 ? 'white' : 'black');
79
+ this.setCursorColor(cursorColorForBackground(this._backgroundColor));
79
80
  AcDbSysVarManager.instance().events.sysVarChanged.addEventListener(function (args) {
80
81
  if (args.name === AcDbSystemVariables.PICKBOX.toLowerCase()) {
81
82
  var size = args.newVal;
82
83
  size = size >= 0 ? size : 0;
83
- _this._cursorMap.set(AcEdCorsorType.Crosshair, _this.createRectCrossIcon(size, _this._totalLength - size, _this._backgroundColor === 0 ? 'white' : 'black'));
84
+ _this._cursorMap.set(AcEdCorsorType.Crosshair, _this.createRectCrossIcon(size, _this._totalLength - size, cursorColorForBackground(_this._backgroundColor)));
84
85
  _this.setCursor(_this._currentCursor);
85
86
  }
86
- else if (args.name === AcDbSystemVariables.WHITEBKCOLOR.toLowerCase()) {
87
- var useWhiteBackgroundColor = args.newVal;
88
- _this._backgroundColor = useWhiteBackgroundColor ? 0xffffff : 0;
89
- _this.setCursorColor(_this._backgroundColor === 0 ? 'white' : 'black');
90
- }
91
87
  });
92
88
  this.setCursor(AcEdCorsorType.Crosshair);
93
89
  }
@@ -122,6 +118,13 @@ var AcEdCursorManager = /** @class */ (function () {
122
118
  }
123
119
  this._currentCursor = cursorType;
124
120
  };
121
+ /**
122
+ * Syncs crosshair colour with the canvas background set by the view.
123
+ */
124
+ AcEdCursorManager.prototype.syncBackgroundColor = function (backgroundColor) {
125
+ this._backgroundColor = backgroundColor;
126
+ this.setCursorColor(cursorColorForBackground(backgroundColor));
127
+ };
125
128
  /**
126
129
  * Sets the cursor color for the crosshair cursor
127
130
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAI9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,cA+BX;AA/BD,WAAY,cAAc;IACxB,+CAA+C;IAC/C,0EAAoB,CAAA;IACpB,mDAAmD;IACnD,6DAAa,CAAA;IACb,0CAA0C;IAC1C,+DAAU,CAAA;IACV,6CAA6C;IAC7C,+DAAU,CAAA;IACV,yBAAyB;IACzB,+DAAU,CAAA;IACV,4CAA4C;IAC5C,6DAAS,CAAA;IACT,+BAA+B;IAC/B,2EAAgB,CAAA;IAChB,8CAA8C;IAC9C,6EAAiB,CAAA;IACjB,yCAAyC;IACzC,6DAAS,CAAA;IACT,8BAA8B;IAC9B,mEAAY,CAAA;IACZ,iDAAiD;IACjD,qEAAa,CAAA;IACb,+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AU,yBAAa,SAAS,gDAClI,QAAQ,GAAG,UAAU,qBAAS,UAAU,qBAAS,QAAQ,GAAG,UAAU,yBAAa,SAAS,8BAElH,CAAA;QACD,OAAO,IAAI,CAAC,iBAAiB,CAC3B,GAAG,EACH,QAAQ,GAAG,UAAU,EACrB,QAAQ,GAAG,UAAU,CACtB,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AA7ID,IA6IC"}
1
+ {"version":3,"file":"AcEdCursorManager.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdCursorManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAE9E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,uBAAuB,CAAA;AAG9B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,cA+BX;AA/BD,WAAY,cAAc;IACxB,+CAA+C;IAC/C,0EAAoB,CAAA;IACpB,mDAAmD;IACnD,6DAAa,CAAA;IACb,0CAA0C;IAC1C,+DAAU,CAAA;IACV,6CAA6C;IAC7C,+DAAU,CAAA;IACV,yBAAyB;IACzB,+DAAU,CAAA;IACV,4CAA4C;IAC5C,6DAAS,CAAA;IACT,+BAA+B;IAC/B,2EAAgB,CAAA;IAChB,8CAA8C;IAC9C,6EAAiB,CAAA;IACjB,yCAAyC;IACzC,6DAAS,CAAA;IACT,8BAA8B;IAC9B,mEAAY,CAAA;IACZ,iDAAiD;IACjD,qEAAa,CAAA;IACb,+CAA+C;IAC/C,kFAAmB,CAAA;IACnB,gDAAgD;IAChD,wEAAc,CAAA;IACd,8BAA8B;IAC9B,0EAAe,CAAA;IACf,mCAAmC;IACnC,oDAAI,CAAA;AACN,CAAC,EA/BW,cAAc,KAAd,cAAc,QA+BzB;AAED;;;;;;;;;GASG;AACH;IAcE;;;;OAIG;IACH,2BAAY,IAAkB;QAA9B,iBAoBC;QA9BD,mCAAmC;QAC3B,qBAA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IACK,+CAAmB,GAA3B,UACE,QAAgB,EAChB,UAAkB,EAClB,SAA2B;QAA3B,0BAAA,EAAA,mBAA2B;QAE3B,IAAM,QAAQ,GAAG,QAAQ,GAAG,CAAC,CAAA;QAC7B,IAAM,OAAO,GAAG,QAAQ,GAAG,CAAC,GAAG,UAAU,CAAA;QACzC,IAAM,GAAG,GAAG,oEACuC,OAAO,yBAAa,OAAO,8BAAkB,OAAO,cAAI,OAAO,oCACnG,UAAU,oBAAQ,UAAU,wBAAY,QAAQ,yBAAa,QAAQ,uCAAyB,SAAS,uCACtG,QAAQ,GAAG,UAAU,8BAAgB,QAAQ,GAAG,UAAU,qBAAS,UAAU,yBAAa,SAAS,uCACnG,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,iBAAiB,CAC3B,GAAG,EACH,QAAQ,GAAG,UAAU,EACrB,QAAQ,GAAG,UAAU,CACtB,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAjJD,IAiJC"}
@@ -0,0 +1,11 @@
1
+ import { AcDbDatabase, AcGePoint2dLike } from '@mlightcad/data-model';
2
+ /**
3
+ * Returns whether orthogonal cursor locking is enabled for the given database.
4
+ */
5
+ export declare function isOrthoModeEnabled(database?: AcDbDatabase): boolean;
6
+ /**
7
+ * Constrains a point to horizontal or vertical movement relative to a reference
8
+ * point, matching AutoCAD ORTHOMODE behavior.
9
+ */
10
+ export declare function constrainToOrtho(point: AcGePoint2dLike, reference: AcGePoint2dLike): AcGePoint2dLike;
11
+ //# sourceMappingURL=AcEdOrthoMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdOrthoMode.d.ts","sourceRoot":"","sources":["../../../src/editor/input/AcEdOrthoMode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIZ,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,OAAO,CAOnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,eAAe,GACzB,eAAe,CASjB"}
@@ -0,0 +1,22 @@
1
+ import { acdbHostApplicationServices, AcDbSystemVariables, AcDbSysVarManager } from '@mlightcad/data-model';
2
+ /**
3
+ * Returns whether orthogonal cursor locking is enabled for the given database.
4
+ */
5
+ export function isOrthoModeEnabled(database) {
6
+ var db = database !== null && database !== void 0 ? database : acdbHostApplicationServices().workingDatabase;
7
+ var raw = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.ORTHOMODE, db);
8
+ return Number(raw) !== 0;
9
+ }
10
+ /**
11
+ * Constrains a point to horizontal or vertical movement relative to a reference
12
+ * point, matching AutoCAD ORTHOMODE behavior.
13
+ */
14
+ export function constrainToOrtho(point, reference) {
15
+ var dx = point.x - reference.x;
16
+ var dy = point.y - reference.y;
17
+ if (Math.abs(dx) >= Math.abs(dy)) {
18
+ return { x: point.x, y: reference.y };
19
+ }
20
+ return { x: reference.x, y: point.y };
21
+ }
22
+ //# sourceMappingURL=AcEdOrthoMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdOrthoMode.js","sourceRoot":"","sources":["../../../src/editor/input/AcEdOrthoMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,2BAA2B,EAC3B,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,uBAAuB,CAAA;AAE9B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAuB;IACxD,IAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,2BAA2B,EAAE,CAAC,eAAe,CAAA;IACpE,IAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC,MAAM,CAC7C,mBAAmB,CAAC,SAAS,EAC7B,EAAE,CACH,CAAA;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAsB,EACtB,SAA0B;IAE1B,IAAM,EAAE,GAAG,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;IAChC,IAAM,EAAE,GAAG,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;IAEhC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAA;IACvC,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAA;AACvC,CAAC"}