@accelint/map-toolkit 0.6.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/catalog-info.yaml +5 -4
  3. package/dist/camera/index.d.ts +2 -2
  4. package/dist/camera/index.js +2 -2
  5. package/dist/camera/store.d.ts +120 -0
  6. package/dist/camera/store.js +279 -0
  7. package/dist/camera/store.js.map +1 -0
  8. package/dist/deckgl/base-map/constants.d.ts +1 -6
  9. package/dist/deckgl/base-map/constants.js +1 -6
  10. package/dist/deckgl/base-map/constants.js.map +1 -1
  11. package/dist/deckgl/base-map/controls.js +2 -0
  12. package/dist/deckgl/base-map/controls.js.map +1 -1
  13. package/dist/deckgl/base-map/index.d.ts +2 -2
  14. package/dist/deckgl/base-map/index.js +10 -11
  15. package/dist/deckgl/base-map/index.js.map +1 -1
  16. package/dist/deckgl/base-map/provider.js +1 -1
  17. package/dist/deckgl/index.d.ts +4 -4
  18. package/dist/deckgl/index.js +4 -4
  19. package/dist/deckgl/saved-viewports/storage.js +10 -2
  20. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  21. package/dist/deckgl/shapes/display-shape-layer/constants.js +5 -8
  22. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
  23. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +18 -14
  24. package/dist/deckgl/shapes/display-shape-layer/index.js +63 -30
  25. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
  26. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +2 -16
  27. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -1
  28. package/dist/deckgl/shapes/display-shape-layer/store.js +58 -272
  29. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -1
  30. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +22 -11
  31. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.d.ts → use-select-shape.d.ts} +9 -9
  32. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.js → use-select-shape.js} +12 -12
  33. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js.map +1 -0
  34. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +5 -66
  35. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
  36. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +2 -65
  37. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +3 -121
  38. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
  39. package/dist/deckgl/shapes/draw-shape-layer/constants.js +46 -0
  40. package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -0
  41. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +92 -0
  42. package/dist/deckgl/shapes/draw-shape-layer/events.js +56 -0
  43. package/dist/deckgl/shapes/draw-shape-layer/events.js.map +1 -0
  44. package/dist/deckgl/shapes/draw-shape-layer/fiber.d.ts +11 -0
  45. package/dist/{maplibre/constants.js → deckgl/shapes/draw-shape-layer/fiber.js} +6 -12
  46. package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -0
  47. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +53 -0
  48. package/dist/deckgl/shapes/draw-shape-layer/index.js +95 -0
  49. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -0
  50. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +51 -0
  51. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -0
  52. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +73 -0
  53. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -0
  54. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +87 -0
  55. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -0
  56. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +88 -0
  57. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -0
  58. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +77 -0
  59. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -0
  60. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +64 -0
  61. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -0
  62. package/dist/deckgl/shapes/draw-shape-layer/store.js +175 -0
  63. package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -0
  64. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +86 -0
  65. package/dist/{viewport/constants.js → deckgl/shapes/draw-shape-layer/types.js} +1 -12
  66. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +82 -0
  67. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +112 -0
  68. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js.map +1 -0
  69. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +147 -0
  70. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -0
  71. package/dist/deckgl/shapes/edit-shape-layer/constants.js +41 -0
  72. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -0
  73. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +92 -0
  74. package/dist/deckgl/shapes/edit-shape-layer/events.js +56 -0
  75. package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -0
  76. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +13 -0
  77. package/dist/deckgl/shapes/edit-shape-layer/fiber.js +14 -0
  78. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +63 -0
  79. package/dist/deckgl/shapes/edit-shape-layer/index.js +162 -0
  80. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -0
  81. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +154 -0
  82. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -0
  83. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +147 -0
  84. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -0
  85. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +87 -0
  86. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -0
  87. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +61 -0
  88. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -0
  89. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +109 -0
  90. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -0
  91. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +289 -0
  92. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -0
  93. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +121 -0
  94. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -0
  95. package/dist/deckgl/shapes/edit-shape-layer/store.js +194 -0
  96. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -0
  97. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +93 -0
  98. package/dist/deckgl/shapes/edit-shape-layer/types.js +14 -0
  99. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +82 -0
  100. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +114 -0
  101. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -0
  102. package/dist/deckgl/shapes/index.d.ts +15 -6
  103. package/dist/deckgl/shapes/index.js +12 -5
  104. package/dist/deckgl/shapes/shared/constants.d.ts +27 -32
  105. package/dist/deckgl/shapes/shared/constants.js +189 -25
  106. package/dist/deckgl/shapes/shared/constants.js.map +1 -1
  107. package/dist/deckgl/shapes/shared/events.d.ts +1 -20
  108. package/dist/deckgl/shapes/shared/events.js +1 -31
  109. package/dist/deckgl/shapes/shared/events.js.map +1 -1
  110. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +84 -0
  111. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -0
  112. package/dist/deckgl/shapes/shared/types.d.ts +187 -28
  113. package/dist/deckgl/shapes/shared/types.js +55 -1
  114. package/dist/deckgl/shapes/shared/types.js.map +1 -1
  115. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +128 -0
  116. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -0
  117. package/dist/deckgl/shapes/shared/utils/layer-config.js +50 -0
  118. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -0
  119. package/dist/deckgl/shapes/shared/utils/mode-utils.js +113 -0
  120. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -0
  121. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +57 -0
  122. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -0
  123. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +64 -0
  124. package/dist/deckgl/shapes/shared/utils/style-utils.js +101 -0
  125. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -0
  126. package/dist/deckgl/text-layer/default-settings.js +4 -24
  127. package/dist/deckgl/text-layer/default-settings.js.map +1 -1
  128. package/dist/deckgl/text-settings.d.ts +77 -0
  129. package/dist/deckgl/text-settings.js +83 -0
  130. package/dist/deckgl/text-settings.js.map +1 -0
  131. package/dist/map-cursor/index.d.ts +2 -2
  132. package/dist/map-cursor/index.js +2 -2
  133. package/dist/map-cursor/store.d.ts +32 -61
  134. package/dist/map-cursor/store.js +165 -294
  135. package/dist/map-cursor/store.js.map +1 -1
  136. package/dist/map-cursor/use-map-cursor.d.ts +5 -2
  137. package/dist/map-cursor/use-map-cursor.js +33 -15
  138. package/dist/map-cursor/use-map-cursor.js.map +1 -1
  139. package/dist/map-mode/index.d.ts +2 -2
  140. package/dist/map-mode/index.js +2 -2
  141. package/dist/map-mode/store.d.ts +36 -37
  142. package/dist/map-mode/store.js +131 -237
  143. package/dist/map-mode/store.js.map +1 -1
  144. package/dist/map-mode/use-map-mode.js +6 -5
  145. package/dist/map-mode/use-map-mode.js.map +1 -1
  146. package/dist/maplibre/index.d.ts +2 -2
  147. package/dist/maplibre/index.js +2 -2
  148. package/dist/shared/constants.d.ts +19 -0
  149. package/dist/shared/constants.js +33 -0
  150. package/dist/shared/constants.js.map +1 -0
  151. package/dist/shared/create-map-store.d.ts +202 -0
  152. package/dist/shared/create-map-store.js +223 -0
  153. package/dist/shared/create-map-store.js.map +1 -0
  154. package/dist/shared/units.d.ts +39 -0
  155. package/dist/shared/units.js +49 -0
  156. package/dist/shared/units.js.map +1 -0
  157. package/dist/viewport/index.d.ts +3 -3
  158. package/dist/viewport/index.js +3 -3
  159. package/dist/viewport/store.d.ts +69 -0
  160. package/dist/viewport/store.js +125 -0
  161. package/dist/viewport/store.js.map +1 -0
  162. package/dist/viewport/types.d.ts +2 -2
  163. package/dist/viewport/utils.js +2 -2
  164. package/dist/viewport/utils.js.map +1 -1
  165. package/dist/viewport/viewport-size.d.ts +2 -2
  166. package/dist/viewport/viewport-size.js +2 -2
  167. package/dist/viewport/viewport-size.js.map +1 -1
  168. package/package.json +36 -18
  169. package/dist/camera/use-camera-state.d.ts +0 -153
  170. package/dist/camera/use-camera-state.js +0 -418
  171. package/dist/camera/use-camera-state.js.map +0 -1
  172. package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +0 -44
  173. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +0 -66
  174. package/dist/deckgl/shapes/display-shape-layer/store.d.ts +0 -87
  175. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +0 -1
  176. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +0 -61
  177. package/dist/maplibre/constants.d.ts +0 -13
  178. package/dist/maplibre/constants.js.map +0 -1
  179. package/dist/viewport/constants.d.ts +0 -11
  180. package/dist/viewport/constants.js.map +0 -1
  181. package/dist/viewport/use-viewport-state.d.ts +0 -100
  182. package/dist/viewport/use-viewport-state.js +0 -222
  183. package/dist/viewport/use-viewport-state.js.map +0 -1
