@deck.gl-community/editable-layers 9.0.0-alpha.1 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +2 -81
  3. package/dist/constants.js +4 -1
  4. package/dist/edit-modes/composite-mode.d.ts +1 -1
  5. package/dist/edit-modes/composite-mode.js +4 -1
  6. package/dist/edit-modes/draw-90degree-polygon-mode.d.ts +1 -1
  7. package/dist/edit-modes/draw-90degree-polygon-mode.js +29 -24
  8. package/dist/edit-modes/draw-circle-by-diameter-mode.d.ts +1 -1
  9. package/dist/edit-modes/draw-circle-by-diameter-mode.js +7 -4
  10. package/dist/edit-modes/draw-circle-from-center-mode.d.ts +1 -1
  11. package/dist/edit-modes/draw-circle-from-center-mode.js +7 -4
  12. package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.d.ts +1 -1
  13. package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.js +3 -0
  14. package/dist/edit-modes/draw-ellipse-using-three-points-mode.d.ts +1 -1
  15. package/dist/edit-modes/draw-ellipse-using-three-points-mode.js +3 -0
  16. package/dist/edit-modes/draw-line-string-mode.d.ts +1 -1
  17. package/dist/edit-modes/draw-line-string-mode.js +19 -16
  18. package/dist/edit-modes/draw-point-mode.d.ts +1 -1
  19. package/dist/edit-modes/draw-point-mode.js +7 -4
  20. package/dist/edit-modes/draw-polygon-by-dragging-mode.d.ts +1 -1
  21. package/dist/edit-modes/draw-polygon-by-dragging-mode.js +10 -5
  22. package/dist/edit-modes/draw-polygon-mode.d.ts +1 -1
  23. package/dist/edit-modes/draw-polygon-mode.js +20 -16
  24. package/dist/edit-modes/draw-rectangle-from-center-mode.d.ts +1 -1
  25. package/dist/edit-modes/draw-rectangle-from-center-mode.js +3 -0
  26. package/dist/edit-modes/draw-rectangle-mode.d.ts +1 -1
  27. package/dist/edit-modes/draw-rectangle-mode.js +3 -0
  28. package/dist/edit-modes/draw-rectangle-using-three-points-mode.d.ts +1 -1
  29. package/dist/edit-modes/draw-rectangle-using-three-points-mode.js +8 -5
  30. package/dist/edit-modes/draw-square-from-center-mode.d.ts +1 -1
  31. package/dist/edit-modes/draw-square-from-center-mode.js +3 -0
  32. package/dist/edit-modes/draw-square-mode.d.ts +1 -1
  33. package/dist/edit-modes/draw-square-mode.js +3 -0
  34. package/dist/edit-modes/duplicate-mode.d.ts +1 -1
  35. package/dist/edit-modes/duplicate-mode.js +3 -0
  36. package/dist/edit-modes/edit-mode.js +3 -1
  37. package/dist/edit-modes/elevation-mode.d.ts +2 -2
  38. package/dist/edit-modes/elevation-mode.js +8 -5
  39. package/dist/edit-modes/extend-line-string-mode.d.ts +1 -1
  40. package/dist/edit-modes/extend-line-string-mode.js +9 -6
  41. package/dist/edit-modes/extrude-mode.d.ts +1 -1
  42. package/dist/edit-modes/extrude-mode.js +10 -7
  43. package/dist/edit-modes/geojson-edit-mode.d.ts +1 -1
  44. package/dist/edit-modes/geojson-edit-mode.js +18 -15
  45. package/dist/edit-modes/immutable-feature-collection.d.ts +2 -1
  46. package/dist/edit-modes/immutable-feature-collection.js +25 -20
  47. package/dist/edit-modes/measure-angle-mode.d.ts +1 -1
  48. package/dist/edit-modes/measure-angle-mode.js +8 -8
  49. package/dist/edit-modes/measure-area-mode.d.ts +1 -1
  50. package/dist/edit-modes/measure-area-mode.js +7 -5
  51. package/dist/edit-modes/measure-distance-mode.d.ts +1 -1
  52. package/dist/edit-modes/measure-distance-mode.js +17 -14
  53. package/dist/edit-modes/modify-mode.d.ts +1 -1
  54. package/dist/edit-modes/modify-mode.js +17 -14
  55. package/dist/edit-modes/resize-circle-mode.d.ts +2 -2
  56. package/dist/edit-modes/resize-circle-mode.js +3 -1
  57. package/dist/edit-modes/rotate-mode.d.ts +1 -1
  58. package/dist/edit-modes/rotate-mode.js +8 -5
  59. package/dist/edit-modes/scale-mode.d.ts +1 -1
  60. package/dist/edit-modes/scale-mode.js +8 -5
  61. package/dist/edit-modes/snappable-mode.d.ts +1 -1
  62. package/dist/edit-modes/snappable-mode.js +8 -5
  63. package/dist/edit-modes/split-polygon-mode.d.ts +1 -1
  64. package/dist/edit-modes/split-polygon-mode.js +12 -9
  65. package/dist/edit-modes/three-click-polygon-mode.d.ts +1 -1
  66. package/dist/edit-modes/three-click-polygon-mode.js +9 -6
  67. package/dist/edit-modes/transform-mode.d.ts +1 -1
  68. package/dist/edit-modes/transform-mode.js +4 -1
  69. package/dist/edit-modes/translate-mode.d.ts +1 -1
  70. package/dist/edit-modes/translate-mode.js +7 -4
  71. package/dist/edit-modes/two-click-polygon-mode.d.ts +1 -1
  72. package/dist/edit-modes/two-click-polygon-mode.js +9 -6
  73. package/dist/edit-modes/types.d.ts +1 -1
  74. package/dist/edit-modes/types.js +3 -0
  75. package/dist/edit-modes/utils.d.ts +1 -1
  76. package/dist/edit-modes/utils.js +21 -19
  77. package/dist/edit-modes/view-mode.js +3 -0
  78. package/dist/editable-layers/editable-geojson-layer.d.ts +4 -4
  79. package/dist/editable-layers/editable-geojson-layer.js +27 -26
  80. package/dist/editable-layers/editable-h3-cluster-layer.d.ts +2 -2
  81. package/dist/editable-layers/editable-h3-cluster-layer.js +6 -3
  82. package/dist/editable-layers/editable-layer.d.ts +5 -5
  83. package/dist/editable-layers/editable-layer.js +18 -15
  84. package/dist/editable-layers/editable-path-layer.d.ts +1 -1
  85. package/dist/editable-layers/editable-path-layer.js +10 -7
  86. package/dist/editable-layers/elevated-edit-handle-layer.d.ts +1 -1
  87. package/dist/editable-layers/elevated-edit-handle-layer.js +6 -3
  88. package/dist/editable-layers/junction-scatterplot-layer.d.ts +2 -2
  89. package/dist/editable-layers/junction-scatterplot-layer.js +10 -7
  90. package/dist/editable-layers/selection-layer.d.ts +1 -1
  91. package/dist/editable-layers/selection-layer.js +5 -2
  92. package/dist/index.cjs +65 -537
  93. package/dist/index.cjs.map +4 -4
  94. package/dist/index.d.ts +19 -20
  95. package/dist/index.js +20 -18
  96. package/dist/lib/constants.js +3 -0
  97. package/dist/lib/deck-renderer/deck-cache.d.ts +1 -1
  98. package/dist/lib/deck-renderer/deck-cache.js +1 -1
  99. package/dist/lib/deck-renderer/deck-drawer.d.ts +2 -3
  100. package/dist/lib/deck-renderer/deck-drawer.js +12 -12
  101. package/dist/lib/feature.d.ts +4 -4
  102. package/dist/lib/feature.js +4 -1
  103. package/dist/lib/layer-mouse-event.d.ts +2 -2
  104. package/dist/lib/layer-mouse-event.js +4 -1
  105. package/dist/lib/layers/junctions-layer.d.ts +4 -4
  106. package/dist/lib/layers/junctions-layer.js +10 -7
  107. package/dist/lib/layers/segments-layer.d.ts +4 -4
  108. package/dist/lib/layers/segments-layer.js +11 -8
  109. package/dist/lib/layers/texts-layer.d.ts +3 -3
  110. package/dist/lib/layers/texts-layer.js +8 -5
  111. package/dist/lib/math.d.ts +1 -1
  112. package/dist/lib/math.js +3 -0
  113. package/dist/lib/{nebula.d.ts → nebula-core.d.ts} +2 -2
  114. package/dist/lib/{nebula.js → nebula-core.js} +7 -4
  115. package/dist/lib/nebula-layer.d.ts +2 -2
  116. package/dist/lib/nebula-layer.js +4 -1
  117. package/dist/lib/style.js +5 -2
  118. package/dist/mode-handlers/composite-mode-handler.d.ts +1 -1
  119. package/dist/mode-handlers/draw-90degree-polygon-handler.d.ts +1 -1
  120. package/dist/mode-handlers/draw-90degree-polygon-handler.js +13 -10
  121. package/dist/mode-handlers/draw-circle-by-bounding-box-handler.js +3 -0
  122. package/dist/mode-handlers/draw-circle-from-center-handler.js +3 -0
  123. package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.js +3 -0
  124. package/dist/mode-handlers/draw-ellipse-using-three-points-handler.js +5 -2
  125. package/dist/mode-handlers/draw-line-string-handler.js +7 -4
  126. package/dist/mode-handlers/draw-point-handler.js +4 -1
  127. package/dist/mode-handlers/draw-polygon-handler.d.ts +1 -1
  128. package/dist/mode-handlers/draw-polygon-handler.js +10 -7
  129. package/dist/mode-handlers/draw-rectangle-handler.js +3 -0
  130. package/dist/mode-handlers/draw-rectangle-using-three-points-handler.js +11 -8
  131. package/dist/mode-handlers/duplicate-handler.js +3 -0
  132. package/dist/mode-handlers/elevation-handler.d.ts +2 -2
  133. package/dist/mode-handlers/elevation-handler.js +8 -5
  134. package/dist/mode-handlers/extrude-handler.js +10 -7
  135. package/dist/mode-handlers/mode-handler.d.ts +1 -1
  136. package/dist/mode-handlers/mode-handler.js +17 -14
  137. package/dist/mode-handlers/modify-handler.d.ts +2 -2
  138. package/dist/mode-handlers/modify-handler.js +18 -15
  139. package/dist/mode-handlers/rotate-handler.d.ts +1 -1
  140. package/dist/mode-handlers/rotate-handler.js +4 -1
  141. package/dist/mode-handlers/scale-handler.d.ts +1 -1
  142. package/dist/mode-handlers/scale-handler.js +5 -2
  143. package/dist/mode-handlers/snappable-handler.d.ts +1 -1
  144. package/dist/mode-handlers/snappable-handler.js +6 -3
  145. package/dist/mode-handlers/split-polygon-handler.js +11 -8
  146. package/dist/mode-handlers/three-click-polygon-handler.js +3 -0
  147. package/dist/mode-handlers/translate-handler.d.ts +1 -1
  148. package/dist/mode-handlers/translate-handler.js +4 -1
  149. package/dist/mode-handlers/two-click-polygon-handler.js +3 -0
  150. package/dist/mode-handlers/view-handler.d.ts +1 -1
  151. package/dist/mode-handlers/view-handler.js +3 -0
  152. package/dist/shaderlib/color/color.d.ts +7 -6
  153. package/dist/shaderlib/color/color.js +7 -4
  154. package/dist/shaderlib/utils/utils.d.ts +2 -2
  155. package/dist/shaderlib/utils/utils.js +5 -2
  156. package/dist/{curve-utils.js → utils/curve-utils.js} +7 -4
  157. package/dist/{geojson-types.d.ts → utils/geojson-types.d.ts} +2 -25
  158. package/dist/utils/geojson-types.js +4 -0
  159. package/dist/{memoize.d.ts → utils/memoize.d.ts} +1 -1
  160. package/dist/{memoize.js → utils/memoize.js} +4 -1
  161. package/dist/{translateFromCenter.js → utils/translate-from-center.js} +4 -1
  162. package/dist/utils/types.js +4 -0
  163. package/dist/{utils.js → utils/utils.js} +8 -6
  164. package/package.json +10 -10
  165. package/src/constants.ts +5 -1
  166. package/src/edit-modes/composite-mode.ts +9 -5
  167. package/src/edit-modes/draw-90degree-polygon-mode.ts +38 -34
  168. package/src/edit-modes/draw-circle-by-diameter-mode.ts +16 -12
  169. package/src/edit-modes/draw-circle-from-center-mode.ts +15 -11
  170. package/src/edit-modes/draw-ellipse-by-bounding-box-mode.ts +8 -4
  171. package/src/edit-modes/draw-ellipse-using-three-points-mode.ts +9 -5
  172. package/src/edit-modes/draw-line-string-mode.ts +29 -25
  173. package/src/edit-modes/draw-point-mode.ts +13 -9
  174. package/src/edit-modes/draw-polygon-by-dragging-mode.ts +16 -16
  175. package/src/edit-modes/draw-polygon-mode.ts +28 -23
  176. package/src/edit-modes/draw-rectangle-from-center-mode.ts +6 -2
  177. package/src/edit-modes/draw-rectangle-mode.ts +6 -2
  178. package/src/edit-modes/draw-rectangle-using-three-points-mode.ts +12 -8
  179. package/src/edit-modes/draw-square-from-center-mode.ts +7 -3
  180. package/src/edit-modes/draw-square-mode.ts +7 -3
  181. package/src/edit-modes/duplicate-mode.ts +7 -3
  182. package/src/edit-modes/edit-mode.ts +5 -1
  183. package/src/edit-modes/elevation-mode.ts +13 -9
  184. package/src/edit-modes/extend-line-string-mode.ts +16 -12
  185. package/src/edit-modes/extrude-mode.ts +22 -18
  186. package/src/edit-modes/geojson-edit-mode.ts +37 -33
  187. package/src/edit-modes/immutable-feature-collection.ts +28 -22
  188. package/src/edit-modes/measure-angle-mode.ts +66 -59
  189. package/src/edit-modes/measure-area-mode.ts +13 -10
  190. package/src/edit-modes/measure-distance-mode.ts +37 -33
  191. package/src/edit-modes/modify-mode.ts +36 -32
  192. package/src/edit-modes/resize-circle-mode.ts +8 -5
  193. package/src/edit-modes/rotate-mode.ts +22 -18
  194. package/src/edit-modes/scale-mode.ts +29 -23
  195. package/src/edit-modes/snappable-mode.ts +19 -15
  196. package/src/edit-modes/split-polygon-mode.ts +25 -21
  197. package/src/edit-modes/three-click-polygon-mode.ts +15 -11
  198. package/src/edit-modes/transform-mode.ts +15 -11
  199. package/src/edit-modes/translate-mode.ts +15 -11
  200. package/src/edit-modes/two-click-polygon-mode.ts +15 -11
  201. package/src/edit-modes/types.ts +5 -1
  202. package/src/edit-modes/utils.ts +33 -30
  203. package/src/edit-modes/view-mode.ts +5 -1
  204. package/src/editable-layers/editable-geojson-layer.ts +44 -41
  205. package/src/editable-layers/editable-h3-cluster-layer.ts +17 -14
  206. package/src/editable-layers/editable-layer.ts +42 -32
  207. package/src/editable-layers/editable-path-layer.ts +12 -8
  208. package/src/editable-layers/elevated-edit-handle-layer.ts +11 -7
  209. package/src/editable-layers/junction-scatterplot-layer.ts +15 -11
  210. package/src/editable-layers/selection-layer.ts +11 -7
  211. package/src/index.ts +68 -65
  212. package/src/lib/constants.ts +4 -0
  213. package/src/lib/deck-renderer/deck-cache.ts +1 -1
  214. package/src/lib/deck-renderer/deck-drawer.ts +28 -28
  215. package/src/lib/feature.ts +7 -3
  216. package/src/lib/layer-mouse-event.ts +7 -6
  217. package/src/lib/layers/junctions-layer.ts +14 -10
  218. package/src/lib/layers/segments-layer.ts +24 -20
  219. package/src/lib/layers/texts-layer.ts +18 -14
  220. package/src/lib/math.ts +5 -1
  221. package/src/lib/{nebula.ts → nebula-core.ts} +8 -4
  222. package/src/lib/nebula-layer.ts +9 -5
  223. package/src/lib/style.ts +6 -2
  224. package/src/mode-handlers/composite-mode-handler.ts +6 -6
  225. package/src/mode-handlers/draw-90degree-polygon-handler.ts +22 -18
  226. package/src/mode-handlers/draw-circle-by-bounding-box-handler.ts +10 -6
  227. package/src/mode-handlers/draw-circle-from-center-handler.ts +10 -6
  228. package/src/mode-handlers/draw-ellipse-by-bounding-box-handler.ts +9 -5
  229. package/src/mode-handlers/draw-ellipse-using-three-points-handler.ts +12 -8
  230. package/src/mode-handlers/draw-line-string-handler.ts +12 -8
  231. package/src/mode-handlers/draw-point-handler.ts +9 -5
  232. package/src/mode-handlers/draw-polygon-handler.ts +16 -12
  233. package/src/mode-handlers/draw-rectangle-handler.ts +8 -4
  234. package/src/mode-handlers/draw-rectangle-using-three-points-handler.ts +17 -13
  235. package/src/mode-handlers/duplicate-handler.ts +8 -4
  236. package/src/mode-handlers/elevation-handler.ts +14 -10
  237. package/src/mode-handlers/extrude-handler.ts +15 -11
  238. package/src/mode-handlers/mode-handler.ts +26 -28
  239. package/src/mode-handlers/modify-handler.ts +29 -25
  240. package/src/mode-handlers/rotate-handler.ts +13 -17
  241. package/src/mode-handlers/scale-handler.ts +13 -13
  242. package/src/mode-handlers/snappable-handler.ts +28 -24
  243. package/src/mode-handlers/split-polygon-handler.ts +22 -18
  244. package/src/mode-handlers/three-click-polygon-handler.ts +6 -2
  245. package/src/mode-handlers/translate-handler.ts +12 -8
  246. package/src/mode-handlers/two-click-polygon-handler.ts +6 -2
  247. package/src/mode-handlers/view-handler.ts +7 -3
  248. package/src/shaderlib/color/color.ts +10 -5
  249. package/src/shaderlib/utils/utils.ts +6 -2
  250. package/src/{curve-utils.ts → utils/curve-utils.ts} +11 -7
  251. package/src/{geojson-types.ts → utils/geojson-types.ts} +16 -31
  252. package/src/{memoize.ts → utils/memoize.ts} +5 -1
  253. package/src/{translateFromCenter.ts → utils/translate-from-center.ts} +8 -4
  254. package/src/{types.ts → utils/types.ts} +4 -0
  255. package/src/{utils.ts → utils/utils.ts} +14 -11
  256. package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.d.ts +0 -4
  257. package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.js +0 -55
  258. package/dist/editable-layers/path-marker-layer/create-path-markers.d.ts +0 -16
  259. package/dist/editable-layers/path-marker-layer/create-path-markers.js +0 -75
  260. package/dist/editable-layers/path-marker-layer/path-marker-layer.d.ts +0 -40
  261. package/dist/editable-layers/path-marker-layer/path-marker-layer.js +0 -121
  262. package/dist/editable-layers/path-marker-layer/polyline.d.ts +0 -18
  263. package/dist/editable-layers/path-marker-layer/polyline.js +0 -37
  264. package/dist/editable-layers/path-outline-layer/path-outline-layer.d.ts +0 -26
  265. package/dist/editable-layers/path-outline-layer/path-outline-layer.js +0 -106
  266. package/dist/geojson-types.js +0 -2
  267. package/dist/shaderlib/outline/outline.d.ts +0 -8
  268. package/dist/shaderlib/outline/outline.js +0 -97
  269. package/dist/types.js +0 -1
  270. package/src/editable-layers/path-marker-layer/arrow-2d-geometry.ts +0 -61
  271. package/src/editable-layers/path-marker-layer/create-path-markers.ts +0 -107
  272. package/src/editable-layers/path-marker-layer/path-marker-layer.ts +0 -179
  273. package/src/editable-layers/path-marker-layer/polyline.ts +0 -40
  274. package/src/editable-layers/path-outline-layer/path-outline-layer.ts +0 -147
  275. package/src/shaderlib/outline/outline.ts +0 -101
  276. /package/dist/{curve-utils.d.ts → utils/curve-utils.d.ts} +0 -0
  277. /package/dist/{translateFromCenter.d.ts → utils/translate-from-center.d.ts} +0 -0
  278. /package/dist/{types.d.ts → utils/types.d.ts} +0 -0
  279. /package/dist/{utils.d.ts → utils/utils.d.ts} +0 -0
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  export class ImmutableFeatureCollection {
2
5
  featureCollection;
3
6
  constructor(featureCollection) {
@@ -21,7 +24,7 @@ export class ImmutableFeatureCollection {
21
24
  const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
22
25
  const updatedGeometry = {
23
26
  ...geometry,
24
- coordinates: immutablyReplacePosition(geometry.coordinates, positionIndexes, updatedPosition, isPolygonal),
27
+ coordinates: immutablyReplacePosition(geometry.coordinates, positionIndexes, updatedPosition, isPolygonal)
25
28
  };
26
29
  return this.replaceGeometry(featureIndex, updatedGeometry);
27
30
  }
@@ -33,30 +36,32 @@ export class ImmutableFeatureCollection {
33
36
  * @param positionIndexes An array containing the indexes of the postion to remove
34
37
  *
35
38
  * @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.
39
+ *
36
40
  */
41
+ // eslint-disable-next-line complexity
37
42
  removePosition(featureIndex, positionIndexes) {
38
43
  const geometry = this.featureCollection.features[featureIndex].geometry;
39
44
  if (geometry.type === 'Point') {
40
- throw Error('Can\'t remove a position from a Point or there\'d be nothing left');
45
+ throw Error("Can't remove a position from a Point or there'd be nothing left");
41
46
  }
42
47
  if (geometry.type === 'MultiPoint' && // only 1 point left
43
48
  geometry.coordinates.length < 2) {
44
- throw Error('Can\'t remove the last point of a MultiPoint or there\'d be nothing left');
49
+ throw Error("Can't remove the last point of a MultiPoint or there'd be nothing left");
45
50
  }
46
51
  if (geometry.type === 'LineString' && // only 2 positions
47
52
  geometry.coordinates.length < 3) {
48
- throw Error('Can\'t remove position. LineString must have at least two positions');
53
+ throw Error("Can't remove position. LineString must have at least two positions");
49
54
  }
50
55
  if (geometry.type === 'Polygon' && // outer ring is a triangle
51
56
  geometry.coordinates[0].length < 5 &&
52
57
  Array.isArray(positionIndexes) && // trying to remove from outer ring
53
58
  positionIndexes[0] === 0) {
54
- throw Error('Can\'t remove position. Polygon\'s outer ring must have at least four positions');
59
+ throw Error("Can't remove position. Polygon's outer ring must have at least four positions");
55
60
  }
56
61
  if (geometry.type === 'MultiLineString' && // only 1 LineString left
57
62
  geometry.coordinates.length === 1 && // only 2 positions
58
63
  geometry.coordinates[0].length < 3) {
59
- throw Error('Can\'t remove position. MultiLineString must have at least two positions');
64
+ throw Error("Can't remove position. MultiLineString must have at least two positions");
60
65
  }
61
66
  if (geometry.type === 'MultiPolygon' && // only 1 polygon left
62
67
  geometry.coordinates.length === 1 && // outer ring is a triangle
@@ -64,12 +69,12 @@ export class ImmutableFeatureCollection {
64
69
  Array.isArray(positionIndexes) && // trying to remove from first polygon
65
70
  positionIndexes[0] === 0 && // trying to remove from outer ring
66
71
  positionIndexes[1] === 0) {
67
- throw Error('Can\'t remove position. MultiPolygon\'s outer ring must have at least four positions');
72
+ throw Error("Can't remove position. MultiPolygon's outer ring must have at least four positions");
68
73
  }
69
74
  const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
70
75
  const updatedGeometry = {
71
76
  ...geometry,
72
- coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal),
77
+ coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)
73
78
  };
74
79
  // Handle cases where incomplete geometries need pruned (e.g. holes that were triangles)
75
80
  pruneGeometryIfNecessary(updatedGeometry);
@@ -93,22 +98,22 @@ export class ImmutableFeatureCollection {
93
98
  const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
94
99
  const updatedGeometry = {
95
100
  ...geometry,
96
- coordinates: immutablyAddPosition(geometry.coordinates, positionIndexes, positionToAdd, isPolygonal),
101
+ coordinates: immutablyAddPosition(geometry.coordinates, positionIndexes, positionToAdd, isPolygonal)
97
102
  };
98
103
  return this.replaceGeometry(featureIndex, updatedGeometry);
99
104
  }
100
105
  replaceGeometry(featureIndex, geometry) {
101
106
  const updatedFeature = {
102
107
  ...this.featureCollection.features[featureIndex],
103
- geometry,
108
+ geometry
104
109
  };
105
110
  const updatedFeatureCollection = {
106
111
  ...this.featureCollection,
107
112
  features: [
108
113
  ...this.featureCollection.features.slice(0, featureIndex),
109
114
  updatedFeature,
110
- ...this.featureCollection.features.slice(featureIndex + 1),
111
- ],
115
+ ...this.featureCollection.features.slice(featureIndex + 1)
116
+ ]
112
117
  };
113
118
  return new ImmutableFeatureCollection(updatedFeatureCollection);
114
119
  }
@@ -118,7 +123,7 @@ export class ImmutableFeatureCollection {
118
123
  addFeatures(features) {
119
124
  const updatedFeatureCollection = {
120
125
  ...this.featureCollection,
121
- features: [...this.featureCollection.features, ...features],
126
+ features: [...this.featureCollection.features, ...features]
122
127
  };
123
128
  return new ImmutableFeatureCollection(updatedFeatureCollection);
124
129
  }
@@ -136,7 +141,7 @@ export class ImmutableFeatureCollection {
136
141
  }
137
142
  const updatedFeatureCollection = {
138
143
  ...this.featureCollection,
139
- features,
144
+ features
140
145
  };
141
146
  return new ImmutableFeatureCollection(updatedFeatureCollection);
142
147
  }
@@ -161,7 +166,7 @@ function immutablyReplacePosition(coordinates, positionIndexes, updatedPosition,
161
166
  const updated = [
162
167
  ...coordinates.slice(0, positionIndexes[0]),
163
168
  getUpdatedPosition(updatedPosition, coordinates[positionIndexes[0]]),
164
- ...coordinates.slice(positionIndexes[0] + 1),
169
+ ...coordinates.slice(positionIndexes[0] + 1)
165
170
  ];
166
171
  if (isPolygonal &&
167
172
  (positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)) {
@@ -176,7 +181,7 @@ function immutablyReplacePosition(coordinates, positionIndexes, updatedPosition,
176
181
  return [
177
182
  ...coordinates.slice(0, positionIndexes[0]),
178
183
  immutablyReplacePosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), updatedPosition, isPolygonal),
179
- ...coordinates.slice(positionIndexes[0] + 1),
184
+ ...coordinates.slice(positionIndexes[0] + 1)
180
185
  ];
181
186
  }
182
187
  function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
@@ -189,7 +194,7 @@ function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
189
194
  if (positionIndexes.length === 1) {
190
195
  const updated = [
191
196
  ...coordinates.slice(0, positionIndexes[0]),
192
- ...coordinates.slice(positionIndexes[0] + 1),
197
+ ...coordinates.slice(positionIndexes[0] + 1)
193
198
  ];
194
199
  if (isPolygonal &&
195
200
  (positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)) {
@@ -210,7 +215,7 @@ function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
210
215
  return [
211
216
  ...coordinates.slice(0, positionIndexes[0]),
212
217
  immutablyRemovePosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), isPolygonal),
213
- ...coordinates.slice(positionIndexes[0] + 1),
218
+ ...coordinates.slice(positionIndexes[0] + 1)
214
219
  ];
215
220
  }
216
221
  function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPolygonal) {
@@ -224,7 +229,7 @@ function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPol
224
229
  const updated = [
225
230
  ...coordinates.slice(0, positionIndexes[0]),
226
231
  positionToAdd,
227
- ...coordinates.slice(positionIndexes[0]),
232
+ ...coordinates.slice(positionIndexes[0])
228
233
  ];
229
234
  return updated;
230
235
  }
