@accelint/map-toolkit 0.6.0 → 1.1.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 (207) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/catalog-info.yaml +7 -6
  3. package/dist/camera/events.js.map +1 -1
  4. package/dist/camera/index.d.ts +2 -2
  5. package/dist/camera/index.js +2 -2
  6. package/dist/camera/store.d.ts +120 -0
  7. package/dist/camera/store.js +279 -0
  8. package/dist/camera/store.js.map +1 -0
  9. package/dist/cursor-coordinates/index.d.ts +4 -2
  10. package/dist/cursor-coordinates/index.js +3 -2
  11. package/dist/cursor-coordinates/store.d.ts +48 -0
  12. package/dist/cursor-coordinates/store.js +92 -0
  13. package/dist/cursor-coordinates/store.js.map +1 -0
  14. package/dist/cursor-coordinates/types.d.ts +87 -0
  15. package/dist/cursor-coordinates/types.js +12 -0
  16. package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +41 -37
  17. package/dist/cursor-coordinates/use-cursor-coordinates.js +131 -202
  18. package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
  19. package/dist/deckgl/base-map/constants.d.ts +1 -6
  20. package/dist/deckgl/base-map/constants.js +1 -6
  21. package/dist/deckgl/base-map/constants.js.map +1 -1
  22. package/dist/deckgl/base-map/controls.js +2 -0
  23. package/dist/deckgl/base-map/controls.js.map +1 -1
  24. package/dist/deckgl/base-map/events.js.map +1 -1
  25. package/dist/deckgl/base-map/index.d.ts +2 -2
  26. package/dist/deckgl/base-map/index.js +10 -11
  27. package/dist/deckgl/base-map/index.js.map +1 -1
  28. package/dist/deckgl/base-map/provider.d.ts +2 -2
  29. package/dist/deckgl/base-map/provider.js +1 -1
  30. package/dist/deckgl/base-map/provider.js.map +1 -1
  31. package/dist/deckgl/index.d.ts +4 -4
  32. package/dist/deckgl/index.js +4 -4
  33. package/dist/deckgl/saved-viewports/index.js.map +1 -1
  34. package/dist/deckgl/saved-viewports/storage.js +10 -2
  35. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  36. package/dist/deckgl/shapes/display-shape-layer/constants.js +5 -8
  37. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
  38. package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -1
  39. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +18 -14
  40. package/dist/deckgl/shapes/display-shape-layer/index.js +63 -30
  41. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
  42. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +2 -16
  43. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -1
  44. package/dist/deckgl/shapes/display-shape-layer/store.js +58 -272
  45. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -1
  46. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +22 -11
  47. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.d.ts → use-select-shape.d.ts} +9 -9
  48. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.js → use-select-shape.js} +12 -12
  49. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js.map +1 -0
  50. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +5 -66
  51. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
  52. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +2 -65
  53. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +3 -121
  54. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
  55. package/dist/deckgl/shapes/draw-shape-layer/constants.js +46 -0
  56. package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -0
  57. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +92 -0
  58. package/dist/deckgl/shapes/draw-shape-layer/events.js +56 -0
  59. package/dist/deckgl/shapes/draw-shape-layer/events.js.map +1 -0
  60. package/dist/deckgl/shapes/draw-shape-layer/fiber.d.ts +11 -0
  61. package/dist/{maplibre/constants.js → deckgl/shapes/draw-shape-layer/fiber.js} +6 -12
  62. package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -0
  63. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +53 -0
  64. package/dist/deckgl/shapes/draw-shape-layer/index.js +95 -0
  65. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -0
  66. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +51 -0
  67. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -0
  68. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +73 -0
  69. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -0
  70. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +87 -0
  71. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -0
  72. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +88 -0
  73. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -0
  74. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +77 -0
  75. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -0
  76. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +64 -0
  77. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -0
  78. package/dist/deckgl/shapes/draw-shape-layer/store.js +175 -0
  79. package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -0
  80. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +86 -0
  81. package/dist/{viewport/constants.js → deckgl/shapes/draw-shape-layer/types.js} +1 -12
  82. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +82 -0
  83. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +112 -0
  84. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js.map +1 -0
  85. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +147 -0
  86. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -0
  87. package/dist/deckgl/shapes/edit-shape-layer/constants.js +41 -0
  88. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -0
  89. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +92 -0
  90. package/dist/deckgl/shapes/edit-shape-layer/events.js +56 -0
  91. package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -0
  92. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +13 -0
  93. package/dist/deckgl/shapes/edit-shape-layer/fiber.js +14 -0
  94. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +63 -0
  95. package/dist/deckgl/shapes/edit-shape-layer/index.js +162 -0
  96. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -0
  97. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +154 -0
  98. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -0
  99. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +147 -0
  100. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -0
  101. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +87 -0
  102. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -0
  103. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +61 -0
  104. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -0
  105. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +109 -0
  106. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -0
  107. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +289 -0
  108. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -0
  109. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +121 -0
  110. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -0
  111. package/dist/deckgl/shapes/edit-shape-layer/store.js +194 -0
  112. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -0
  113. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +93 -0
  114. package/dist/deckgl/shapes/edit-shape-layer/types.js +14 -0
  115. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +82 -0
  116. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +114 -0
  117. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -0
  118. package/dist/deckgl/shapes/index.d.ts +15 -6
  119. package/dist/deckgl/shapes/index.js +12 -5
  120. package/dist/deckgl/shapes/shared/constants.d.ts +27 -32
  121. package/dist/deckgl/shapes/shared/constants.js +189 -25
  122. package/dist/deckgl/shapes/shared/constants.js.map +1 -1
  123. package/dist/deckgl/shapes/shared/events.d.ts +1 -20
  124. package/dist/deckgl/shapes/shared/events.js +1 -31
  125. package/dist/deckgl/shapes/shared/events.js.map +1 -1
  126. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +84 -0
  127. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -0
  128. package/dist/deckgl/shapes/shared/types.d.ts +187 -28
  129. package/dist/deckgl/shapes/shared/types.js +55 -1
  130. package/dist/deckgl/shapes/shared/types.js.map +1 -1
  131. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +128 -0
  132. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -0
  133. package/dist/deckgl/shapes/shared/utils/layer-config.js +50 -0
  134. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -0
  135. package/dist/deckgl/shapes/shared/utils/mode-utils.js +113 -0
  136. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -0
  137. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +57 -0
  138. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -0
  139. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +64 -0
  140. package/dist/deckgl/shapes/shared/utils/style-utils.js +101 -0
  141. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -0
  142. package/dist/deckgl/symbol-layer/fiber.js.map +1 -1
  143. package/dist/deckgl/symbol-layer/index.js.map +1 -1
  144. package/dist/deckgl/text-layer/character-sets.js.map +1 -1
  145. package/dist/deckgl/text-layer/default-settings.js +4 -24
  146. package/dist/deckgl/text-layer/default-settings.js.map +1 -1
  147. package/dist/deckgl/text-layer/fiber.js.map +1 -1
  148. package/dist/deckgl/text-layer/index.js.map +1 -1
  149. package/dist/deckgl/text-settings.d.ts +77 -0
  150. package/dist/deckgl/text-settings.js +83 -0
  151. package/dist/deckgl/text-settings.js.map +1 -0
  152. package/dist/map-cursor/events.js.map +1 -1
  153. package/dist/map-cursor/index.d.ts +2 -2
  154. package/dist/map-cursor/index.js +2 -2
  155. package/dist/map-cursor/store.d.ts +32 -61
  156. package/dist/map-cursor/store.js +165 -294
  157. package/dist/map-cursor/store.js.map +1 -1
  158. package/dist/map-cursor/use-map-cursor.d.ts +5 -2
  159. package/dist/map-cursor/use-map-cursor.js +33 -15
  160. package/dist/map-cursor/use-map-cursor.js.map +1 -1
  161. package/dist/map-mode/events.js.map +1 -1
  162. package/dist/map-mode/index.d.ts +2 -2
  163. package/dist/map-mode/index.js +2 -2
  164. package/dist/map-mode/store.d.ts +36 -37
  165. package/dist/map-mode/store.js +131 -237
  166. package/dist/map-mode/store.js.map +1 -1
  167. package/dist/map-mode/use-map-mode.js +6 -5
  168. package/dist/map-mode/use-map-mode.js.map +1 -1
  169. package/dist/maplibre/hooks/use-maplibre.js.map +1 -1
  170. package/dist/maplibre/index.d.ts +2 -2
  171. package/dist/maplibre/index.js +2 -2
  172. package/dist/shared/constants.d.ts +19 -0
  173. package/dist/shared/constants.js +33 -0
  174. package/dist/shared/constants.js.map +1 -0
  175. package/dist/shared/create-map-store.d.ts +202 -0
  176. package/dist/shared/create-map-store.js +223 -0
  177. package/dist/shared/create-map-store.js.map +1 -0
  178. package/dist/shared/units.d.ts +39 -0
  179. package/dist/shared/units.js +49 -0
  180. package/dist/shared/units.js.map +1 -0
  181. package/dist/viewport/index.d.ts +3 -3
  182. package/dist/viewport/index.js +3 -3
  183. package/dist/viewport/store.d.ts +69 -0
  184. package/dist/viewport/store.js +125 -0
  185. package/dist/viewport/store.js.map +1 -0
  186. package/dist/viewport/types.d.ts +2 -2
  187. package/dist/viewport/utils.js +2 -2
  188. package/dist/viewport/utils.js.map +1 -1
  189. package/dist/viewport/viewport-size.d.ts +2 -2
  190. package/dist/viewport/viewport-size.js +2 -2
  191. package/dist/viewport/viewport-size.js.map +1 -1
  192. package/package.json +39 -19
  193. package/dist/camera/use-camera-state.d.ts +0 -153
  194. package/dist/camera/use-camera-state.js +0 -418
  195. package/dist/camera/use-camera-state.js.map +0 -1
  196. package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +0 -44
  197. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +0 -66
  198. package/dist/deckgl/shapes/display-shape-layer/store.d.ts +0 -87
  199. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +0 -1
  200. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +0 -61
  201. package/dist/maplibre/constants.d.ts +0 -13
  202. package/dist/maplibre/constants.js.map +0 -1
  203. package/dist/viewport/constants.d.ts +0 -11
  204. package/dist/viewport/constants.js.map +0 -1
  205. package/dist/viewport/use-viewport-state.d.ts +0 -100
  206. package/dist/viewport/use-viewport-state.js +0 -222
  207. package/dist/viewport/use-viewport-state.js.map +0 -1