@@ -10,12 +10,19 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { EditableShape, ShapeId, StyledFeature as StyledFeature$1 } from "../shared/types.js";
13
+ import { Shape, ShapeId, StyledFeature as StyledFeature$1 } from "../shared/types.js";
14
14
  import { LabelPositionOptions } from "./utils/labels.js";
15
15
  import { UniqueId } from "@accelint/core";
16
16
  import { CompositeLayerProps } from "@deck.gl/core";
17
17
 
18
18
  //#region src/deckgl/shapes/display-shape-layer/types.d.ts
19
+ /**
20
+ * Label display mode for shapes
21
+ * - `'always'`: Show labels for all shapes
22
+ * - `'hover'`: Show label only for the currently hovered shape
23
+ * - `'never'`: Never show labels
24
+ */
25
+ type ShowLabelsMode = 'always' | 'hover' | 'never';
19
26
  /**
20
27
  * Re-export StyledFeature from shared types
21
28
  */
@@ -50,7 +57,7 @@ interface DisplayShapeLayerProps extends CompositeLayerProps {
50
57
  * Array of shapes to display
51
58
  * Each shape must have a GeoJSON feature with styleProperties
52
59
  */
53
- data: EditableShape[];
60
+ data: Shape[];
54
61
  /**
55
62
  * Currently selected shape ID (for highlighting)
56
63
  * When set, renders a highlight layer around the selected shape
@@ -61,19 +68,23 @@ interface DisplayShapeLayerProps extends CompositeLayerProps {
61
68
  * Also triggers a shapes:selected event on the event bus
62
69
  * @param shape - The clicked shape with full properties
63
70
  */
64
- onShapeClick?: (shape: EditableShape) => void;
71
+ onShapeClick?: (shape: Shape) => void;
65
72
  /**
66
73
  * Callback when a shape is hovered
67
74
  * Called with null when hover ends
68
75
  * @param shape - The hovered shape, or null when hover ends
69
76
  */
70
- onShapeHover?: (shape: EditableShape | null) => void;
77
+ onShapeHover?: (shape: Shape | null) => void;
71
78
  /**
72
- * Whether to show labels on shapes
79
+ * Label display mode for shapes
80
+ * - `'always'`: Show labels for all shapes
81
+ * - `'hover'`: Show label only for the currently hovered shape (requires `pickable={true}`, the default)
82
+ * - `'never'`: Never show labels
83
+ *
73
84
  * Labels use the shape's `label` property, or `name` if label is not set
74
- * @default true
85
+ * @default 'always'
75
86
  */
76
- showLabels?: boolean;
87
+ showLabels?: ShowLabelsMode;
77
88
  /**
78
89
  * Global label positioning options
79
90
  * Can be overridden per-shape via styleProperties
@@ -98,18 +109,18 @@ interface DisplayShapeLayerProps extends CompositeLayerProps {
98
109
  */
99
110
  highlightColor?: [number, number, number, number];
100
111
  /**
101
- * When true (default), applies 60% opacity multiplier to fill colors for standard semi-transparent look.
102
- * This is a convenience prop for achieving the standard map shape appearance.
112
+ * When true (default), multiplies fill color alpha by 0.2 (reducing to 20% of original opacity)
113
+ * for a standard semi-transparent look.
103
114
  * When false, colors are rendered exactly as specified in styleProperties.
104
115
  * @default true
105
116
  * @example Standard semi-transparent fills
106
117
  * ```tsx
107
118
  * <DisplayShapeLayer data={shapes} applyBaseOpacity />
108
- * // Shape with fillColor [98, 166, 255, 255] renders at alpha 153
119
+ * // Shape with fillColor [98, 166, 255, 255] renders at alpha 51 (255 × 0.2)
109
120
  * ```
110
121
  */
111
122
  applyBaseOpacity?: boolean;
112
123
  }