@@ -232,7 +237,7 @@ function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPol
232
237
  return [
233
238
  ...coordinates.slice(0, positionIndexes[0]),
234
239
  immutablyAddPosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), positionToAdd, isPolygonal),
235
- ...coordinates.slice(positionIndexes[0] + 1),
240
+ ...coordinates.slice(positionIndexes[0] + 1)
236
241
  ];
237
242
  }
238
243
  function pruneGeometryIfNecessary(geometry) {
@@ -1,5 +1,5 @@
1
1
  import { ClickEvent, PointerMoveEvent, Tooltip, ModeProps, GuideFeatureCollection } from './types';
2
- import { FeatureCollection, Position } from '../geojson-types';
2
+ import { FeatureCollection, Position } from '../utils/geojson-types';
3
3
  import { GeoJsonEditMode } from './geojson-edit-mode';
4
4
  export declare class MeasureAngleMode extends GeoJsonEditMode {
5
5
  _getTooltips: (args: any) => any;
@@ -1,6 +1,6 @@
1
1
  import turfBearing from '@turf/bearing';
2
2
  import turfCenter from '@turf/center';
3
- import memoize from '../memoize';
3
+ import { memoize } from '../utils/memoize';
4
4
  import { GeoJsonEditMode } from './geojson-edit-mode';
5
5
  const DEFAULT_TOOLTIPS = [];
6
6
  export class MeasureAngleMode extends GeoJsonEditMode {
@@ -33,10 +33,10 @@ export class MeasureAngleMode extends GeoJsonEditMode {
33
33
  type: 'Feature',
34
34
  geometry: {
35
35
  type: 'Point',
36
- coordinates: p,
36
+ coordinates: p
37
37
  },
38
38
  properties: {}
39
- })),
39
+ }))
40
40
  }).geometry.coordinates;