@@ -13,6 +13,8 @@
13
13
 
14
14
  'use client';
15
15
 
16
+ import { DEFAULT_TEXT_STYLE } from "../../text-settings.js";
17
+
16
18
  //#region src/deckgl/shapes/shared/constants.ts
17
19
  /**
18
20
  * Layer IDs for shape layers
@@ -23,31 +25,27 @@ const SHAPE_LAYER_IDS = {
23
25
  DISPLAY_LABELS: "DISPLAY_SHAPES::Labels"
24
26
  };
25
27
  /**
26
- * Base fill opacity multiplier (60%) for standard semi-transparent look
28
+ * Base fill opacity multiplier for standard semi-transparent look.
29
+ * Multiplies alpha by 0.2 (reduces to 20% of original opacity).
27
30
  */
28
31
  const BASE_FILL_OPACITY = .2;
29
32
  /**
30
- * Default stroke width in pixels when not specified in styleProperties
33
+ * Default border/outline width in pixels when not specified in styleProperties
31
34
  */
32
- const DEFAULT_STROKE_WIDTH = 2;
35
+ const DEFAULT_LINE_WIDTH = 2;
33
36
  /**
34
- * Additional pixels added to stroke width on hover
37
+ * Additional pixels added to border/outline width on hover
35
38
  */
36
39
  const HOVER_WIDTH_INCREASE = 2;
37
40
  /**
38
- * Additional pixels added to stroke width for selection highlight
41
+ * Additional pixels added to border/outline width for selection highlight
39
42
  */
40
43
  const HIGHLIGHT_WIDTH_INCREASE = 5;
41
44
  /**
42
- * Fixed opacity for label background (0-255)
43
- */
44
- const LABEL_BACKGROUND_OPACITY = 200;
45
- /**
46
- * Fixed opacity for label border (0-255)
47
- */
48
- const LABEL_BORDER_OPACITY = 255;
49
- /**
50
- * Default colors as RGBA arrays for DeckGL layers
45
+ * Default colors as RGBA arrays for DeckGL layers.
46
+ *
47
+ * These are the canonical color values used throughout the shapes system.
48
+ * All other color constants should derive from these to maintain consistency.
51
49
  */