113
124
  //#endregion
114
- export { DisplayShapeLayerProps, StyledFeature, StyledFeatureProperties };
125
+ export { DisplayShapeLayerProps, ShowLabelsMode, StyledFeature, StyledFeatureProperties };
115
126
  //# sourceMappingURL=types.d.ts.map
@@ -13,11 +13,11 @@
13
13
  import { ShapeId } from "../shared/types.js";
14
14
  import { UniqueId } from "@accelint/core";
15
15
 
16
- //#region src/deckgl/shapes/display-shape-layer/use-shape-selection.d.ts
16
+ //#region src/deckgl/shapes/display-shape-layer/use-select-shape.d.ts
17
17
  /**
18
- * Return type for useShapeSelection hook
18
+ * Return type for useSelectShape hook
19
19
  */
20
- interface UseShapeSelectionReturn {
20
+ interface UseSelectShapeReturn {
21
21
  /** Currently selected shape ID, or undefined if nothing selected */
22
22
  selectedId: ShapeId | undefined;
23
23
  /** Manually set the selected shape ID (useful for programmatic selection) */
@@ -43,10 +43,10 @@ interface UseShapeSelectionReturn {
43
43
  *
44
44
  * @example Basic usage
45
45
  * ```tsx
46
- * import { useShapeSelection } from '@accelint/map-toolkit/deckgl/shapes';
46
+ * import { useSelectShape } from '@accelint/map-toolkit/deckgl/shapes';
47
47
  *
48
48
  * function MapWithShapes() {
49
- * const { selectedId } = useShapeSelection(MAP_ID);
49
+ * const { selectedId } = useSelectShape(MAP_ID);
50
50
  *
51
51
  * return (
52
52
  * <BaseMap id={MAP_ID}>
@@ -64,7 +64,7 @@ interface UseShapeSelectionReturn {
64
64
  * @example With programmatic selection control
65
65
  * ```tsx
66
66
  * function MapWithShapes() {
67
- * const { selectedId, setSelectedId, clearSelection } = useShapeSelection(MAP_ID);
67
+ * const { selectedId, setSelectedId, clearSelection } = useSelectShape(MAP_ID);
68
68
  *
69
69
  * return (
70
70
  * <>
@@ -83,7 +83,7 @@ interface UseShapeSelectionReturn {
83
83
  * }
84
84
  * ```
85
85
  */
86
- declare function useShapeSelection(mapId: UniqueId): UseShapeSelectionReturn;
86
+ declare function useSelectShape(mapId: UniqueId): UseSelectShapeReturn;
87
87
  //#endregion
88
- export { UseShapeSelectionReturn, useShapeSelection };
89
- //# sourceMappingURL=use-shape-selection.d.ts.map
88
+ export { UseSelectShapeReturn, useSelectShape };
89
+ //# sourceMappingURL=use-select-shape.d.ts.map
@@ -13,10 +13,9 @@
13
13
 
14
14
  'use client';
15
15
 
16
- import { getOrCreateClearSelection, getOrCreateServerSnapshot, getOrCreateSetSelectedId, getOrCreateSnapshot, getOrCreateSubscription } from "./store.js";
17
- import { useSyncExternalStore } from "react";
16
+ import { shapeSelectionStore } from "./store.js";
18
17
 
19
- //#region src/deckgl/shapes/display-shape-layer/use-shape-selection.ts
18
+ //#region src/deckgl/shapes/display-shape-layer/use-select-shape.ts
20
19
  /**
21
20
  * Hook to manage shape selection state with automatic deselection
22
21
  *
@@ -35,10 +34,10 @@ import { useSyncExternalStore } from "react";
35
34
  *
36
35
  * @example Basic usage
37
36
  * ```tsx
38
- * import { useShapeSelection } from '@accelint/map-toolkit/deckgl/shapes';
37
+ * import { useSelectShape } from '@accelint/map-toolkit/deckgl/shapes';
39
38
  *
40
39
  * function MapWithShapes() {
41
- * const { selectedId } = useShapeSelection(MAP_ID);
40
+ * const { selectedId } = useSelectShape(MAP_ID);
42
41
  *
43
42
  * return (
44
43
  * <BaseMap id={MAP_ID}>
@@ -56,7 +55,7 @@ import { useSyncExternalStore } from "react";
56
55
  * @example With programmatic selection control
57
56
  * ```tsx
58
57
  * function MapWithShapes() {
59
- * const { selectedId, setSelectedId, clearSelection } = useShapeSelection(MAP_ID);
58
+ * const { selectedId, setSelectedId, clearSelection } = useSelectShape(MAP_ID);
60
59
  *
61
60
  * return (
62
61
  * <>
@@ -75,14 +74,15 @@ import { useSyncExternalStore } from "react";
75
74
  * }
76
75
  * ```
77
76
  */
78
- function useShapeSelection(mapId) {
77
+ function useSelectShape(mapId) {
78
+ const { state, setSelectedId, clearSelection } = shapeSelectionStore.use(mapId);
79
79
  return {
80
- selectedId: useSyncExternalStore(getOrCreateSubscription(mapId), getOrCreateSnapshot(mapId), getOrCreateServerSnapshot(mapId)),
81
- setSelectedId: getOrCreateSetSelectedId(mapId),
82
- clearSelection: getOrCreateClearSelection(mapId)
80
+ selectedId: state.selectedId,
81
+ setSelectedId,
82
+ clearSelection
83
83
  };
84
84
  }
85
85
 
86
86
  //#endregion
87
- export { useShapeSelection };
88
- //# sourceMappingURL=use-shape-selection.js.map
87
+ export { useSelectShape };
88
+ //# sourceMappingURL=use-select-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-select-shape.js","names":[],"sources":["../../../../src/deckgl/shapes/display-shape-layer/use-select-shape.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 { shapeSelectionStore } from './store';\nimport type { UniqueId } from '@accelint/core';\nimport type { ShapeId } from '../shared/types';\n\n/**\n * Return type for useSelectShape hook\n */\nexport interface UseSelectShapeReturn {\n /** Currently selected shape ID, or undefined if nothing selected */\n selectedId: ShapeId | undefined;\n /** Manually set the selected shape ID (useful for programmatic selection) */\n setSelectedId: (id: ShapeId | undefined) => void;\n /** Manually clear the selection */\n clearSelection: () => void;\n}\n\n/**\n * Hook to manage shape selection state with automatic deselection\n *\n * This hook encapsulates the common pattern of:\n * 1. Listening to `shapes:selected` events and updating state\n * 2. Listening to `shapes:deselected` events and clearing state\n * 3. Listening to map clicks on empty space and emitting `shapes:deselected`\n *\n * Uses a store pattern with `useSyncExternalStore` for proper listener cleanup\n * during HMR (Hot Module Replacement) in development. The store ensures only\n * one bus listener exists per map instance, regardless of how many React\n * components subscribe.\n *\n * @param mapId - The map instance ID for event filtering\n * @returns Selection state and control functions\n *\n * @example Basic usage\n * ```tsx\n * import { useSelectShape } from '@accelint/map-toolkit/deckgl/shapes';\n *\n * function MapWithShapes() {\n * const { selectedId } = useSelectShape(MAP_ID);\n *\n * return (\n * <BaseMap id={MAP_ID}>\n * <displayShapeLayer\n * id=\"shapes\"\n * mapId={MAP_ID}\n * data={shapes}\n * selectedShapeId={selectedId}\n * />\n * </BaseMap>\n * );\n * }\n * ```\n *\n * @example With programmatic selection control\n * ```tsx\n * function MapWithShapes() {\n * const { selectedId, setSelectedId, clearSelection } = useSelectShape(MAP_ID);\n *\n * return (\n * <>\n * <button onClick={() => setSelectedId(shapes[0].id)}>Select First Shape</button>\n * <button onClick={clearSelection}>Clear Selection</button>\n * <BaseMap id={MAP_ID}>\n * <displayShapeLayer\n * id=\"shapes\"\n * mapId={MAP_ID}\n * data={shapes}\n * selectedShapeId={selectedId}\n * />\n * </BaseMap>\n * </>\n * );\n * }\n * ```\n */\nexport function useSelectShape(mapId: UniqueId): UseSelectShapeReturn {\n const { state, setSelectedId, clearSelection } =\n shapeSelectionStore.use(mapId);\n\n return {\n selectedId: state.selectedId,\n setSelectedId,\n clearSelection,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,SAAgB,eAAe,OAAuC;CACpE,MAAM,EAAE,OAAO,eAAe,mBAC5B,oBAAoB,IAAI,MAAM;AAEhC,QAAO;EACL,YAAY,MAAM;EAClB;EACA;EACD"}
@@ -13,73 +13,12 @@
13
13
 
14
14
  'use client';
15
15
 
16
- import { BASE_FILL_OPACITY, DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STROKE_WIDTH, HIGHLIGHT_WIDTH_INCREASE, HOVER_WIDTH_INCREASE } from "../../shared/constants.js";
16
+ import { DEFAULT_COLORS, HIGHLIGHT_WIDTH_INCREASE, HOVER_WIDTH_INCREASE } from "../../shared/constants.js";
17
+ import { getLineWidth, normalizeColor } from "../../shared/utils/style-utils.js";
17
18
 
18
19
  //#region src/deckgl/shapes/display-shape-layer/utils/display-style.ts
19
20
  /**
20
- * Get fill color for a feature
21
- * Colors are passed through as-is unless applyBaseOpacity is true
22
- *
23
- * @param feature - The styled feature
24
- * @param applyBaseOpacity - When true, multiplies alpha by BASE_FILL_OPACITY (0.6)
25
- * @returns RGBA color array
26
- */
27
- function getFillColor(feature, applyBaseOpacity = false) {
28
- const rgba = normalizeColor((feature.properties?.styleProperties)?.fillColor ?? DEFAULT_COLORS.fill);
29
- if (applyBaseOpacity) return [
30
- rgba[0],
31
- rgba[1],
32
- rgba[2],
33
- Math.round(rgba[3] * BASE_FILL_OPACITY)
34
- ];
35
- return rgba;
36
- }
37
- /**
38
- * Get stroke color for a feature
39
- * Strokes are always rendered at their literal alpha value
40
- *
41
- * @param feature - The styled feature
42
- * @returns RGBA color array
43
- */
44
- function getStrokeColor(feature) {
45
- return normalizeColor((feature.properties?.styleProperties)?.strokeColor ?? DEFAULT_COLORS.stroke);
46
- }
47
- /**
48
- * Normalize a Color to a 4-element RGBA array
49
- * Handles RGB arrays (adds alpha 255), RGBA arrays, and typed arrays
50
- */
51
- function normalizeColor(color) {
52
- if (color instanceof Uint8Array || color instanceof Uint8ClampedArray) return [
53
- color[0] ?? 0,
54
- color[1] ?? 0,
55
- color[2] ?? 0,
56
- color[3] ?? 255
57
- ];
58
- return [
59
- color[0],
60
- color[1],
61
- color[2],
62
- color[3] ?? 255
63
- ];
64
- }
65
- /**
66
- * Get line width for a feature
67
- */
68
- function getLineWidth(feature) {
69
- return (feature.properties?.styleProperties)?.strokeWidth ?? DEFAULT_STROKE_WIDTH;
70
- }
71
- /**
72
- * Alias for getLineWidth (for compatibility)
73
- */
74
- const getStrokeWidth = getLineWidth;
75
- /**
76
- * Get dash array for stroke pattern
77
- */
78
- function getDashArray(feature) {
79
- return DASH_ARRAYS[(feature.properties?.styleProperties)?.strokePattern ?? "solid"] || null;
80
- }
81
- /**
82
- * Get hover-enhanced line width
21
+ * Get hover-enhanced border/outline width
83
22
  */
84
23
  function getHoverLineWidth(feature, isHovered) {
85
24
  const baseWidth = getLineWidth(feature);
@@ -100,12 +39,12 @@ function getHighlightColor(opacity) {
100
39
  return rgba;
101
40
  }
102
41
  /**
103
- * Get highlight line width (base width + increase)
42
+ * Get highlight border/outline width (base width + increase)
104
43
  */
105
44
  function getHighlightLineWidth(feature) {
106
45
  return getLineWidth(feature) + HIGHLIGHT_WIDTH_INCREASE;
107
46
  }
108
47
 
109
48
  //#endregion
110
- export { getDashArray, getFillColor, getHighlightColor, getHighlightLineWidth, getHoverLineWidth, getLineWidth, getStrokeColor, getStrokeWidth };
49
+ export { getHighlightColor, getHighlightLineWidth, getHoverLineWidth };
111
50
  //# sourceMappingURL=display-style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"display-style.js","names":[],"sources":["../../../../../src/deckgl/shapes/display-shape-layer/utils/display-style.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 {\n BASE_FILL_OPACITY,\n DASH_ARRAYS,\n DEFAULT_COLORS,\n DEFAULT_STROKE_WIDTH,\n HIGHLIGHT_WIDTH_INCREASE,\n HOVER_WIDTH_INCREASE,\n} from '../../shared/constants';\nimport type { Color } from '@deck.gl/core';\nimport type { StyledFeature } from '../../shared/types';\n\n/**\n * Get fill color for a feature\n * Colors are passed through as-is unless applyBaseOpacity is true\n *\n * @param feature - The styled feature\n * @param applyBaseOpacity - When true, multiplies alpha by BASE_FILL_OPACITY (0.6)\n * @returns RGBA color array\n */\nexport function getFillColor(\n feature: StyledFeature,\n applyBaseOpacity = false,\n): Color {\n const styleProps = feature.properties?.styleProperties;\n const color = styleProps?.fillColor ?? DEFAULT_COLORS.fill;\n\n // Normalize to 4-element array\n const rgba = normalizeColor(color);\n\n if (applyBaseOpacity) {\n // Apply base opacity multiplier to alpha channel\n return [rgba[0], rgba[1], rgba[2], Math.round(rgba[3] * BASE_FILL_OPACITY)];\n }\n\n return rgba;\n}\n\n/**\n * Get stroke color for a feature\n * Strokes are always rendered at their literal alpha value\n *\n * @param feature - The styled feature\n * @returns RGBA color array\n */\nexport function getStrokeColor(feature: StyledFeature): Color {\n const styleProps = feature.properties?.styleProperties;\n const color = styleProps?.strokeColor ?? DEFAULT_COLORS.stroke;\n\n return normalizeColor(color);\n}\n\n/**\n * Normalize a Color to a 4-element RGBA array\n * Handles RGB arrays (adds alpha 255), RGBA arrays, and typed arrays\n */\nfunction normalizeColor(color: Color): [number, number, number, number] {\n if (color instanceof Uint8Array || color instanceof Uint8ClampedArray) {\n return [color[0] ?? 0, color[1] ?? 0, color[2] ?? 0, color[3] ?? 255];\n }\n\n // Handle RGB (3-element) or RGBA (4-element) arrays\n return [color[0], color[1], color[2], color[3] ?? 255];\n}\n\n/**\n * Get line width for a feature\n */\nexport function getLineWidth(feature: StyledFeature): number {\n const styleProps = feature.properties?.styleProperties;\n return styleProps?.strokeWidth ?? DEFAULT_STROKE_WIDTH;\n}\n\n/**\n * Alias for getLineWidth (for compatibility)\n */\nexport const getStrokeWidth = getLineWidth;\n\n/**\n * Get dash array for stroke pattern\n */\nexport function getDashArray(feature: StyledFeature): [number, number] | null {\n const styleProps = feature.properties?.styleProperties;\n const pattern = styleProps?.strokePattern ?? 'solid';\n\n return DASH_ARRAYS[pattern] || null;\n}\n\n/**\n * Get hover-enhanced line width\n */\nexport function getHoverLineWidth(\n feature: StyledFeature,\n isHovered: boolean,\n): number {\n const baseWidth = getLineWidth(feature);\n return isHovered ? baseWidth + HOVER_WIDTH_INCREASE : baseWidth;\n}\n\n/**\n * Get selection highlight color\n * Returns the default highlight color or allows custom opacity override\n */\nexport function getHighlightColor(\n opacity?: number,\n): [number, number, number, number] {\n const rgba = normalizeColor(DEFAULT_COLORS.highlight);\n\n if (opacity !== undefined) {\n return [rgba[0], rgba[1], rgba[2], Math.round(opacity * 255)];\n }\n\n return rgba;\n}\n\n/**\n * Get highlight line width (base width + increase)\n */\nexport function getHighlightLineWidth(feature: StyledFeature): number {\n const baseWidth = getLineWidth(feature);\n return baseWidth + HIGHLIGHT_WIDTH_INCREASE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,aACd,SACA,mBAAmB,OACZ;CAKP,MAAM,OAAO,gBAJM,QAAQ,YAAY,kBACb,aAAa,eAAe,KAGpB;AAElC,KAAI,iBAEF,QAAO;EAAC,KAAK;EAAI,KAAK;EAAI,KAAK;EAAI,KAAK,MAAM,KAAK,KAAK,kBAAkB;EAAC;AAG7E,QAAO;;;;;;;;;AAUT,SAAgB,eAAe,SAA+B;AAI5D,QAAO,gBAHY,QAAQ,YAAY,kBACb,eAAe,eAAe,OAE5B;;;;;;AAO9B,SAAS,eAAe,OAAgD;AACtE,KAAI,iBAAiB,cAAc,iBAAiB,kBAClD,QAAO;EAAC,MAAM,MAAM;EAAG,MAAM,MAAM;EAAG,MAAM,MAAM;EAAG,MAAM,MAAM;EAAI;AAIvE,QAAO;EAAC,MAAM;EAAI,MAAM;EAAI,MAAM;EAAI,MAAM,MAAM;EAAI;;;;;AAMxD,SAAgB,aAAa,SAAgC;AAE3D,SADmB,QAAQ,YAAY,kBACpB,eAAe;;;;;AAMpC,MAAa,iBAAiB;;;;AAK9B,SAAgB,aAAa,SAAiD;AAI5E,QAAO,aAHY,QAAQ,YAAY,kBACX,iBAAiB,YAEd;;;;;AAMjC,SAAgB,kBACd,SACA,WACQ;CACR,MAAM,YAAY,aAAa,QAAQ;AACvC,QAAO,YAAY,YAAY,uBAAuB;;;;;;AAOxD,SAAgB,kBACd,SACkC;CAClC,MAAM,OAAO,eAAe,eAAe,UAAU;AAErD,KAAI,YAAY,OACd,QAAO;EAAC,KAAK;EAAI,KAAK;EAAI,KAAK;EAAI,KAAK,MAAM,UAAU,IAAI;EAAC;AAG/D,QAAO;;;;;AAMT,SAAgB,sBAAsB,SAAgC;AAEpE,QADkB,aAAa,QAAQ,GACpB"}
1
+ {"version":3,"file":"display-style.js","names":[],"sources":["../../../../../src/deckgl/shapes/display-shape-layer/utils/display-style.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 {\n DEFAULT_COLORS,\n HIGHLIGHT_WIDTH_INCREASE,\n HOVER_WIDTH_INCREASE,\n} from '../../shared/constants';\nimport { getLineWidth, normalizeColor } from '../../shared/utils/style-utils';\nimport type { StyledFeature } from '../../shared/types';\n\n/**\n * Get hover-enhanced border/outline width\n */\nexport function getHoverLineWidth(\n feature: StyledFeature,\n isHovered: boolean,\n): number {\n const baseWidth = getLineWidth(feature);\n return isHovered ? baseWidth + HOVER_WIDTH_INCREASE : baseWidth;\n}\n\n/**\n * Get selection highlight color\n * Returns the default highlight color or allows custom opacity override\n */\nexport function getHighlightColor(\n opacity?: number,\n): [number, number, number, number] {\n const rgba = normalizeColor(DEFAULT_COLORS.highlight);\n\n if (opacity !== undefined) {\n return [rgba[0], rgba[1], rgba[2], Math.round(opacity * 255)];\n }\n\n return rgba;\n}\n\n/**\n * Get highlight border/outline width (base width + increase)\n */\nexport function getHighlightLineWidth(feature: StyledFeature): number {\n const baseWidth = getLineWidth(feature);\n return baseWidth + HIGHLIGHT_WIDTH_INCREASE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,kBACd,SACA,WACQ;CACR,MAAM,YAAY,aAAa,QAAQ;AACvC,QAAO,YAAY,YAAY,uBAAuB;;;;;;AAOxD,SAAgB,kBACd,SACkC;CAClC,MAAM,OAAO,eAAe,eAAe,UAAU;AAErD,KAAI,YAAY,OACd,QAAO;EAAC,KAAK;EAAI,KAAK;EAAI,KAAK;EAAI,KAAK,MAAM,UAAU,IAAI;EAAC;AAG/D,QAAO;;;;;AAMT,SAAgB,sBAAsB,SAAgC;AAEpE,QADkB,aAAa,QAAQ,GACpB"}
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { EditableShape } from "../../shared/types.js";
13
+ import "../../shared/types.js";
14
14
 
15
15
  //#region src/deckgl/shapes/display-shape-layer/utils/labels.d.ts
16
16
  /**
@@ -26,38 +26,6 @@ interface LabelPosition2d {
26
26
  /** Pixel offset from coordinates [x, y] */
27
27
  pixelOffset: [number, number];
28
28
  }
29
- /**
30
- * Calculate a point along a line segment
31
- * @param start - Start coordinate [lon, lat]
32
- * @param end - End coordinate [lon, lat]
33
- * @param ratio - Position along segment (0 = start, 0.5 = middle, 1 = end)
34
- * @returns Interpolated coordinate [lon, lat]
35
- *
36
- * @example
37
- * // Get a point 25% along a line segment
38
- * const start: [number, number] = [-122.4, 37.8];
39
- * const end: [number, number] = [-122.3, 37.9];
40
- * const point = interpolatePoint(start, end, 0.25);
41
- */
42
- declare function interpolatePoint(start: [number, number], end: [number, number], ratio: number): [number, number];
43
- /**
44
- * Get the midpoint of a LineString
45
- * @param coordinates - LineString coordinates array
46
- * @returns Midpoint coordinate [lon, lat]
47
- */
48
- declare function getLineStringMidpoint(coordinates: [number, number][]): [number, number];
49
- /**
50
- * Get the end point of a LineString
51
- * @param coordinates - LineString coordinates array
52
- * @returns End coordinate [lon, lat]
53
- */
54
- declare function getLineStringEndpoint(coordinates: [number, number][]): [number, number];
55
- /**
56
- * Get the midpoint of a Polygon's outer ring
57
- * @param coordinates - Polygon coordinates array (rings)
58
- * @returns Midpoint of outer ring [lon, lat]
59
- */
60
- declare function getPolygonMidpoint(coordinates: [number, number][][]): [number, number];
61
29
  /**
62
30
  * Vertical label position relative to anchor point
63
31
  */
@@ -160,37 +128,6 @@ interface LabelPositionOptions {
160
128
  /** Pixel offset for Circle labels [x, y] @default [0, 10] */
161
129
  circleLabelOffset?: [number, number];
162
130
  }
163
- /**
164
- * Get 2D position for label based on geometry type
165
- * Uses pixel-based offsets for consistent positioning at all zoom levels
166
- *
167
- * Priority for positioning:
168
- * 1. Per-shape properties in styleProperties (highest)
169
- * 2. Global labelOptions from layer props
170
- * 3. Default values (fallback)
171
- *
172
- * Returns null if no valid coordinates can be determined
173
- */
174
- declare function getLabelPosition2d(shape: EditableShape, options?: LabelPositionOptions): LabelPosition2d | null;
175
- /**
176
- * Get label text for a shape
177
- *
178
- * Returns the display label for the shape on the map in uppercase.
179
- * - `label`: Optional short display name shown on the map (e.g., "NYC")
180
- * - `name`: Full shape name used internally (e.g., "New York City Office")
181
- *
182
- * If `label` is not provided, falls back to using `name`.
183
- * Text is automatically converted to uppercase for display.
184
- */
185
- declare function getLabelText(shape: EditableShape): string;
186
- /**
187
- * Get label background color (uses RGB from shape fill color with fixed label opacity)
188
- */
189
- declare function getLabelFillColor(shape: EditableShape): [number, number, number, number];
190
- /**
191
- * Get label border color (uses RGB from shape stroke color with full opacity)
192
- */
193
- declare function getLabelBorderColor(shape: EditableShape): [number, number, number, number];
194
131
  //#endregion
195
- export { CardinalLabelCoordinateAnchor, LabelHorizontalPosition, LabelPosition2d, LabelPositionOptions, LabelVerticalPosition, getLabelBorderColor, getLabelFillColor, getLabelPosition2d, getLabelText, getLineStringEndpoint, getLineStringMidpoint, getPolygonMidpoint, interpolatePoint };
132
+ export { CardinalLabelCoordinateAnchor, LabelHorizontalPosition, LabelPosition2d, LabelPositionOptions, LabelVerticalPosition };
196
133
  //# sourceMappingURL=labels.d.ts.map
@@ -13,7 +13,7 @@
13
13
 
14
14
  'use client';
15
15
 
16
- import { LABEL_BACKGROUND_OPACITY, LABEL_BORDER_OPACITY } from "../../shared/constants.js";
16
+ import { isCircleShape } from "../../shared/types.js";
17
17
 
18
18
  //#region src/deckgl/shapes/display-shape-layer/utils/labels.ts
19
19
  /**
@@ -59,90 +59,6 @@ import { LABEL_BACKGROUND_OPACITY, LABEL_BORDER_OPACITY } from "../../shared/con
59
59
  * ```
60
60
  */
61
61
  /**
62
- * Calculate a point along a line segment
63
- * @param start - Start coordinate [lon, lat]
64
- * @param end - End coordinate [lon, lat]
65
- * @param ratio - Position along segment (0 = start, 0.5 = middle, 1 = end)
66
- * @returns Interpolated coordinate [lon, lat]
67
- *
68
- * @example
69
- * // Get a point 25% along a line segment
70
- * const start: [number, number] = [-122.4, 37.8];
71
- * const end: [number, number] = [-122.3, 37.9];
72
- * const point = interpolatePoint(start, end, 0.25);
73
- */
74
- function interpolatePoint(start, end, ratio) {
75
- const clampedRatio = Math.max(0, Math.min(1, ratio));
76
- return [start[0] + (end[0] - start[0]) * clampedRatio, start[1] + (end[1] - start[1]) * clampedRatio];
77
- }
78
- /**
79
- * Calculate segment lengths for a line
80
- */
81
- function calculateSegmentLengths(coordinates) {
82
- let total = 0;
83
- const lengths = [];
84
- for (let i = 0; i < coordinates.length - 1; i++) {
85
- const start = coordinates[i];
86
- const end = coordinates[i + 1];
87
- if (start && end) {
88
- const length = Math.sqrt((end[0] - start[0]) ** 2 + (end[1] - start[1]) ** 2);
89
- lengths.push(length);
90
- total += length;
91
- }
92
- }
93
- return {
94
- lengths,
95
- total
96
- };
97
- }
98
- /**
99
- * Find point at specific distance along line
100
- */
101
- function findPointAtDistance(coordinates, segmentLengths, targetDistance) {
102
- let accumulatedLength = 0;
103
- for (let i = 0; i < segmentLengths.length; i++) {
104
- const segmentLength = segmentLengths[i];
105
- if (!segmentLength) continue;
106
- if (accumulatedLength + segmentLength >= targetDistance) {
107
- const start = coordinates[i];
108
- const end = coordinates[i + 1];
109
- if (start && end) return interpolatePoint(start, end, (targetDistance - accumulatedLength) / segmentLength);
110
- }
111
- accumulatedLength += segmentLength;
112
- }
113
- return coordinates[coordinates.length - 1] ?? [0, 0];
114
- }
115
- /**
116
- * Get the midpoint of a LineString
117
- * @param coordinates - LineString coordinates array
118
- * @returns Midpoint coordinate [lon, lat]
119
- */
120
- function getLineStringMidpoint(coordinates) {
121
- if (coordinates.length === 0) return [0, 0];
122
- if (coordinates.length === 1) return coordinates[0] ?? [0, 0];
123
- const { lengths, total } = calculateSegmentLengths(coordinates);
124
- return findPointAtDistance(coordinates, lengths, total / 2);
125
- }
126
- /**
127
- * Get the end point of a LineString
128
- * @param coordinates - LineString coordinates array
129
- * @returns End coordinate [lon, lat]
130
- */
131
- function getLineStringEndpoint(coordinates) {
132
- if (coordinates.length === 0) return [0, 0];
133
- return coordinates[coordinates.length - 1] ?? [0, 0];
134
- }
135
- /**
136
- * Get the midpoint of a Polygon's outer ring
137
- * @param coordinates - Polygon coordinates array (rings)
138
- * @returns Midpoint of outer ring [lon, lat]
139
- */
140
- function getPolygonMidpoint(coordinates) {
141
- const outerRing = coordinates[0];
142
- if (!outerRing || outerRing.length === 0) return [0, 0];
143
- return getLineStringMidpoint(outerRing);
144
- }
145
- /**
146
62
  * Convert vertical/horizontal position to deck.gl textAnchor and alignmentBaseline
147
63
  */
148
64
  function convertPositionToAnchors(vertical, horizontal) {
@@ -277,7 +193,7 @@ function getCirclePosition(ring, shapeOffset, shapeVertical, shapeHorizontal, sh
277
193
  */
278
194
  function getPolygonPosition(geometry, shape, shapeOffset, shapeVertical, shapeHorizontal, shapeCoordinateAnchor, options) {
279
195
  const ring = geometry.coordinates[0];
280
- if (shape.shapeType === "Circle") return getCirclePosition(ring, shapeOffset, shapeVertical, shapeHorizontal, shapeCoordinateAnchor, options);
196
+ if (isCircleShape(shape)) return getCirclePosition(ring, shapeOffset, shapeVertical, shapeHorizontal, shapeCoordinateAnchor, options);
281
197
  const defaultOffset = [0, 10];
282
198
  const defaultVertical = "top";
283
199
  const defaultHorizontal = "center";
@@ -328,41 +244,7 @@ function getLabelPosition2d(shape, options) {
328
244
  function getLabelText(shape) {
329
245
  return (shape.label || shape.name).toUpperCase();
330
246
  }
331
- /**
332
- * Get label background color (uses RGB from shape fill color with fixed label opacity)
333
- */
334
- function getLabelFillColor(shape) {
335
- const fillColor = (shape.feature.properties?.styleProperties)?.fillColor ?? [
336
- 98,
337
- 166,
338
- 255,
339
- 255
340
- ];
341
- return [
342
- fillColor[0] ?? 98,
343
- fillColor[1] ?? 166,
344
- fillColor[2] ?? 255,
345
- LABEL_BACKGROUND_OPACITY
346
- ];
347
- }
348
- /**
349
- * Get label border color (uses RGB from shape stroke color with full opacity)
350
- */
351
- function getLabelBorderColor(shape) {
352
- const strokeColor = (shape.feature.properties?.styleProperties)?.strokeColor ?? [
353
- 98,
354
- 166,
355
- 255,
356
- 255
357
- ];
358
- return [
359
- strokeColor[0] ?? 98,
360
- strokeColor[1] ?? 166,
361
- strokeColor[2] ?? 255,
362
- LABEL_BORDER_OPACITY
363
- ];
364
- }
365
247
 
366
248
  //#endregion
367
- export { getLabelBorderColor, getLabelFillColor, getLabelPosition2d, getLabelText, getLineStringEndpoint, getLineStringMidpoint, getPolygonMidpoint, interpolatePoint };
249
+ export { getLabelPosition2d, getLabelText };
368
250
  //# sourceMappingURL=labels.js.map