41
41
  tooltips = [{ position, text }];
42
42
  }
@@ -71,8 +71,8 @@ export class MeasureAngleMode extends GeoJsonEditMode {
71
71
  properties: { guideType: 'tentative' },
72
72
  geometry: {
73
73
  type: 'LineString',
74
- coordinates: [points[1], points[0], points[2]],
75
- },
74
+ coordinates: [points[1], points[0], points[2]]
75
+ }
76
76
  });
77
77
  }
78
78
  else if (points.length > 1) {
@@ -81,8 +81,8 @@ export class MeasureAngleMode extends GeoJsonEditMode {
81
81
  properties: { guideType: 'tentative' },
82
82
  geometry: {
83
83
  type: 'LineString',
84
- coordinates: [points[1], points[0]],
85
- },
84
+ coordinates: [points[1], points[0]]
85
+ }
86
86
  });
87
87
  }
88
88
  return guides;
@@ -93,7 +93,7 @@ export class MeasureAngleMode extends GeoJsonEditMode {
93
93
  modeConfig: props.modeConfig,
94
94
  vertex: points[0],
95
95
  point1: points[1],
96
- point2: points[2],
96
+ point2: points[2]
97
97
  });
98
98
  }
99
99
  }
@@ -1,5 +1,5 @@
1
1
  import { ClickEvent, Tooltip, ModeProps } from './types';