52
50
  const DEFAULT_COLORS = {
53
51
  fill: [
@@ -56,7 +54,7 @@ const DEFAULT_COLORS = {
56
54
  255,
57
55
  255
58
56
  ],
59
- stroke: [
57
+ line: [
60
58
  136,
61
59
  138,
62
60
  143,
@@ -70,40 +68,206 @@ const DEFAULT_COLORS = {
70
68
  ]
71
69
  };
72
70
  /**
73
- * Default style properties for new shapes
71
+ * Tentative (during-drawing) colors.
72
+ *
73
+ * These colors are used for the shape preview while drawing.
74
+ * Fill is semi-transparent (8% opacity) to not obscure underlying features.
75
+ * Border/outline uses the same color as saved shapes for consistency.
76
+ */
77
+ const DEFAULT_TENTATIVE_COLORS = {
78
+ fill: [
79
+ 255,
80
+ 255,
81
+ 255,
82
+ 20
83
+ ],
84
+ line: DEFAULT_COLORS.line
85
+ };
86
+ /**
87
+ * Default style properties for saved shapes.
88
+ *
89
+ * These are applied when a shape is completed/saved.
90
+ * Can be overridden via styleDefaults in draw options.
74
91
  */
75
92
  const DEFAULT_STYLE_PROPERTIES = {
76
93
  fillColor: DEFAULT_COLORS.fill,
77
- strokeColor: DEFAULT_COLORS.stroke,
78
- strokeWidth: 2,
79
- strokePattern: "solid"
94
+ lineColor: DEFAULT_COLORS.line,
95
+ lineWidth: 2,
96
+ linePattern: "solid"
80
97
  };
81
98
  /**
82
- * Stroke width options
99
+ * Border/outline width options (in pixels)
83
100
  */
84
- const STROKE_WIDTHS = [
101
+ const LINE_WIDTHS = [
85
102
  1,
86
103
  2,
87
104
  4,
88
105
  8
89
106
  ];
90
107
  /**
91
- * Stroke pattern options
108
+ * Border/outline pattern options
92
109
  */
93
- const STROKE_PATTERNS = [
110
+ const LINE_PATTERNS = [
94
111
  "solid",
95
112
  "dashed",
96
113
  "dotted"
97
114
  ];
98
115
  /**
99
- * Dash array patterns for stroke rendering
116
+ * Dash array patterns for border/outline rendering
100
117
  */
101
118
  const DASH_ARRAYS = {
102
119
  solid: null,
103
120
  dashed: [8, 4],
104
121
  dotted: [2, 4]
105
122
  };
123
+ /**
124
+ * Default edit handle color (white) - used by both draw and edit layers
125
+ */
126
+ const DEFAULT_EDIT_HANDLE_COLOR = [
127
+ 255,
128
+ 255,
129
+ 255,
130
+ 255
131
+ ];
132
+ /**
133
+ * Edit handle outline color (dark for contrast)
134
+ */
135
+ const DEFAULT_EDIT_HANDLE_OUTLINE_COLOR = [
136
+ 0,
137
+ 0,
138
+ 0,
139
+ 200
140
+ ];
141
+ /**
142
+ * Empty feature collection for initializing editable layers
143
+ */
144
+ const EMPTY_FEATURE_COLLECTION = {
145
+ type: "FeatureCollection",
146
+ features: []
147
+ };
148
+ /**
149
+ * Custom character set for deck.gl TextLayer used by tooltip rendering.
150
+ *
151
+ * deck.gl's TextLayer uses SDF (Signed Distance Field) font rendering which
152
+ * by default only supports basic ASCII characters (32-128). Special characters
153
+ * like degree symbol (°) and superscript 2 (²) must be explicitly included
154
+ * for tooltip text like "100.5 km²" to render correctly.
155
+ */
156
+ const TOOLTIP_CHARACTER_SET = ["°", "²"];
157
+ for (let i = 32; i <= 128; i++) TOOLTIP_CHARACTER_SET.push(String.fromCharCode(i));
158
+ /**
159
+ * Sublayer props for tooltip text rendering.
160
+ * Used by both draw-shape-layer and edit-shape-layer for area/distance tooltips.
161
+ */
162
+ const TOOLTIP_SUBLAYER_PROPS = { tooltips: {
163
+ ...DEFAULT_TEXT_STYLE,
164
+ fontFamily: "Roboto MonoVariable, monospace",
165
+ characterSet: TOOLTIP_CHARACTER_SET,
166
+ getTextAnchor: "start",
167
+ getAlignmentBaseline: "bottom",
168
+ getPixelOffset: [8, 0]
169
+ } };
170
+ /**
171
+ * Shared edit handle sublayer props for EditableGeoJsonLayer.
172
+ * Used by both draw-shape-layer and edit-shape-layer.
173
+ */
174
+ const EDIT_HANDLE_SUBLAYER_PROPS = {
175
+ editHandlePointOutline: {
176
+ getFillColor: DEFAULT_EDIT_HANDLE_COLOR,
177
+ getRadius: 6
178
+ },
179
+ editHandlePoint: {
180
+ getFillColor: DEFAULT_EDIT_HANDLE_COLOR,
181
+ getRadius: 4
182
+ }
183
+ };
184
+ /**
185
+ * Combined sublayer props for EditableGeoJsonLayer with tooltips and edit handles.
186
+ * Used by both draw-shape-layer and edit-shape-layer.
187
+ */
188
+ const EDITABLE_LAYER_SUBLAYER_PROPS = {
189
+ ...TOOLTIP_SUBLAYER_PROPS,
190
+ ...EDIT_HANDLE_SUBLAYER_PROPS
191
+ };
192
+ /**
193
+ * Format a distance value for tooltip display.
194
+ * Used by draw and edit mode tooltips for consistent formatting.
195
+ *
196
+ * @param value - The distance value to format
197
+ * @returns The formatted string with 2 decimal places
198
+ */
199
+ function formatDistance(value) {
200
+ return value.toFixed(2);
201
+ }
202
+ /**
203
+ * Format circle tooltip text showing diameter and area.
204
+ *
205
+ * @param diameter - Circle diameter in the specified units
206
+ * @param area - Circle area in the specified units squared
207
+ * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')
208
+ * @returns Formatted tooltip text: "d: {diameter} {unit}\n{area} {unit}²"
209
+ */
210
+ function formatCircleTooltip(diameter, area, unitAbbrev) {
211
+ return `d: ${formatDistance(diameter)} ${unitAbbrev}\n${formatDistance(area)} ${unitAbbrev}²`;
212
+ }
213
+ /**
214
+ * Format rectangle tooltip text showing dimensions and area.
215
+ *
216
+ * @param width - Rectangle width in the specified units
217
+ * @param height - Rectangle height in the specified units
218
+ * @param area - Rectangle area in the specified units squared
219
+ * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')
220
+ * @returns Formatted tooltip text: "{width} {unit} x {height} {unit}\n{area} {unit}²"
221
+ */
222
+ function formatRectangleTooltip(width, height, area, unitAbbrev) {
223
+ return `${formatDistance(width)} ${unitAbbrev} x ${formatDistance(height)} ${unitAbbrev}\n${formatDistance(area)} ${unitAbbrev}²`;
224
+ }
225
+ /**
226
+ * Format ellipse tooltip text showing axes and area.
227
+ *
228
+ * @param majorAxis - Ellipse major axis (full length) in the specified units
229
+ * @param minorAxis - Ellipse minor axis (full length) in the specified units
230
+ * @param area - Ellipse area in the specified units squared
231
+ * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')
232
+ * @returns Formatted tooltip text: "{major} {unit} x {minor} {unit}\n{area} {unit}²"
233
+ */
234
+ function formatEllipseTooltip(majorAxis, minorAxis, area, unitAbbrev) {
235
+ return `${formatDistance(majorAxis)} ${unitAbbrev} x ${formatDistance(minorAxis)} ${unitAbbrev}\n${formatDistance(area)} ${unitAbbrev}²`;
236
+ }
237
+ /**
238
+ * Format simple distance tooltip text.
239
+ *
240
+ * @param distance - Distance value in the specified units
241
+ * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')
242
+ * @returns Formatted tooltip text: "{distance} {unit}"
243
+ */
244
+ function formatDistanceTooltip(distance, unitAbbrev) {
245
+ return `${formatDistance(distance)} ${unitAbbrev}`;
246
+ }
247
+ /**
248
+ * Continuous edit event types that fire during dragging.
249
+ * These are emitted repeatedly while the user drags during an edit operation.
250
+ */
251
+ const CONTINUOUS_EDIT_TYPES = new Set([
252
+ "movePosition",
253
+ "unionGeometry",
254
+ "scaling",
255
+ "rotating",
256
+ "translating"
257
+ ]);
258
+ /**
259
+ * Completion edit event types that fire when dragging ends.
260
+ * These are emitted once when the user finishes an edit action.
261
+ */
262
+ const COMPLETION_EDIT_TYPES = new Set([
263
+ "finishMovePosition",
264
+ "addPosition",
265
+ "removePosition",
266
+ "scaled",
267
+ "rotated",
268
+ "translated"
269
+ ]);
106
270
 
107
271
  //#endregion
108
- export { BASE_FILL_OPACITY, DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STROKE_WIDTH, DEFAULT_STYLE_PROPERTIES, HIGHLIGHT_WIDTH_INCREASE, HOVER_WIDTH_INCREASE, LABEL_BACKGROUND_OPACITY, LABEL_BORDER_OPACITY, SHAPE_LAYER_IDS, STROKE_PATTERNS, STROKE_WIDTHS };
272
+ export { BASE_FILL_OPACITY, COMPLETION_EDIT_TYPES, CONTINUOUS_EDIT_TYPES, DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_EDIT_HANDLE_COLOR, DEFAULT_EDIT_HANDLE_OUTLINE_COLOR, DEFAULT_LINE_WIDTH, DEFAULT_STYLE_PROPERTIES, DEFAULT_TENTATIVE_COLORS, EDITABLE_LAYER_SUBLAYER_PROPS, EMPTY_FEATURE_COLLECTION, HIGHLIGHT_WIDTH_INCREASE, HOVER_WIDTH_INCREASE, LINE_PATTERNS, LINE_WIDTHS, SHAPE_LAYER_IDS, formatCircleTooltip, formatDistanceTooltip, formatEllipseTooltip, formatRectangleTooltip };
109
273
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["DEFAULT_STYLE_PROPERTIES: StyleProperties","DASH_ARRAYS: Record<\n 'solid' | 'dashed' | 'dotted',\n [number, number] | null\n>"],"sources":["../../../../src/deckgl/shapes/shared/constants.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport type { Color } from '@deck.gl/core';\nimport type { StyleProperties } from './types';\n\n/**\n * Layer IDs for shape layers\n */\nexport const SHAPE_LAYER_IDS = {\n DISPLAY: 'DISPLAY_SHAPES',\n DISPLAY_HIGHLIGHT: 'DISPLAY_SHAPES::Highlight',\n DISPLAY_LABELS: 'DISPLAY_SHAPES::Labels',\n} as const;\n\n/**\n * Base fill opacity multiplier (60%) for standard semi-transparent look\n */\nexport const BASE_FILL_OPACITY = 0.2;\n\n/**\n * Default stroke width in pixels when not specified in styleProperties\n */\nexport const DEFAULT_STROKE_WIDTH = 2;\n\n/**\n * Additional pixels added to stroke width on hover\n */\nexport const HOVER_WIDTH_INCREASE = 2;\n\n/**\n * Additional pixels added to stroke width for selection highlight\n */\nexport const HIGHLIGHT_WIDTH_INCREASE = 5;\n\n/**\n * Fixed opacity for label background (0-255)\n */\nexport const LABEL_BACKGROUND_OPACITY = 200;\n\n/**\n * Fixed opacity for label border (0-255)\n */\nexport const LABEL_BORDER_OPACITY = 255;\n\n/**\n * Default colors as RGBA arrays for DeckGL layers\n */\nexport const DEFAULT_COLORS = {\n /** Default fill color (background-surface-muted gray at full alpha) */\n fill: [255, 255, 255, 255] as Color,\n /** Default stroke color (outline-interactive-hover gray at full alpha) */\n stroke: [136, 138, 143, 255] as Color,\n /** Highlight/selection color (turquoise at ~39% alpha) */\n highlight: [40, 245, 190, 100] as Color,\n} as const;\n\n/**\n * Default style properties for new shapes\n */\nexport const DEFAULT_STYLE_PROPERTIES: StyleProperties = {\n fillColor: DEFAULT_COLORS.fill,\n strokeColor: DEFAULT_COLORS.stroke,\n strokeWidth: 2,\n strokePattern: 'solid',\n};\n\n/**\n * Stroke width options\n */\nexport const STROKE_WIDTHS = [1, 2, 4, 8] as const;\n\n/**\n * Stroke pattern options\n */\nexport const STROKE_PATTERNS = ['solid', 'dashed', 'dotted'] as const;\n\n/**\n * Dash array patterns for stroke rendering\n */\nexport const DASH_ARRAYS: Record<\n 'solid' | 'dashed' | 'dotted',\n [number, number] | null\n> = {\n solid: null,\n dashed: [8, 4],\n dotted: [2, 4],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAa,kBAAkB;CAC7B,SAAS;CACT,mBAAmB;CACnB,gBAAgB;CACjB;;;;AAKD,MAAa,oBAAoB;;;;AAKjC,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,2BAA2B;;;;AAKxC,MAAa,2BAA2B;;;;AAKxC,MAAa,uBAAuB;;;;AAKpC,MAAa,iBAAiB;CAE5B,MAAM;EAAC;EAAK;EAAK;EAAK;EAAI;CAE1B,QAAQ;EAAC;EAAK;EAAK;EAAK;EAAI;CAE5B,WAAW;EAAC;EAAI;EAAK;EAAK;EAAI;CAC/B;;;;AAKD,MAAaA,2BAA4C;CACvD,WAAW,eAAe;CAC1B,aAAa,eAAe;CAC5B,aAAa;CACb,eAAe;CAChB;;;;AAKD,MAAa,gBAAgB;CAAC;CAAG;CAAG;CAAG;CAAE;;;;AAKzC,MAAa,kBAAkB;CAAC;CAAS;CAAU;CAAS;;;;AAK5D,MAAaC,cAGT;CACF,OAAO;CACP,QAAQ,CAAC,GAAG,EAAE;CACd,QAAQ,CAAC,GAAG,EAAE;CACf"}
1
+ {"version":3,"file":"constants.js","names":["DEFAULT_STYLE_PROPERTIES: StyleProperties","DASH_ARRAYS: Record<\n 'solid' | 'dashed' | 'dotted',\n [number, number] | null\n>","DEFAULT_EDIT_HANDLE_COLOR: Color","DEFAULT_EDIT_HANDLE_OUTLINE_COLOR: Color","EMPTY_FEATURE_COLLECTION: import('geojson').FeatureCollection","TOOLTIP_CHARACTER_SET: string[]"],"sources":["../../../../src/deckgl/shapes/shared/constants.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport { DEFAULT_TEXT_STYLE } from '../../text-settings';\nimport type { Color } from '@deck.gl/core';\nimport type { StyleProperties } from './types';\n\n/**\n * Layer IDs for shape layers\n */\nexport const SHAPE_LAYER_IDS = {\n DISPLAY: 'DISPLAY_SHAPES',\n DISPLAY_HIGHLIGHT: 'DISPLAY_SHAPES::Highlight',\n DISPLAY_LABELS: 'DISPLAY_SHAPES::Labels',\n} as const;\n\n/**\n * Base fill opacity multiplier for standard semi-transparent look.\n * Multiplies alpha by 0.2 (reduces to 20% of original opacity).\n */\nexport const BASE_FILL_OPACITY = 0.2;\n\n/**\n * Default border/outline width in pixels when not specified in styleProperties\n */\nexport const DEFAULT_LINE_WIDTH = 2;\n\n/**\n * Additional pixels added to border/outline width on hover\n */\nexport const HOVER_WIDTH_INCREASE = 2;\n\n/**\n * Additional pixels added to border/outline width for selection highlight\n */\nexport const HIGHLIGHT_WIDTH_INCREASE = 5;\n\n/**\n * Fixed opacity for label background (0-255)\n */\nexport const LABEL_BACKGROUND_OPACITY = 200;\n\n/**\n * Fixed opacity for label border (0-255)\n */\nexport const LABEL_BORDER_OPACITY = 255;\n\n/**\n * Default colors as RGBA arrays for DeckGL layers.\n *\n * These are the canonical color values used throughout the shapes system.\n * All other color constants should derive from these to maintain consistency.\n */\nexport const DEFAULT_COLORS = {\n /** Default fill color (white at full alpha) */\n fill: [255, 255, 255, 255] as Color,\n /** Default border/outline color (outline-interactive-hover: #888a8f) */\n line: [136, 138, 143, 255] as Color,\n /** Highlight/selection color (turquoise at ~39% alpha) */\n highlight: [40, 245, 190, 100] as Color,\n} as const;\n\n/**\n * Tentative (during-drawing) colors.\n *\n * These colors are used for the shape preview while drawing.\n * Fill is semi-transparent (8% opacity) to not obscure underlying features.\n * Border/outline uses the same color as saved shapes for consistency.\n */\nexport const DEFAULT_TENTATIVE_COLORS = {\n /** Tentative fill color (white at 8% opacity: 0.08 * 255 ≈ 20) */\n fill: [255, 255, 255, 20] as Color,\n /** Tentative border/outline color (same as saved shapes for consistency) */\n line: DEFAULT_COLORS.line,\n} as const;\n\n/**\n * Default style properties for saved shapes.\n *\n * These are applied when a shape is completed/saved.\n * Can be overridden via styleDefaults in draw options.\n */\nexport const DEFAULT_STYLE_PROPERTIES: StyleProperties = {\n fillColor: DEFAULT_COLORS.fill,\n lineColor: DEFAULT_COLORS.line,\n lineWidth: 2,\n linePattern: 'solid',\n};\n\n/**\n * Border/outline width options (in pixels)\n */\nexport const LINE_WIDTHS = [1, 2, 4, 8] as const;\n\n/**\n * Border/outline pattern options\n */\nexport const LINE_PATTERNS = ['solid', 'dashed', 'dotted'] as const;\n\n/**\n * Dash array patterns for border/outline rendering\n */\nexport const DASH_ARRAYS: Record<\n 'solid' | 'dashed' | 'dotted',\n [number, number] | null\n> = {\n solid: null,\n dashed: [8, 4],\n dotted: [2, 4],\n};\n\n/**\n * Default tentative fill color (white at 8% opacity - rgba(255, 255, 255, 0.08))\n * Used when drawing new shapes before they're completed.\n * 0.08 * 255 ≈ 20\n */\nexport const DEFAULT_TENTATIVE_FILL_COLOR: Color = [255, 255, 255, 20];\n\n/**\n * Default tentative border/outline color (outline-interactive-hover: #888a8f)\n * Used when drawing new shapes before they're completed.\n */\nexport const DEFAULT_TENTATIVE_LINE_COLOR: Color = [136, 138, 143, 255];\n\n/**\n * Default edit handle color (white) - used by both draw and edit layers\n */\nexport const DEFAULT_EDIT_HANDLE_COLOR: Color = [255, 255, 255, 255];\n\n/**\n * Edit handle outline color (dark for contrast)\n */\nexport const DEFAULT_EDIT_HANDLE_OUTLINE_COLOR: Color = [0, 0, 0, 200];\n\n/**\n * Empty feature collection for initializing editable layers\n */\nexport const EMPTY_FEATURE_COLLECTION: import('geojson').FeatureCollection = {\n type: 'FeatureCollection',\n features: [],\n};\n\n/**\n * Custom character set for deck.gl TextLayer used by tooltip rendering.\n *\n * deck.gl's TextLayer uses SDF (Signed Distance Field) font rendering which\n * by default only supports basic ASCII characters (32-128). Special characters\n * like degree symbol (°) and superscript 2 (²) must be explicitly included\n * for tooltip text like \"100.5 km²\" to render correctly.\n */\nexport const TOOLTIP_CHARACTER_SET: string[] = ['°', '²'];\n\n// Add standard ASCII characters (space through tilde + DEL)\nfor (let i = 32; i <= 128; i++) {\n TOOLTIP_CHARACTER_SET.push(String.fromCharCode(i));\n}\n\n/**\n * Sublayer props for tooltip text rendering.\n * Used by both draw-shape-layer and edit-shape-layer for area/distance tooltips.\n */\nexport const TOOLTIP_SUBLAYER_PROPS = {\n tooltips: {\n ...DEFAULT_TEXT_STYLE,\n fontFamily: 'Roboto MonoVariable, monospace',\n characterSet: TOOLTIP_CHARACTER_SET,\n getTextAnchor: 'start',\n getAlignmentBaseline: 'bottom',\n getPixelOffset: [8, 0],\n },\n};\n\n/**\n * Shared edit handle sublayer props for EditableGeoJsonLayer.\n * Used by both draw-shape-layer and edit-shape-layer.\n */\nexport const EDIT_HANDLE_SUBLAYER_PROPS = {\n editHandlePointOutline: {\n getFillColor: DEFAULT_EDIT_HANDLE_COLOR,\n getRadius: 6,\n },\n editHandlePoint: {\n getFillColor: DEFAULT_EDIT_HANDLE_COLOR,\n getRadius: 4,\n },\n};\n\n/**\n * Combined sublayer props for EditableGeoJsonLayer with tooltips and edit handles.\n * Used by both draw-shape-layer and edit-shape-layer.\n */\nexport const EDITABLE_LAYER_SUBLAYER_PROPS = {\n ...TOOLTIP_SUBLAYER_PROPS,\n ...EDIT_HANDLE_SUBLAYER_PROPS,\n};\n\n/**\n * Format a distance value for tooltip display.\n * Used by draw and edit mode tooltips for consistent formatting.\n *\n * @param value - The distance value to format\n * @returns The formatted string with 2 decimal places\n */\nexport function formatDistance(value: number): string {\n return value.toFixed(2);\n}\n\n// =============================================================================\n// Tooltip Text Formatters\n// =============================================================================\n// These functions generate consistent tooltip text for both draw and edit modes.\n\n/**\n * Format circle tooltip text showing diameter and area.\n *\n * @param diameter - Circle diameter in the specified units\n * @param area - Circle area in the specified units squared\n * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')\n * @returns Formatted tooltip text: \"d: {diameter} {unit}\\n{area} {unit}²\"\n */\nexport function formatCircleTooltip(\n diameter: number,\n area: number,\n unitAbbrev: string,\n): string {\n return `d: ${formatDistance(diameter)} ${unitAbbrev}\\n${formatDistance(area)} ${unitAbbrev}²`;\n}\n\n/**\n * Format rectangle tooltip text showing dimensions and area.\n *\n * @param width - Rectangle width in the specified units\n * @param height - Rectangle height in the specified units\n * @param area - Rectangle area in the specified units squared\n * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')\n * @returns Formatted tooltip text: \"{width} {unit} x {height} {unit}\\n{area} {unit}²\"\n */\nexport function formatRectangleTooltip(\n width: number,\n height: number,\n area: number,\n unitAbbrev: string,\n): string {\n return `${formatDistance(width)} ${unitAbbrev} x ${formatDistance(height)} ${unitAbbrev}\\n${formatDistance(area)} ${unitAbbrev}²`;\n}\n\n/**\n * Format ellipse tooltip text showing axes and area.\n *\n * @param majorAxis - Ellipse major axis (full length) in the specified units\n * @param minorAxis - Ellipse minor axis (full length) in the specified units\n * @param area - Ellipse area in the specified units squared\n * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')\n * @returns Formatted tooltip text: \"{major} {unit} x {minor} {unit}\\n{area} {unit}²\"\n */\nexport function formatEllipseTooltip(\n majorAxis: number,\n minorAxis: number,\n area: number,\n unitAbbrev: string,\n): string {\n return `${formatDistance(majorAxis)} ${unitAbbrev} x ${formatDistance(minorAxis)} ${unitAbbrev}\\n${formatDistance(area)} ${unitAbbrev}²`;\n}\n\n/**\n * Format simple distance tooltip text.\n *\n * @param distance - Distance value in the specified units\n * @param unitAbbrev - Unit abbreviation (e.g., 'km', 'mi')\n * @returns Formatted tooltip text: \"{distance} {unit}\"\n */\nexport function formatDistanceTooltip(\n distance: number,\n unitAbbrev: string,\n): string {\n return `${formatDistance(distance)} ${unitAbbrev}`;\n}\n\n// =============================================================================\n// Edit Event Type Classification\n// =============================================================================\n\n/**\n * Continuous edit event types that fire during dragging.\n * These are emitted repeatedly while the user drags during an edit operation.\n */\nexport const CONTINUOUS_EDIT_TYPES = new Set([\n 'movePosition',\n 'unionGeometry',\n 'scaling',\n 'rotating',\n 'translating',\n]);\n\n/**\n * Completion edit event types that fire when dragging ends.\n * These are emitted once when the user finishes an edit action.\n */\nexport const COMPLETION_EDIT_TYPES = new Set([\n 'finishMovePosition',\n 'addPosition',\n 'removePosition',\n 'scaled',\n 'rotated',\n 'translated',\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB;CAC7B,SAAS;CACT,mBAAmB;CACnB,gBAAgB;CACjB;;;;;AAMD,MAAa,oBAAoB;;;;AAKjC,MAAa,qBAAqB;;;;AAKlC,MAAa,uBAAuB;;;;AAKpC,MAAa,2BAA2B;;;;;;;AAkBxC,MAAa,iBAAiB;CAE5B,MAAM;EAAC;EAAK;EAAK;EAAK;EAAI;CAE1B,MAAM;EAAC;EAAK;EAAK;EAAK;EAAI;CAE1B,WAAW;EAAC;EAAI;EAAK;EAAK;EAAI;CAC/B;;;;;;;;AASD,MAAa,2BAA2B;CAEtC,MAAM;EAAC;EAAK;EAAK;EAAK;EAAG;CAEzB,MAAM,eAAe;CACtB;;;;;;;AAQD,MAAaA,2BAA4C;CACvD,WAAW,eAAe;CAC1B,WAAW,eAAe;CAC1B,WAAW;CACX,aAAa;CACd;;;;AAKD,MAAa,cAAc;CAAC;CAAG;CAAG;CAAG;CAAE;;;;AAKvC,MAAa,gBAAgB;CAAC;CAAS;CAAU;CAAS;;;;AAK1D,MAAaC,cAGT;CACF,OAAO;CACP,QAAQ,CAAC,GAAG,EAAE;CACd,QAAQ,CAAC,GAAG,EAAE;CACf;;;;AAkBD,MAAaC,4BAAmC;CAAC;CAAK;CAAK;CAAK;CAAI;;;;AAKpE,MAAaC,oCAA2C;CAAC;CAAG;CAAG;CAAG;CAAI;;;;AAKtE,MAAaC,2BAAgE;CAC3E,MAAM;CACN,UAAU,EAAE;CACb;;;;;;;;;AAUD,MAAaC,wBAAkC,CAAC,KAAK,IAAI;AAGzD,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,IACzB,uBAAsB,KAAK,OAAO,aAAa,EAAE,CAAC;;;;;AAOpD,MAAa,yBAAyB,EACpC,UAAU;CACR,GAAG;CACH,YAAY;CACZ,cAAc;CACd,eAAe;CACf,sBAAsB;CACtB,gBAAgB,CAAC,GAAG,EAAE;CACvB,EACF;;;;;AAMD,MAAa,6BAA6B;CACxC,wBAAwB;EACtB,cAAc;EACd,WAAW;EACZ;CACD,iBAAiB;EACf,cAAc;EACd,WAAW;EACZ;CACF;;;;;AAMD,MAAa,gCAAgC;CAC3C,GAAG;CACH,GAAG;CACJ;;;;;;;;AASD,SAAgB,eAAe,OAAuB;AACpD,QAAO,MAAM,QAAQ,EAAE;;;;;;;;;;AAgBzB,SAAgB,oBACd,UACA,MACA,YACQ;AACR,QAAO,MAAM,eAAe,SAAS,CAAC,GAAG,WAAW,IAAI,eAAe,KAAK,CAAC,GAAG,WAAW;;;;;;;;;;;AAY7F,SAAgB,uBACd,OACA,QACA,MACA,YACQ;AACR,QAAO,GAAG,eAAe,MAAM,CAAC,GAAG,WAAW,KAAK,eAAe,OAAO,CAAC,GAAG,WAAW,IAAI,eAAe,KAAK,CAAC,GAAG,WAAW;;;;;;;;;;;AAYjI,SAAgB,qBACd,WACA,WACA,MACA,YACQ;AACR,QAAO,GAAG,eAAe,UAAU,CAAC,GAAG,WAAW,KAAK,eAAe,UAAU,CAAC,GAAG,WAAW,IAAI,eAAe,KAAK,CAAC,GAAG,WAAW;;;;;;;;;AAUxI,SAAgB,sBACd,UACA,YACQ;AACR,QAAO,GAAG,eAAe,SAAS,CAAC,GAAG;;;;;;AAWxC,MAAa,wBAAwB,IAAI,IAAI;CAC3C;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAa,wBAAwB,IAAI,IAAI;CAC3C;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
@@ -49,25 +49,6 @@ type ShapeHoveredEvent = Payload<'shapes:hovered', {
49
49
  * Union of all shape event types
50
50
  */
51
51
  type ShapeEvent = ShapeSelectedEvent | ShapeDeselectedEvent | ShapeHoveredEvent;
52
- /**
53
- * Aliases for backward compatibility
54
- */
55
- declare const SHAPE_EVENTS: {
56
- /** Shape selected */
57
- readonly selected: "shapes:selected";
58
- /** Selection cleared */
59
- readonly deselected: "shapes:deselected";
60
- /** Shape hovered (for cursor changes) */
61
- readonly hovered: "shapes:hovered";
62
- };
63
- type ShapeEventPayload = ShapeEvent;
64
- type ShapeEventHandler<T extends ShapeEventType = ShapeEventType> = (event: Extract<ShapeEvent, {
65
- type: T;
66
- }>) => void;
67
- /**
68
- * Shape events namespace for bus integration
69
- */
70
- declare const ShapeEventsNamespace = "shapes";
71
52
  //#endregion
72
- export { SHAPE_EVENTS, ShapeDeselectedEvent, ShapeEvent, ShapeEventHandler, ShapeEventPayload, ShapeEventType, ShapeEvents, ShapeEventsNamespace, ShapeHoveredEvent, ShapeSelectedEvent };
53
+ export { ShapeDeselectedEvent, ShapeEvent, ShapeEventType, ShapeEvents, ShapeHoveredEvent, ShapeSelectedEvent };
73
54
  //# sourceMappingURL=events.d.ts.map
@@ -22,37 +22,7 @@ const ShapeEvents = {
22
22
  deselected: "shapes:deselected",
23
23
  hovered: "shapes:hovered"
24
24
  };
25
- /**
26
- * Aliases for backward compatibility
27
- */
28
- const SHAPE_EVENTS = ShapeEvents;
29
- /**
30
- * Shape events namespace for bus integration
31
- */
32
- const ShapeEventsNamespace = "shapes";
33
- /**
34
- * Note: These utility functions are deprecated in favor of direct bus usage.
35
- * Use `useEmit` and `useOn` from '@accelint/bus/react' in React components instead.
36
- *
37
- * @example
38
- * ```tsx
39
- * import { useEmit, useOn } from '@accelint/bus/react';
40
- * import { ShapeEvents } from '@accelint/map-toolkit/deckgl/shapes';
41
- *
42
- * function MyComponent() {
43
- * const emit = useEmit();
44
- *
45
- * // Emit shape selected event
46
- * emit(ShapeEvents.selected, { shapeId: 'some-id' });
47
- *
48
- * // Listen to shape events
49
- * useOn(ShapeEvents.selected, (event) => {
50
- * console.log('Shape selected:', event.data.shapeId);
51
- * });
52
- * }
53
- * ```
54
- */
55
25
 
56
26
  //#endregion
57
- export { SHAPE_EVENTS, ShapeEvents, ShapeEventsNamespace };
27
+ export { ShapeEvents };
58
28
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/events.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport type { Payload } from '@accelint/bus';\nimport type { UniqueId } from '@accelint/core';\nimport type { ShapeId } from './types';\n\n/**\n * Shape interaction events for DisplayShapeLayer\n */\nexport const ShapeEvents = {\n /** Shape selected */\n selected: 'shapes:selected',\n /** Selection cleared */\n deselected: 'shapes:deselected',\n /** Shape hovered (for cursor changes) */\n hovered: 'shapes:hovered',\n} as const;\n\nexport type ShapeEventType = (typeof ShapeEvents)[keyof typeof ShapeEvents];\n\n/**\n * Event payload types (all payloads are serializable)\n */\n\nexport type ShapeSelectedEvent = Payload<\n 'shapes:selected',\n {\n shapeId: ShapeId;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\nexport type ShapeDeselectedEvent = Payload<\n 'shapes:deselected',\n {\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\nexport type ShapeHoveredEvent = Payload<\n 'shapes:hovered',\n {\n /** Shape ID being hovered, or null when hover ends */\n shapeId: ShapeId | null;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\n/**\n * Union of all shape event types\n */\nexport type ShapeEvent =\n | ShapeSelectedEvent\n | ShapeDeselectedEvent\n | ShapeHoveredEvent;\n\n/**\n * Aliases for backward compatibility\n */\nexport const SHAPE_EVENTS = ShapeEvents;\nexport type ShapeEventPayload = ShapeEvent;\nexport type ShapeEventHandler<T extends ShapeEventType = ShapeEventType> = (\n event: Extract<ShapeEvent, { type: T }>,\n) => void;\n\n/**\n * Shape events namespace for bus integration\n */\nexport const ShapeEventsNamespace = 'shapes';\n\n/**\n * Note: These utility functions are deprecated in favor of direct bus usage.\n * Use `useEmit` and `useOn` from '@accelint/bus/react' in React components instead.\n *\n * @example\n * ```tsx\n * import { useEmit, useOn } from '@accelint/bus/react';\n * import { ShapeEvents } from '@accelint/map-toolkit/deckgl/shapes';\n *\n * function MyComponent() {\n * const emit = useEmit();\n *\n * // Emit shape selected event\n * emit(ShapeEvents.selected, { shapeId: 'some-id' });\n *\n * // Listen to shape events\n * useOn(ShapeEvents.selected, (event) => {\n * console.log('Shape selected:', event.data.shapeId);\n * });\n * }\n * ```\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cAAc;CAEzB,UAAU;CAEV,YAAY;CAEZ,SAAS;CACV;;;;AA8CD,MAAa,eAAe;;;;AAS5B,MAAa,uBAAuB"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/events.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport type { Payload } from '@accelint/bus';\nimport type { UniqueId } from '@accelint/core';\nimport type { ShapeId } from './types';\n\n/**\n * Shape interaction events for DisplayShapeLayer\n */\nexport const ShapeEvents = {\n /** Shape selected */\n selected: 'shapes:selected',\n /** Selection cleared */\n deselected: 'shapes:deselected',\n /** Shape hovered (for cursor changes) */\n hovered: 'shapes:hovered',\n} as const;\n\nexport type ShapeEventType = (typeof ShapeEvents)[keyof typeof ShapeEvents];\n\n/**\n * Event payload types (all payloads are serializable)\n */\n\nexport type ShapeSelectedEvent = Payload<\n 'shapes:selected',\n {\n shapeId: ShapeId;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\nexport type ShapeDeselectedEvent = Payload<\n 'shapes:deselected',\n {\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\nexport type ShapeHoveredEvent = Payload<\n 'shapes:hovered',\n {\n /** Shape ID being hovered, or null when hover ends */\n shapeId: ShapeId | null;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n }\n>;\n\n/**\n * Union of all shape event types\n */\nexport type ShapeEvent =\n | ShapeSelectedEvent\n | ShapeDeselectedEvent\n | ShapeHoveredEvent;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cAAc;CAEzB,UAAU;CAEV,YAAY;CAEZ,SAAS;CACV"}
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+
14
+ 'use client';
15
+
16
+ import { MapEvents } from "../../../base-map/events.js";
17
+ import { useEffect, useRef } from "react";
18
+ import { useEmit } from "@accelint/bus/react";
19
+
20
+ //#region src/deckgl/shapes/shared/hooks/use-shift-zoom-disable.ts
21
+ /**
22
+ * Hook to disable map zoom while Shift key is held during shape operations.
23
+ *
24
+ * This prevents MapLibre's boxZoom (Shift+drag) from interfering with
25
+ * Shift modifier constraints like:
26
+ * - Shift for uniform scaling during edit
27
+ * - Shift for rotation snap during edit
28
+ * - Shift for square constraint during rectangle drawing
29
+ *
30
+ * @param mapId - The map instance ID
31
+ * @param isActive - Whether the hook should be active (e.g., when editing/drawing)
32
+ */
33
+ function useShiftZoomDisable(mapId, isActive) {
34
+ const emitDisableZoom = useEmit(MapEvents.disableZoom);
35
+ const emitEnableZoom = useEmit(MapEvents.enableZoom);
36
+ const isZoomDisabledRef = useRef(false);
37
+ useEffect(() => {
38
+ if (!isActive) return;
39
+ const disableZoom = () => {
40
+ if (!isZoomDisabledRef.current) {
41
+ isZoomDisabledRef.current = true;
42
+ emitDisableZoom({ id: mapId });
43
+ }
44
+ };
45
+ const enableZoom = () => {
46
+ if (isZoomDisabledRef.current) {
47
+ isZoomDisabledRef.current = false;
48
+ emitEnableZoom({ id: mapId });
49
+ }
50
+ };
51
+ const handleKeyDown = (event) => {
52
+ if (event.key === "Shift") disableZoom();
53
+ };
54
+ const handleKeyUp = (event) => {
55
+ if (event.key === "Shift") enableZoom();
56
+ };
57
+ const handleMouseDown = (event) => {
58
+ if (event.shiftKey) disableZoom();
59
+ };
60
+ const handleBlur = () => {
61
+ enableZoom();
62
+ };
63
+ document.addEventListener("keydown", handleKeyDown);
64
+ document.addEventListener("keyup", handleKeyUp);
65
+ document.addEventListener("mousedown", handleMouseDown, { capture: true });
66
+ window.addEventListener("blur", handleBlur);
67
+ return () => {
68
+ document.removeEventListener("keydown", handleKeyDown);
69
+ document.removeEventListener("keyup", handleKeyUp);
70
+ document.removeEventListener("mousedown", handleMouseDown, { capture: true });
71
+ window.removeEventListener("blur", handleBlur);
72
+ enableZoom();
73
+ };
74
+ }, [
75
+ isActive,
76
+ mapId,
77
+ emitDisableZoom,
78
+ emitEnableZoom
79
+ ]);
80
+ }
81
+
82
+ //#endregion
83
+ export { useShiftZoomDisable };
84
+ //# sourceMappingURL=use-shift-zoom-disable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-shift-zoom-disable.js","names":[],"sources":["../../../../../src/deckgl/shapes/shared/hooks/use-shift-zoom-disable.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport { useEmit } from '@accelint/bus/react';\nimport { useEffect, useRef } from 'react';\nimport { MapEvents } from '@/deckgl/base-map/events';\nimport type { UniqueId } from '@accelint/core';\nimport type {\n MapDisableZoomEvent,\n MapEnableZoomEvent,\n} from '@/deckgl/base-map/types';\n\n/**\n * Hook to disable map zoom while Shift key is held during shape operations.\n *\n * This prevents MapLibre's boxZoom (Shift+drag) from interfering with\n * Shift modifier constraints like:\n * - Shift for uniform scaling during edit\n * - Shift for rotation snap during edit\n * - Shift for square constraint during rectangle drawing\n *\n * @param mapId - The map instance ID\n * @param isActive - Whether the hook should be active (e.g., when editing/drawing)\n */\nexport function useShiftZoomDisable(mapId: UniqueId, isActive: boolean): void {\n const emitDisableZoom = useEmit<MapDisableZoomEvent>(MapEvents.disableZoom);\n const emitEnableZoom = useEmit<MapEnableZoomEvent>(MapEvents.enableZoom);\n const isZoomDisabledRef = useRef(false);\n\n useEffect(() => {\n if (!isActive) {\n return;\n }\n\n const disableZoom = () => {\n if (!isZoomDisabledRef.current) {\n isZoomDisabledRef.current = true;\n emitDisableZoom({ id: mapId });\n }\n };\n\n const enableZoom = () => {\n if (isZoomDisabledRef.current) {\n isZoomDisabledRef.current = false;\n emitEnableZoom({ id: mapId });\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Shift') {\n disableZoom();\n }\n };\n\n const handleKeyUp = (event: KeyboardEvent) => {\n if (event.key === 'Shift') {\n enableZoom();\n }\n };\n\n // Also catch Shift state on mousedown to handle edge cases where\n // keydown might have been missed (e.g., focus issues)\n const handleMouseDown = (event: MouseEvent) => {\n if (event.shiftKey) {\n disableZoom();\n }\n };\n\n // Re-enable zoom if the window loses focus while Shift is held\n const handleBlur = () => {\n enableZoom();\n };\n\n document.addEventListener('keydown', handleKeyDown);\n document.addEventListener('keyup', handleKeyUp);\n document.addEventListener('mousedown', handleMouseDown, { capture: true });\n window.addEventListener('blur', handleBlur);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n document.removeEventListener('keyup', handleKeyUp);\n document.removeEventListener('mousedown', handleMouseDown, {\n capture: true,\n });\n window.removeEventListener('blur', handleBlur);\n\n // Ensure zoom is re-enabled when unmounting\n enableZoom();\n };\n }, [isActive, mapId, emitDisableZoom, emitEnableZoom]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,oBAAoB,OAAiB,UAAyB;CAC5E,MAAM,kBAAkB,QAA6B,UAAU,YAAY;CAC3E,MAAM,iBAAiB,QAA4B,UAAU,WAAW;CACxE,MAAM,oBAAoB,OAAO,MAAM;AAEvC,iBAAgB;AACd,MAAI,CAAC,SACH;EAGF,MAAM,oBAAoB;AACxB,OAAI,CAAC,kBAAkB,SAAS;AAC9B,sBAAkB,UAAU;AAC5B,oBAAgB,EAAE,IAAI,OAAO,CAAC;;;EAIlC,MAAM,mBAAmB;AACvB,OAAI,kBAAkB,SAAS;AAC7B,sBAAkB,UAAU;AAC5B,mBAAe,EAAE,IAAI,OAAO,CAAC;;;EAIjC,MAAM,iBAAiB,UAAyB;AAC9C,OAAI,MAAM,QAAQ,QAChB,cAAa;;EAIjB,MAAM,eAAe,UAAyB;AAC5C,OAAI,MAAM,QAAQ,QAChB,aAAY;;EAMhB,MAAM,mBAAmB,UAAsB;AAC7C,OAAI,MAAM,SACR,cAAa;;EAKjB,MAAM,mBAAmB;AACvB,eAAY;;AAGd,WAAS,iBAAiB,WAAW,cAAc;AACnD,WAAS,iBAAiB,SAAS,YAAY;AAC/C,WAAS,iBAAiB,aAAa,iBAAiB,EAAE,SAAS,MAAM,CAAC;AAC1E,SAAO,iBAAiB,QAAQ,WAAW;AAE3C,eAAa;AACX,YAAS,oBAAoB,WAAW,cAAc;AACtD,YAAS,oBAAoB,SAAS,YAAY;AAClD,YAAS,oBAAoB,aAAa,iBAAiB,EACzD,SAAS,MACV,CAAC;AACF,UAAO,oBAAoB,QAAQ,WAAW;AAG9C,eAAY;;IAEb;EAAC;EAAU;EAAO;EAAiB;EAAe,CAAC"}