2
- import { FeatureCollection } from '../geojson-types';
2
+ import { FeatureCollection } from '../utils/geojson-types';
3
3
  import { DrawPolygonMode } from './draw-polygon-mode';
4
4
  export declare class MeasureAreaMode extends DrawPolygonMode {
5
5
  handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void;
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import turfArea from '@turf/area';
2
5
  import turfCentroid from '@turf/centroid';
3
6
  import { DrawPolygonMode } from './draw-polygon-mode';
@@ -6,14 +9,14 @@ export class MeasureAreaMode extends DrawPolygonMode {
6
9
  handleClick(event, props) {
7
10
  const propsWithoutEdit = {
8
11
  ...props,
9
- onEdit: () => { },
12
+ onEdit: () => { }
10
13
  };
11
14
  super.handleClick(event, propsWithoutEdit);
12
15
  }
13
16
  handleKeyUp(event, props) {
14
17
  const propsWithoutEdit = {
15
18
  ...props,
16
- onEdit: () => { },
19
+ onEdit: () => { }
17
20
  };
18
21
  super.handleKeyUp(event, propsWithoutEdit);
19
22
  }
@@ -39,10 +42,9 @@ export class MeasureAreaMode extends DrawPolygonMode {
39
42
  }
40
43
  return [
41
44
  {
42
- // @ts-expect-error turf types diff
43
45
  position: centroid.geometry.coordinates,
44
- text,
45
- },
46
+ text
47
+ }
46
48
  ];
47
49
  }
48
50
  return DEFAULT_TOOLTIPS;
@@ -1,4 +1,4 @@
1
- import { FeatureCollection } from '../geojson-types';
1
+ import { FeatureCollection } from '../utils/geojson-types';
2
2
  import { ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection, Tooltip } from './types';
3
3
  import { GeoJsonEditMode } from './geojson-edit-mode';
4
4
  export declare class MeasureDistanceMode extends GeoJsonEditMode {
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import turfDistance from '@turf/distance';
2
5
  import turfMidpoint from '@turf/midpoint';
3
6
  import { getPickedEditHandle } from './utils';
@@ -58,14 +61,14 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
58
61
  this._currentDistance += this._calculateDistanceForTooltip({
59
62
  positionA: clickSequence[clickSequence.length - 2],
60
63
  positionB: clickSequence[clickSequence.length - 1],
61
- modeConfig,
64
+ modeConfig
62
65
  });
63
66
  const tooltipPosition = centerTooltipsOnLine
64
67
  ? turfMidpoint(clickSequence[clickSequence.length - 2], clickSequence[clickSequence.length - 1]).geometry.coordinates
65
68
  : event.mapCoords;
66
69
  this._currentTooltips.push({
67
70
  position: tooltipPosition,
68
- text: this._formatTooltip(this._currentDistance, modeConfig),
71
+ text: this._formatTooltip(this._currentDistance, modeConfig)
69
72
  });
70
73
  }
71
74
  // new tentative point
@@ -74,8 +77,8 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
74
77
  updatedData: data,
75
78
  editType: 'addTentativePosition',
76
79
  editContext: {
77
- position: event.mapCoords,
78
- },
80
+ position: event.mapCoords
81
+ }
79
82
  });
80
83
  }
81
84
  }
@@ -111,18 +114,18 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
111
114
  : [];
112
115
  const guides = {
113
116
  type: 'FeatureCollection',
114
- features: [],
117
+ features: []
115
118
  };
116
119
  if (clickSequence.length > 0) {
117
120
  guides.features.push({
118
121
  type: 'Feature',
119
122
  properties: {
120
- guideType: 'tentative',
123
+ guideType: 'tentative'
121
124
  },
122
125
  geometry: {
123
126
  type: 'LineString',
124
- coordinates: [...clickSequence, ...lastCoords],
125
- },
127
+ coordinates: [...clickSequence, ...lastCoords]
128
+ }
126
129
  });
127
130
  }
128
131
  const editHandles = clickSequence.map((clickedCoord, index) => ({
@@ -131,12 +134,12 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
131
134
  guideType: 'editHandle',
132
135
  editHandleType: 'existing',
133
136
  featureIndex: -1,
134
- positionIndexes: [index],
137
+ positionIndexes: [index]
135
138
  },
136
139
  geometry: {
137
140
  type: 'Point',
138
- coordinates: clickedCoord,
139
- },
141
+ coordinates: clickedCoord
142
+ }
140
143
  }));
141
144
  guides.features.push(...editHandles);
142
145
  return guides;
@@ -152,7 +155,7 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
152
155
  const distance = this._calculateDistanceForTooltip({
153
156
  positionA: positions[positions.length - 1],
154
157
  positionB: lastPointerMoveEvent.mapCoords,
155
- modeConfig: props.modeConfig,
158
+ modeConfig: props.modeConfig
156
159
  });
157
160
  const tooltipPosition = centerTooltipsOnLine
158
161
  ? turfMidpoint(positions[positions.length - 1], lastPointerMoveEvent.mapCoords).geometry
@@ -162,8 +165,8 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
162
165
  ...this._currentTooltips,
163
166
  {
164
167
  position: tooltipPosition,
165
- text: this._formatTooltip(this._currentDistance + distance, modeConfig),
166
- },
168
+ text: this._formatTooltip(this._currentDistance + distance, modeConfig)
169
+ }
167
170
  ];
168
171
  }
169
172
  return this._currentTooltips;
@@ -1,5 +1,5 @@
1
1
  import { NearestPointType } from './utils';
2
- import { LineString, Point, FeatureCollection, FeatureOf } from '../geojson-types';
2
+ import { LineString, Point, FeatureCollection, FeatureOf } from '../utils/geojson-types';
3
3
  import { ModeProps, ClickEvent, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, Viewport, GuideFeatureCollection, EditHandleFeature } from './types';
4
4
  import { GeoJsonEditMode } from './geojson-edit-mode';
5
5
  export declare class ModifyMode extends GeoJsonEditMode {
@@ -1,5 +1,8 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { point, lineString as toLineString } from '@turf/helpers';
2
- import { recursivelyTraverseNestedArrays, nearestPointOnProjectedLine, nearestPointOnLine, getEditHandlesForGeometry, getPickedEditHandles, getPickedEditHandle, getPickedExistingEditHandle, getPickedIntermediateEditHandle, updateRectanglePosition, } from './utils';
5
+ import { recursivelyTraverseNestedArrays, nearestPointOnProjectedLine, nearestPointOnLine, getEditHandlesForGeometry, getPickedEditHandles, getPickedEditHandle, getPickedExistingEditHandle, getPickedIntermediateEditHandle, updateRectanglePosition } from './utils';
3
6
  import { GeoJsonEditMode } from './geojson-edit-mode';
4
7
  import { ImmutableFeatureCollection } from './immutable-feature-collection';
5
8
  export class ModifyMode extends GeoJsonEditMode {
@@ -46,26 +49,26 @@ export class ModifyMode extends GeoJsonEditMode {
46
49
  });
47
50
  // tack on the lone intermediate point to the set of handles
48
51
  if (intermediatePoint) {
49
- const { geometry: { coordinates: position }, properties: { index }, } = intermediatePoint;
52
+ const { geometry: { coordinates: position }, properties: { index } } = intermediatePoint;
50
53
  handles.push({
51
54
  type: 'Feature',
52
55
  properties: {
53
56
  guideType: 'editHandle',
54
57
  editHandleType: 'intermediate',
55
58
  featureIndex: featureAsPick.index,
56
- positionIndexes: [...positionIndexPrefix, index + 1],
59
+ positionIndexes: [...positionIndexPrefix, index + 1]
57
60
  },
58
61
  geometry: {
59
62
  type: 'Point',
60
- coordinates: position,
61
- },
63
+ coordinates: position
64
+ }
62
65
  });
63
66
  }
64
67
  }
65
68
  }
66
69
  return {
67
70
  type: 'FeatureCollection',
68
- features: handles,
71
+ features: handles
69
72
  };
70
73
  }
71
74
  // turf.js does not support elevation for nearestPointOnLine
@@ -102,8 +105,8 @@ export class ModifyMode extends GeoJsonEditMode {
102
105
  editContext: {
103
106
  featureIndexes: [featureIndex],
104
107
  positionIndexes,
105
- position: pickedExistingHandle.geometry.coordinates,
106
- },
108
+ position: pickedExistingHandle.geometry.coordinates
109
+ }
107
110
  });
108
111
  }
109
112
  }
@@ -122,8 +125,8 @@ export class ModifyMode extends GeoJsonEditMode {
122
125
  editContext: {
123
126
  featureIndexes: [featureIndex],
124
127
  positionIndexes,
125
- position: pickedIntermediateHandle.geometry.coordinates,
126
- },
128
+ position: pickedIntermediateHandle.geometry.coordinates
129
+ }
127
130
  });
128
131
  }
129
132
  }
@@ -158,8 +161,8 @@ export class ModifyMode extends GeoJsonEditMode {
158
161
  editContext: {
159
162
  featureIndexes: [editHandleProperties.featureIndex],
160
163
  positionIndexes: editHandleProperties.positionIndexes,
161
- position: event.mapCoords,
162
- },
164
+ position: event.mapCoords
165
+ }
163
166
  });
164
167
  }
165
168
  handlePointerMove(event, props) {
@@ -180,8 +183,8 @@ export class ModifyMode extends GeoJsonEditMode {
180
183
  editContext: {
181
184
  featureIndexes: [editHandleProperties.featureIndex],
182
185
  positionIndexes: editHandleProperties.positionIndexes,
183
- position: event.mapCoords,
184
- },
186
+ position: event.mapCoords
187
+ }
185
188
  });
186
189
  }
187
190
  }
@@ -1,6 +1,6 @@
1
1
  import { NearestPointType } from './utils';
2
- import { LineString, Point, FeatureCollection, FeatureOf } from '../geojson-types';
3
- import { Viewport } from '../types';
2
+ import { LineString, Point, FeatureCollection, FeatureOf } from '../utils/geojson-types';
3
+ import { Viewport } from '../utils/types';
4
4
  import { ModeProps, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, EditHandleFeature, GuideFeatureCollection } from './types';
5
5
  import { GeoJsonEditMode } from './geojson-edit-mode';
6
6
  export declare class ResizeCircleMode extends GeoJsonEditMode {
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import nearestPointOnLine from '@turf/nearest-point-on-line';
2
5
  import { point, lineString as toLineString } from '@turf/helpers';
3
6
  import circle from '@turf/circle';
@@ -97,7 +100,6 @@ export class ResizeCircleMode extends GeoJsonEditMode {
97
100
  const updatedFeature = circle(center, radius, options);
98
101
  const geometry = updatedFeature.geometry;
99
102
  const updatedData = new ImmutableFeatureCollection(props.data)
100
- // @ts-expect-error turf types diff
101
103
  .replaceGeometry(editHandleProperties.featureIndex, geometry)
102
104
  .getObject();
103
105
  props.onEdit({
@@ -1,5 +1,5 @@
1
1
  import { PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, ModeProps, EditHandleFeature, GuideFeatureCollection } from './types';
2
- import { FeatureCollection, Position } from '../geojson-types';
2
+ import { FeatureCollection, Position } from '../utils/geojson-types';
3
3
  import { GeoJsonEditMode, GeoJsonEditAction } from './geojson-edit-mode';
4
4
  export declare class RotateMode extends GeoJsonEditMode {
5
5
  _selectedEditHandle: EditHandleFeature | null | undefined;
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import bbox from '@turf/bbox';
2
5
  import turfCentroid from '@turf/centroid';
3
6
  import turfBearing from '@turf/bearing';
@@ -56,12 +59,12 @@ export class RotateMode extends GeoJsonEditMode {
56
59
  // relative to the length of the longest edge of the enveloping box
57
60
  const rotateHandleCoords = topEdgeMidpointCoords && [
58
61
  topEdgeMidpointCoords[0],
59
- topEdgeMidpointCoords[1] + longestEdgeLength / 1000,
62
+ topEdgeMidpointCoords[1] + longestEdgeLength / 1000
60
63
  ];
61
64
  const lineFromEnvelopeToRotateHandle = lineString([topEdgeMidpointCoords, rotateHandleCoords]);
62
65
  const rotateHandle = point(rotateHandleCoords, {
63
66
  guideType: 'editHandle',
64
- editHandleType: 'rotate',
67
+ editHandleType: 'rotate'
65
68
  });
66
69
  const outFeatures = [polygonToLine(boundingBox), rotateHandle, lineFromEnvelopeToRotateHandle];
67
70
  // @ts-expect-error turf type diff
@@ -126,7 +129,7 @@ export class RotateMode extends GeoJsonEditMode {
126
129
  const rotatedFeatures = turfTransformRotate(
127
130
  // @ts-expect-error turf types too wide
128
131
  this._geometryBeingRotated, angle, {
129
- pivot: centroid,
132
+ pivot: centroid
130
133
  });
131
134
  let updatedData = new ImmutableFeatureCollection(props.data);
132
135
  const selectedIndexes = props.selectedIndexes;
@@ -139,8 +142,8 @@ export class RotateMode extends GeoJsonEditMode {
139
142
  updatedData: updatedData.getObject(),
140
143
  editType,
141
144
  editContext: {
142
- featureIndexes: selectedIndexes,
143
- },
145
+ featureIndexes: selectedIndexes
146
+ }
144
147
  };
145
148
  }
146
149
  }
@@ -1,4 +1,4 @@
1
- import { FeatureCollection, Position } from '../geojson-types';
1
+ import { FeatureCollection, Position } from '../utils/geojson-types';
2
2
  import { ModeProps, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, EditHandleFeature, GuideFeatureCollection } from './types';
3
3
  import { GeoJsonEditMode } from './geojson-edit-mode';
4
4
  export declare class ScaleMode extends GeoJsonEditMode {
@@ -1,3 +1,6 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import bbox from '@turf/bbox';
2
5
  import turfCentroid from '@turf/centroid';
3
6
  import turfBearing from '@turf/bearing';
@@ -36,12 +39,12 @@ export class ScaleMode extends GeoJsonEditMode {
36
39
  }
37
40
  const guidePointCount = this._cornerGuidePoints.length;
38
41
  const oppositeIndex = (selectedHandleIndex + guidePointCount / 2) % guidePointCount;
39
- return this._cornerGuidePoints.find((p) => {
42
+ return (this._cornerGuidePoints.find((p) => {
40
43
  if (!Array.isArray(p.properties.positionIndexes)) {
41
44
  return false;
42
45
  }
43
46
  return p.properties.positionIndexes[0] === oppositeIndex;
44
- }) || null;
47
+ }) || null);
45
48
  };
46
49
  _getUpdatedData = (props, editedData) => {
47
50
  let updatedData = new ImmutableFeatureCollection(props.data);
@@ -69,8 +72,8 @@ export class ScaleMode extends GeoJsonEditMode {
69
72
  updatedData: this._getUpdatedData(props, scaledFeatures),
70
73
  editType,
71
74
  editContext: {
72
- featureIndexes: props.selectedIndexes,
73
- },
75
+ featureIndexes: props.selectedIndexes
76
+ }
74
77
  };
75
78
  };
76
79
  updateCursor = (props) => {
@@ -156,7 +159,7 @@ export class ScaleMode extends GeoJsonEditMode {
156
159
  const cornerPoint = point(coord, {
157
160
  guideType: 'editHandle',
158
161
  editHandleType: 'scale',
159
- positionIndexes: [coordIndex],
162
+ positionIndexes: [coordIndex]
160
163
  });
161
164
  cornerGuidePoints.push(cornerPoint);
162
165
  }
@@ -1,4 +1,4 @@
1
- import { Feature, FeatureCollection } from '../geojson-types';
1
+ import { Feature, FeatureCollection } from '../utils/geojson-types';
2
2
  import { PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, ModeProps, Pick, GuideFeatureCollection, EditHandleFeature } from './types';
3
3
  import { GeoJsonEditMode } from './geojson-edit-mode';
4
4
  type MovementTypeEvent = PointerMoveEvent | StartDraggingEvent | StopDraggingEvent | DraggingEvent;
@@ -1,4 +1,7 @@
1
- import { getPickedSnapSourceEditHandle, getPickedEditHandles, getEditHandlesForGeometry, } from './utils';
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { getPickedSnapSourceEditHandle, getPickedEditHandles, getEditHandlesForGeometry } from './utils';
2
5
  import { GeoJsonEditMode } from './geojson-edit-mode';
3
6
  export class SnappableMode extends GeoJsonEditMode {
4
7
  _handler;
@@ -9,7 +12,7 @@ export class SnappableMode extends GeoJsonEditMode {
9
12
  _getSnappedMouseEvent(event, snapSource, snapTarget) {
10
13
  return Object.assign(event, {
11
14
  mapCoords: snapTarget.geometry.coordinates,
12
- pointerDownMapCoords: snapSource && snapSource.geometry.coordinates,
15
+ pointerDownMapCoords: snapSource && snapSource.geometry.coordinates
13
16
  });
14
17
  }
15
18
  _getPickedSnapTarget(picks) {
@@ -30,8 +33,8 @@ export class SnappableMode extends GeoJsonEditMode {
30
33
  ...snapSourceHandle,
31
34
  geometry: {
32
35
  type: 'Point',
33
- coordinates: snapSourceCoordinates,
34
- },
36
+ coordinates: snapSourceCoordinates
37
+ }
35
38
  };
36
39
  }
37
40
  // If additionalSnapTargets is present in modeConfig and is populated, this
@@ -65,7 +68,7 @@ export class SnappableMode extends GeoJsonEditMode {
65
68
  const { enableSnapping } = modeConfig || {};
66
69
  const guides = {
67
70
  type: 'FeatureCollection',
68
- features: [...this._handler.getGuides(props).features],
71
+ features: [...this._handler.getGuides(props).features]
69
72
  };
70
73
  if (!enableSnapping) {
71
74
  return guides;
@@ -1,4 +1,4 @@
1
- import { FeatureCollection } from '../geojson-types';
1
+ import { FeatureCollection } from '../utils/geojson-types';
2
2
  import { ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection, TentativeFeature } from './types';
3
3
  import { GeoJsonEditMode, GeoJsonEditAction } from './geojson-edit-mode';
4
4
  export declare class SplitPolygonMode extends GeoJsonEditMode {