@sakuzu/maplibre-gl-draw 1.0.0 → 2.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 (541) hide show
  1. package/CHANGELOG.md +1109 -2
  2. package/README.ja.md +83 -50
  3. package/README.md +89 -53
  4. package/THIRD_PARTY_NOTICES.md +29 -0
  5. package/dist/api/datasets.d.ts +263 -0
  6. package/dist/api/document.d.ts +66 -0
  7. package/dist/api/draw.d.ts +137 -0
  8. package/dist/api/draw.js +20 -0
  9. package/dist/api/drawing.d.ts +87 -0
  10. package/dist/api/errors.d.ts +35 -0
  11. package/dist/api/errors.js +35 -0
  12. package/dist/api/events.d.ts +316 -0
  13. package/dist/api/extension/context.d.ts +247 -0
  14. package/dist/api/extension/feature-type.d.ts +129 -0
  15. package/dist/api/extension/mode.d.ts +123 -0
  16. package/dist/api/extension/plugin.d.ts +51 -0
  17. package/dist/api/extension/plugin.js +3 -0
  18. package/dist/api/extension/provider.d.ts +119 -0
  19. package/dist/api/extension/provider.js +3 -0
  20. package/dist/api/extension/render.d.ts +176 -0
  21. package/dist/api/extension/render.js +3 -0
  22. package/dist/api/extension/store.d.ts +190 -0
  23. package/dist/api/extension/store.js +3 -0
  24. package/dist/api/extensions.d.ts +306 -0
  25. package/dist/api/extensions.js +3 -0
  26. package/dist/api/features.d.ts +188 -0
  27. package/dist/api/features.js +3 -0
  28. package/dist/api/groups.d.ts +111 -0
  29. package/dist/api/groups.js +3 -0
  30. package/dist/api/hidden.d.ts +45 -0
  31. package/dist/api/hidden.js +3 -0
  32. package/dist/api/impl/adapters.js +463 -0
  33. package/dist/api/impl/contexts.js +466 -0
  34. package/dist/api/impl/create-draw.js +124 -0
  35. package/dist/api/impl/datasets.js +405 -0
  36. package/dist/api/impl/destroy-guard.js +74 -0
  37. package/dist/api/impl/document.js +280 -0
  38. package/dist/api/impl/drawing.js +180 -0
  39. package/dist/api/impl/engine-context.d.ts +7 -0
  40. package/dist/api/{context.js → impl/engine-context.js} +49 -38
  41. package/dist/{maplibre-gl-draw.js → api/impl/engine.js} +145 -177
  42. package/dist/api/impl/events.js +423 -0
  43. package/dist/api/impl/extension-host.js +364 -0
  44. package/dist/api/impl/extensions.js +229 -0
  45. package/dist/api/impl/features.js +445 -0
  46. package/dist/api/impl/geometry/apply.d.ts +32 -0
  47. package/dist/api/{geometry → impl/geometry}/apply.js +10 -27
  48. package/dist/api/{geometry → impl/geometry}/buffer.d.ts +4 -3
  49. package/dist/api/{geometry → impl/geometry}/buffer.js +12 -23
  50. package/dist/api/{geometry → impl/geometry}/split.d.ts +4 -3
  51. package/dist/api/{geometry → impl/geometry}/split.js +10 -21
  52. package/dist/api/{geometry → impl/geometry}/targets.d.ts +2 -20
  53. package/dist/api/{geometry → impl/geometry}/targets.js +8 -35
  54. package/dist/api/impl/geometry/types.js +3 -0
  55. package/dist/api/impl/groups.d.ts +3 -0
  56. package/dist/api/impl/groups.js +268 -0
  57. package/dist/api/impl/hidden.js +60 -0
  58. package/dist/api/impl/import-export/constants.d.ts +22 -0
  59. package/dist/api/impl/import-export/constants.js +24 -0
  60. package/dist/api/{import-export → impl/import-export}/embedded-file.js +2 -2
  61. package/dist/api/{import-export → impl/import-export}/format-detection.d.ts +1 -1
  62. package/dist/api/{import-export → impl/import-export}/format-detection.js +2 -1
  63. package/dist/api/impl/import-export/geojson-export.d.ts +19 -0
  64. package/dist/api/{import-export → impl/import-export}/geojson-export.js +71 -104
  65. package/dist/api/{import-export → impl/import-export}/geojson-import.d.ts +11 -7
  66. package/dist/api/{import-export → impl/import-export}/geojson-import.js +139 -97
  67. package/dist/api/{import-export → impl/import-export}/geometry-validation.d.ts +14 -0
  68. package/dist/api/{import-export → impl/import-export}/geometry-validation.js +45 -0
  69. package/dist/api/impl/import-export/image-import.d.ts +16 -0
  70. package/dist/api/impl/import-export/image-import.js +73 -0
  71. package/dist/api/impl/import-export/legacy-image-style.d.ts +16 -0
  72. package/dist/api/impl/import-export/legacy-image-style.js +49 -0
  73. package/dist/api/impl/import-export/native-format.d.ts +14 -0
  74. package/dist/api/{import-export → impl/import-export}/native-format.js +32 -22
  75. package/dist/api/impl/import-export/native-upgrade.d.ts +8 -0
  76. package/dist/api/impl/import-export/native-upgrade.js +139 -0
  77. package/dist/api/{import-export → impl/import-export}/native-validation.d.ts +1 -1
  78. package/dist/api/{import-export → impl/import-export}/native-validation.js +15 -14
  79. package/dist/api/impl/import-export/style-validation.d.ts +24 -0
  80. package/dist/api/impl/import-export/style-validation.js +86 -0
  81. package/dist/api/impl/import-export/types.d.ts +52 -0
  82. package/dist/api/impl/import-export/types.js +3 -0
  83. package/dist/api/impl/input.js +180 -0
  84. package/dist/api/impl/layers.js +307 -0
  85. package/dist/api/impl/metadata.d.ts +1 -0
  86. package/dist/api/impl/metadata.js +22 -0
  87. package/dist/api/impl/options.d.ts +1 -0
  88. package/dist/api/impl/options.js +851 -0
  89. package/dist/api/impl/placement.d.ts +1 -0
  90. package/dist/api/impl/placement.js +138 -0
  91. package/dist/api/impl/render-context.d.ts +13 -0
  92. package/dist/api/impl/render-context.js +272 -0
  93. package/dist/api/impl/rows.d.ts +1 -0
  94. package/dist/api/impl/rows.js +46 -0
  95. package/dist/api/impl/selection.d.ts +1 -0
  96. package/dist/api/impl/selection.js +186 -0
  97. package/dist/api/impl/shared.d.ts +64 -0
  98. package/dist/api/impl/shared.js +178 -0
  99. package/dist/api/impl/validate-extension.d.ts +1 -0
  100. package/dist/api/impl/validate-extension.js +159 -0
  101. package/dist/api/layers.d.ts +130 -0
  102. package/dist/api/layers.js +3 -0
  103. package/dist/api/metadata.d.ts +18 -0
  104. package/dist/api/metadata.js +3 -0
  105. package/dist/api/model.d.ts +487 -0
  106. package/dist/api/model.js +47 -0
  107. package/dist/api/options.d.ts +466 -0
  108. package/dist/api/options.js +3 -0
  109. package/dist/api/selection.d.ts +94 -0
  110. package/dist/api/selection.js +3 -0
  111. package/dist/api/state.d.ts +155 -0
  112. package/dist/api/state.js +12 -0
  113. package/dist/{display → dataset}/chunk.d.ts +1 -1
  114. package/dist/{display → dataset}/chunk.js +4 -3
  115. package/dist/{display → dataset}/dataset.js +21 -21
  116. package/dist/dataset/interaction.d.ts +1 -0
  117. package/dist/{display → dataset}/interaction.js +18 -6
  118. package/dist/dataset/manager.d.ts +1 -0
  119. package/dist/dataset/provider.d.ts +1 -0
  120. package/dist/{display → dataset}/retained.d.ts +1 -1
  121. package/dist/{display → dataset}/retained.js +8 -7
  122. package/dist/dataset/source.d.ts +1 -0
  123. package/dist/{display → dataset}/source.js +17 -4
  124. package/dist/dataset/spatial.d.ts +1 -0
  125. package/dist/{display → dataset}/spatial.js +1 -1
  126. package/dist/dataset/style.d.ts +1 -0
  127. package/dist/{display → dataset}/style.js +1 -1
  128. package/dist/dataset/table-source.d.ts +1 -0
  129. package/dist/{display/columnar/source.js → dataset/table-source.js} +53 -25
  130. package/dist/{display → dataset}/thinning.d.ts +0 -10
  131. package/dist/{display → dataset}/thinning.js +3 -2
  132. package/dist/dataset/triangulation.d.ts +1 -0
  133. package/dist/{display → dataset}/triangulation.js +0 -0
  134. package/dist/{display → dataset}/types.d.ts +84 -121
  135. package/dist/dataset/types.js +61 -0
  136. package/dist/dispatcher/hit-test/box-strategies.js +13 -13
  137. package/dist/dispatcher/hit-test/box-strategy.d.ts +2 -15
  138. package/dist/dispatcher/hit-test/globe-shape.js +5 -4
  139. package/dist/dispatcher/hit-test/service.d.ts +17 -0
  140. package/dist/dispatcher/hit-test/service.js +80 -16
  141. package/dist/dispatcher/hit-test/strategies/base.d.ts +13 -19
  142. package/dist/dispatcher/hit-test/strategies/circle.js +3 -2
  143. package/dist/dispatcher/hit-test/strategies/image.js +6 -18
  144. package/dist/dispatcher/hit-test/strategies/line.d.ts +0 -6
  145. package/dist/dispatcher/hit-test/strategies/line.js +9 -2
  146. package/dist/dispatcher/hit-test/strategies/multi.d.ts +0 -8
  147. package/dist/dispatcher/hit-test/strategies/multi.js +17 -8
  148. package/dist/dispatcher/hit-test/strategies/point.d.ts +9 -7
  149. package/dist/dispatcher/hit-test/strategies/point.js +8 -4
  150. package/dist/dispatcher/hit-test/strategies/polygon.d.ts +0 -7
  151. package/dist/dispatcher/hit-test/strategies/polygon.js +11 -3
  152. package/dist/dispatcher/hit-test/topmost.d.ts +1 -1
  153. package/dist/dispatcher/input-router.js +154 -70
  154. package/dist/dispatcher/normalizer.js +25 -4
  155. package/dist/dispatcher/types.d.ts +6 -1
  156. package/dist/extension/feature-handler.d.ts +1 -182
  157. package/dist/extension/index.d.ts +4 -7
  158. package/dist/extension/renderers.d.ts +1 -208
  159. package/dist/geometry/angle.d.ts +0 -8
  160. package/dist/geometry/angle.js +0 -8
  161. package/dist/geometry/bbox.d.ts +4 -12
  162. package/dist/geometry/bbox.js +4 -12
  163. package/dist/geometry/boolean.d.ts +0 -51
  164. package/dist/geometry/boolean.js +0 -51
  165. package/dist/geometry/buffer.d.ts +0 -26
  166. package/dist/geometry/buffer.js +0 -26
  167. package/dist/geometry/circle.d.ts +0 -9
  168. package/dist/geometry/circle.js +0 -9
  169. package/dist/geometry/coords.d.ts +0 -16
  170. package/dist/geometry/coords.js +0 -16
  171. package/dist/geometry/distance.d.ts +0 -24
  172. package/dist/geometry/distance.js +0 -24
  173. package/dist/geometry/errors.d.ts +21 -36
  174. package/dist/geometry/errors.js +49 -29
  175. package/dist/geometry/geojson.d.ts +85 -0
  176. package/dist/geometry/geojson.js +173 -0
  177. package/dist/geometry/index.d.ts +38 -23
  178. package/dist/geometry/index.js +43 -31
  179. package/dist/geometry/measure.d.ts +0 -27
  180. package/dist/geometry/measure.js +0 -27
  181. package/dist/geometry/predicates.d.ts +0 -9
  182. package/dist/geometry/predicates.js +0 -9
  183. package/dist/geometry/public-bounds.d.ts +26 -0
  184. package/dist/geometry/public-bounds.js +30 -0
  185. package/dist/geometry/public-combine.d.ts +78 -0
  186. package/dist/geometry/public-combine.js +82 -0
  187. package/dist/geometry/public-create.d.ts +54 -0
  188. package/dist/geometry/public-create.js +70 -0
  189. package/dist/geometry/public-measure.d.ts +170 -0
  190. package/dist/geometry/public-measure.js +283 -0
  191. package/dist/geometry/public-predicates.d.ts +54 -0
  192. package/dist/geometry/public-predicates.js +144 -0
  193. package/dist/geometry/public-repair.d.ts +75 -0
  194. package/dist/geometry/public-repair.js +77 -0
  195. package/dist/geometry/simplify.d.ts +0 -7
  196. package/dist/geometry/simplify.js +0 -7
  197. package/dist/geometry/split.d.ts +0 -20
  198. package/dist/geometry/split.js +0 -20
  199. package/dist/geometry/units.d.ts +20 -12
  200. package/dist/geometry/units.js +20 -12
  201. package/dist/index.d.ts +66 -66
  202. package/dist/index.js +6 -18
  203. package/dist/messages.d.ts +7 -7
  204. package/dist/modes/draw/circle.js +83 -207
  205. package/dist/modes/draw/commit-layer.d.ts +5 -16
  206. package/dist/modes/draw/commit-layer.js +2 -13
  207. package/dist/modes/draw/freehand.js +108 -246
  208. package/dist/modes/draw/image.js +4 -2
  209. package/dist/modes/draw/index.d.ts +5 -5
  210. package/dist/modes/draw/index.js +5 -5
  211. package/dist/modes/draw/line.js +18 -354
  212. package/dist/modes/draw/point.js +29 -78
  213. package/dist/modes/draw/polygon.js +23 -368
  214. package/dist/modes/draw/trace-support.d.ts +43 -36
  215. package/dist/modes/draw/trace-support.js +95 -98
  216. package/dist/modes/draw/vertex-drawing.d.ts +1 -0
  217. package/dist/modes/draw/vertex-drawing.js +176 -0
  218. package/dist/modes/handler.d.ts +1 -285
  219. package/dist/modes/manager.d.ts +2 -2
  220. package/dist/modes/manager.js +3 -0
  221. package/dist/modes/select/box-selection.d.ts +3 -3
  222. package/dist/modes/select/box-selection.js +2 -1
  223. package/dist/modes/select/click-handler.d.ts +5 -5
  224. package/dist/modes/select/click-handler.js +22 -20
  225. package/dist/modes/select/cursor-handler.d.ts +2 -2
  226. package/dist/modes/select/drag/intermediate-writes.js +1 -1
  227. package/dist/modes/select/drag/move.js +3 -3
  228. package/dist/modes/select/drag/operation.d.ts +3 -3
  229. package/dist/modes/select/drag/radius.js +5 -4
  230. package/dist/modes/select/drag/transform.d.ts +2 -2
  231. package/dist/modes/select/drag/transform.js +11 -5
  232. package/dist/modes/select/drag/vertex.d.ts +2 -2
  233. package/dist/modes/select/drag/vertex.js +13 -8
  234. package/dist/modes/select/drag-handler.js +44 -25
  235. package/dist/modes/select/mode.js +17 -17
  236. package/dist/modes/select/shortcut-handler.d.ts +8 -8
  237. package/dist/modes/select/shortcut-handler.js +9 -7
  238. package/dist/operations/layer-operations.js +29 -168
  239. package/dist/operations/resize.d.ts +2 -2
  240. package/dist/operations/resize.js +5 -5
  241. package/dist/operations/rotate.js +5 -5
  242. package/dist/operations/selection-operations.d.ts +16 -1
  243. package/dist/operations/selection-operations.js +28 -13
  244. package/dist/operations/shared-vertex.js +4 -2
  245. package/dist/operations/trace-graph.d.ts +0 -18
  246. package/dist/operations/trace-graph.js +0 -18
  247. package/dist/operations/vertex.js +36 -35
  248. package/dist/shared/color.d.ts +1 -0
  249. package/dist/shared/color.js +245 -0
  250. package/dist/shared/config/constants.d.ts +1 -54
  251. package/dist/shared/config/constants.js +1 -58
  252. package/dist/shared/config/feature-style.d.ts +16 -13
  253. package/dist/shared/config/feature-style.js +9 -0
  254. package/dist/shared/config/rendering.d.ts +3 -3
  255. package/dist/shared/config/selection-highlight.d.ts +0 -15
  256. package/dist/shared/config/selection-highlight.js +4 -7
  257. package/dist/shared/config/selection.d.ts +2 -32
  258. package/dist/shared/config/selection.js +0 -18
  259. package/dist/shared/config/topology.d.ts +2 -2
  260. package/dist/shared/config/trace.d.ts +4 -4
  261. package/dist/shared/math/angle.d.ts +1 -1
  262. package/dist/shared/math/angle.js +1 -1
  263. package/dist/shared/math/circle.d.ts +1 -1
  264. package/dist/shared/math/circle.js +1 -1
  265. package/dist/shared/math/distance.d.ts +2 -1
  266. package/dist/shared/math/distance.js +3 -2
  267. package/dist/shared/math/index.d.ts +1 -1
  268. package/dist/shared/math/index.js +1 -1
  269. package/dist/shared/math/transform.d.ts +23 -0
  270. package/dist/shared/math/transform.js +47 -28
  271. package/dist/shared/properties.d.ts +18 -0
  272. package/dist/shared/properties.js +129 -0
  273. package/dist/shared/types/events.d.ts +15 -7
  274. package/dist/shared/types/model.d.ts +109 -159
  275. package/dist/shared/types/style.d.ts +1 -1
  276. package/dist/shared/utils/color.d.ts +2 -36
  277. package/dist/shared/utils/color.js +13 -70
  278. package/dist/shared/utils/coordinates.d.ts +30 -4
  279. package/dist/shared/utils/coordinates.js +56 -10
  280. package/dist/shared/utils/event-emitter.d.ts +1 -262
  281. package/dist/shared/utils/event-emitter.js +4 -3
  282. package/dist/shared/utils/feature-bbox.js +8 -7
  283. package/dist/shared/utils/feature-segments.js +5 -4
  284. package/dist/shared/utils/image.d.ts +0 -4
  285. package/dist/shared/utils/image.js +0 -6
  286. package/dist/shared/utils/name-generator.d.ts +14 -20
  287. package/dist/shared/utils/name-generator.js +20 -3
  288. package/dist/shared/utils/pixel-ratio.d.ts +9 -3
  289. package/dist/shared/utils/pixel-ratio.js +13 -4
  290. package/dist/shared/utils/property.d.ts +7 -50
  291. package/dist/shared/utils/property.js +22 -87
  292. package/dist/snapping/custom-targets.js +21 -4
  293. package/dist/snapping/indicator.js +20 -11
  294. package/dist/snapping/providers/display.d.ts +6 -1
  295. package/dist/snapping/providers/display.js +2 -1
  296. package/dist/snapping/providers/guide.d.ts +3 -43
  297. package/dist/snapping/providers/guide.js +1 -44
  298. package/dist/snapping/providers/intersection.js +1 -1
  299. package/dist/snapping/providers/store.js +3 -3
  300. package/dist/snapping/service.js +18 -7
  301. package/dist/snapping/types.d.ts +9 -35
  302. package/dist/store/draw-store.js +233 -142
  303. package/dist/store/local-visibility.d.ts +11 -6
  304. package/dist/store/local-visibility.js +38 -7
  305. package/dist/store/lock.d.ts +0 -6
  306. package/dist/store/lock.js +0 -6
  307. package/dist/store/memory/change-bus.d.ts +3 -3
  308. package/dist/store/memory/change-bus.js +12 -0
  309. package/dist/store/memory/file-store.d.ts +2 -2
  310. package/dist/store/memory/ui-state.d.ts +1 -51
  311. package/dist/store/memory/ui-state.js +122 -134
  312. package/dist/store/memory.d.ts +1 -8
  313. package/dist/store/memory.js +249 -45
  314. package/dist/store/ordering.d.ts +9 -0
  315. package/dist/store/ordering.js +17 -0
  316. package/dist/store/spatial/spatial-index.d.ts +1 -1
  317. package/dist/store/spatial/spatial-index.js +1 -1
  318. package/dist/store/spatial/store-spatial-index.d.ts +3 -1
  319. package/dist/store/spatial/store-spatial-index.js +9 -3
  320. package/dist/store/store.d.ts +66 -107
  321. package/dist/store/types.d.ts +1 -1
  322. package/dist/store/writable-layer.d.ts +1 -1
  323. package/dist/store/writable-layer.js +2 -2
  324. package/dist/table/builder.d.ts +83 -0
  325. package/dist/table/builder.js +381 -0
  326. package/dist/table/index.d.ts +37 -0
  327. package/dist/table/index.js +5 -0
  328. package/dist/table/packed-rtree.d.ts +1 -0
  329. package/dist/{display → table}/packed-rtree.js +1 -1
  330. package/dist/table/partition.d.ts +1 -0
  331. package/dist/{display → table}/partition.js +3 -3
  332. package/dist/table/prepare.d.ts +44 -0
  333. package/dist/table/prepare.js +136 -0
  334. package/dist/table/table.d.ts +1 -0
  335. package/dist/{display/columnar → table}/table.js +29 -25
  336. package/dist/{display/columnar → table}/types.d.ts +68 -72
  337. package/dist/table/types.js +3 -0
  338. package/dist/view/coordinator.js +4 -3
  339. package/dist/view/feature-companion.d.ts +13 -7
  340. package/dist/view/feature-companion.js +11 -3
  341. package/dist/view/globe-subdivision.js +3 -3
  342. package/dist/view/layer/attach.d.ts +12 -6
  343. package/dist/view/layer/attach.js +86 -10
  344. package/dist/view/layer/custom-layer.js +40 -11
  345. package/dist/view/layer/display-list.js +2 -1
  346. package/dist/view/layer/drape-planner.d.ts +2 -2
  347. package/dist/view/layer/frame-render.d.ts +3 -3
  348. package/dist/view/layer/frame-render.js +7 -2
  349. package/dist/view/layer/frame-state.d.ts +6 -6
  350. package/dist/view/layer/index.d.ts +2 -2
  351. package/dist/view/layer/index.js +1 -1
  352. package/dist/view/layer/render.d.ts +4 -4
  353. package/dist/view/layer/render.js +3 -8
  354. package/dist/view/layer/renderers.d.ts +2 -2
  355. package/dist/view/layer/renderers.js +1 -1
  356. package/dist/view/layer/slot-manager.d.ts +2 -2
  357. package/dist/view/layer/slot-manager.js +4 -4
  358. package/dist/view/layer/slots.d.ts +2 -2
  359. package/dist/view/layer/slots.js +1 -1
  360. package/dist/view/layer/store-retained-bbox.js +3 -2
  361. package/dist/view/layer/store-retained-classify.d.ts +5 -7
  362. package/dist/view/layer/store-retained-classify.js +19 -7
  363. package/dist/view/layer/store-retained-collect.js +8 -7
  364. package/dist/view/layer/store-retained-coord-patch.d.ts +0 -8
  365. package/dist/view/layer/store-retained-coord-patch.js +13 -4
  366. package/dist/view/layer/store-retained-immediate.d.ts +3 -3
  367. package/dist/view/layer/store-retained-immediate.js +3 -8
  368. package/dist/view/layer/store-retained-invalidation.d.ts +2 -2
  369. package/dist/view/layer/store-retained.d.ts +2 -2
  370. package/dist/view/layer/store-retained.js +1 -1
  371. package/dist/view/renderers/batch-manager.js +8 -7
  372. package/dist/view/renderers/drawer.js +21 -15
  373. package/dist/view/renderers/image.js +13 -39
  374. package/dist/view/renderers/line/line-types.d.ts +3 -3
  375. package/dist/view/renderers/line/sdf-line.js +3 -1
  376. package/dist/view/renderers/point/billboard-depth.js +1 -1
  377. package/dist/view/renderers/point/point-instance.js +1 -1
  378. package/dist/view/renderers/point/point-shape.js +2 -2
  379. package/dist/view/renderers/point/point-style.js +48 -4
  380. package/dist/view/renderers/polygon/batch.js +1 -2
  381. package/dist/view/renderers/polygon/fill.js +3 -1
  382. package/dist/view/renderers/polygon/sdf-polygon.js +2 -3
  383. package/dist/view/renderers/polygon/triangulator.d.ts +1 -1
  384. package/dist/view/renderers/stroke.js +3 -1
  385. package/dist/view/shaders/helpers.d.ts +2 -42
  386. package/dist/view/shaders/helpers.js +0 -6
  387. package/dist/view/shaders/projection.d.ts +15 -7
  388. package/dist/view/shaders/projection.js +23 -6
  389. package/dist/view/shaders/quad.d.ts +16 -12
  390. package/dist/view/shaders/quad.js +34 -13
  391. package/dist/view/style-rule.d.ts +5 -42
  392. package/dist/view/style-rule.js +20 -44
  393. package/dist/view/terrain/binding.d.ts +1 -0
  394. package/dist/view/terrain/binding.js +29 -0
  395. package/dist/view/terrain/context.d.ts +3 -4
  396. package/dist/view/terrain/context.js +4 -5
  397. package/dist/view/terrain/drape/geometry.js +1 -1
  398. package/dist/view/terrain/drape/pass.d.ts +1 -1
  399. package/dist/view/terrain/drape/pass.js +8 -7
  400. package/dist/view/terrain/polygon.d.ts +9 -5
  401. package/dist/view/terrain/polygon.js +16 -2
  402. package/dist/view/terrain/state.d.ts +1 -1
  403. package/dist/view/terrain/state.js +1 -1
  404. package/dist/view/terrain/tessellation.d.ts +2 -2
  405. package/dist/view/terrain/tessellation.js +1 -1
  406. package/dist/view/ui/auxiliary-handles.d.ts +6 -29
  407. package/dist/view/ui/bounds.js +8 -12
  408. package/dist/view/ui/handle-test.js +2 -2
  409. package/dist/view/ui/handle-thinning.js +17 -17
  410. package/dist/view/ui/handles.js +21 -13
  411. package/dist/view/ui/helper.d.ts +1 -1
  412. package/dist/view/ui/helper.js +1 -1
  413. package/dist/view/ui/index.d.ts +1 -1
  414. package/dist/view/ui/selection-scope.js +4 -2
  415. package/dist/view/ui/selection-ui/bounding-box.js +6 -6
  416. package/dist/view/ui/selection-ui/extension-registry.d.ts +31 -20
  417. package/dist/view/ui/selection-ui/extension-registry.js +70 -7
  418. package/dist/view/ui/selection-ui/index.d.ts +2 -2
  419. package/dist/view/ui/selection-ui/index.js +1 -1
  420. package/dist/view/ui/selection-ui/renderer.js +15 -38
  421. package/dist/view/ui/selection-ui/types.d.ts +17 -2
  422. package/dist/view/ui/selection-ui-drawer.d.ts +8 -0
  423. package/dist/view/ui/selection-ui-drawer.js +63 -2
  424. package/dist/view/ui/tentative.js +1 -1
  425. package/dist/webgl/index.d.ts +65 -0
  426. package/dist/webgl/index.js +62 -0
  427. package/package.json +38 -15
  428. package/dist/api/api.d.ts +0 -1259
  429. package/dist/api/api.js +0 -86
  430. package/dist/api/context.d.ts +0 -173
  431. package/dist/api/display-api.js +0 -23
  432. package/dist/api/event-api.d.ts +0 -13
  433. package/dist/api/event-api.js +0 -17
  434. package/dist/api/extension-api.d.ts +0 -46
  435. package/dist/api/extension-api.js +0 -85
  436. package/dist/api/feature-api.d.ts +0 -11
  437. package/dist/api/feature-api.js +0 -101
  438. package/dist/api/geometry/apply.d.ts +0 -51
  439. package/dist/api/geometry/boolean.d.ts +0 -28
  440. package/dist/api/geometry/boolean.js +0 -65
  441. package/dist/api/geometry/types.d.ts +0 -31
  442. package/dist/api/geometry-operations.d.ts +0 -162
  443. package/dist/api/geometry-operations.js +0 -94
  444. package/dist/api/group-api.d.ts +0 -10
  445. package/dist/api/group-api.js +0 -78
  446. package/dist/api/import-export/constants.d.ts +0 -29
  447. package/dist/api/import-export/constants.js +0 -40
  448. package/dist/api/import-export/file-name.d.ts +0 -10
  449. package/dist/api/import-export/file-name.js +0 -20
  450. package/dist/api/import-export/geojson-export.d.ts +0 -19
  451. package/dist/api/import-export/image-import.d.ts +0 -12
  452. package/dist/api/import-export/image-import.js +0 -53
  453. package/dist/api/import-export/index.d.ts +0 -9
  454. package/dist/api/import-export/index.js +0 -107
  455. package/dist/api/import-export/native-format.d.ts +0 -15
  456. package/dist/api/import-export/style-validation.d.ts +0 -27
  457. package/dist/api/import-export/style-validation.js +0 -49
  458. package/dist/api/import-export/types.d.ts +0 -26
  459. package/dist/api/index.d.ts +0 -15
  460. package/dist/api/index.js +0 -3
  461. package/dist/api/input-api.d.ts +0 -158
  462. package/dist/api/input-api.js +0 -144
  463. package/dist/api/instance-api.d.ts +0 -38
  464. package/dist/api/instance-api.js +0 -136
  465. package/dist/api/layer-api.d.ts +0 -12
  466. package/dist/api/layer-api.js +0 -62
  467. package/dist/api/selection-api.d.ts +0 -7
  468. package/dist/api/selection-api.js +0 -78
  469. package/dist/api/snapping-api.d.ts +0 -125
  470. package/dist/api/snapping-api.js +0 -50
  471. package/dist/api/topology-api.d.ts +0 -30
  472. package/dist/api/topology-api.js +0 -16
  473. package/dist/api/tracing-api.d.ts +0 -31
  474. package/dist/api/tracing-api.js +0 -16
  475. package/dist/dispatcher/hit-test/index.d.ts +0 -14
  476. package/dist/dispatcher/hit-test/index.js +0 -9
  477. package/dist/dispatcher/index.d.ts +0 -15
  478. package/dist/dispatcher/index.js +0 -3
  479. package/dist/display/columnar/index.d.ts +0 -12
  480. package/dist/display/columnar/index.js +0 -13
  481. package/dist/display/columnar/prepare.d.ts +0 -42
  482. package/dist/display/columnar/prepare.js +0 -116
  483. package/dist/display/index.d.ts +0 -13
  484. package/dist/display/types.js +0 -43
  485. package/dist/maplibre-gl-draw.d.ts +0 -47
  486. package/dist/modes/cursor.js +0 -72
  487. package/dist/modes/index.d.ts +0 -7
  488. package/dist/operations/index.d.ts +0 -9
  489. package/dist/operations/index.js +0 -3
  490. package/dist/plugins/index.d.ts +0 -10
  491. package/dist/plugins/mutation-hooks.d.ts +0 -28
  492. package/dist/plugins/mutation-hooks.js +0 -84
  493. package/dist/plugins/plugin-context.js +0 -367
  494. package/dist/plugins/plugin-manager.d.ts +0 -103
  495. package/dist/plugins/plugin-manager.js +0 -316
  496. package/dist/plugins/plugin.d.ts +0 -529
  497. package/dist/shared/config/index.d.ts +0 -17
  498. package/dist/shared/config/index.js +0 -8
  499. package/dist/shared/utils/index.d.ts +0 -15
  500. package/dist/shared/utils/index.js +0 -24
  501. package/dist/snapping/index.d.ts +0 -14
  502. package/dist/snapping/index.js +0 -4
  503. package/dist/store/change-merger.js +0 -102
  504. package/dist/store/event-bridge.js +0 -161
  505. package/dist/store/index.d.ts +0 -12
  506. package/dist/store/index.js +0 -4
  507. package/dist/view/index.d.ts +0 -47
  508. package/dist/view/index.js +0 -20
  509. /package/dist/api/{geometry/types.js → datasets.js} +0 -0
  510. /package/dist/api/{import-export/types.js → document.js} +0 -0
  511. /package/dist/{display/columnar/types.js → api/drawing.js} +0 -0
  512. /package/dist/{display/index.js → api/events.js} +0 -0
  513. /package/dist/{modes/index.js → api/extension/context.js} +0 -0
  514. /package/dist/{plugins/index.js → api/extension/feature-type.js} +0 -0
  515. /package/dist/{plugins/plugin.js → api/extension/mode.js} +0 -0
  516. /package/dist/api/{display-api.d.ts → impl/adapters.d.ts} +0 -0
  517. /package/dist/{display/columnar/source.d.ts → api/impl/contexts.d.ts} +0 -0
  518. /package/dist/{display/columnar/table.d.ts → api/impl/create-draw.d.ts} +0 -0
  519. /package/dist/{display/interaction.d.ts → api/impl/datasets.d.ts} +0 -0
  520. /package/dist/{display/manager.d.ts → api/impl/destroy-guard.d.ts} +0 -0
  521. /package/dist/{display/packed-rtree.d.ts → api/impl/document.d.ts} +0 -0
  522. /package/dist/{display/partition.d.ts → api/impl/drawing.d.ts} +0 -0
  523. /package/dist/{display/provider.d.ts → api/impl/engine.d.ts} +0 -0
  524. /package/dist/{display/source.d.ts → api/impl/events.d.ts} +0 -0
  525. /package/dist/{display/spatial.d.ts → api/impl/extension-host.d.ts} +0 -0
  526. /package/dist/{display/style.d.ts → api/impl/extensions.d.ts} +0 -0
  527. /package/dist/{display/triangulation.d.ts → api/impl/features.d.ts} +0 -0
  528. /package/dist/{modes/cursor.d.ts → api/impl/geometry/types.d.ts} +0 -0
  529. /package/dist/{plugins/plugin-context.d.ts → api/impl/hidden.d.ts} +0 -0
  530. /package/dist/api/{import-export → impl/import-export}/embedded-file.d.ts +0 -0
  531. /package/dist/api/{import-export → impl/import-export}/own-property.d.ts +0 -0
  532. /package/dist/api/{import-export → impl/import-export}/own-property.js +0 -0
  533. /package/dist/{store/change-merger.d.ts → api/impl/input.d.ts} +0 -0
  534. /package/dist/{store/event-bridge.d.ts → api/impl/layers.d.ts} +0 -0
  535. /package/dist/{display → dataset}/chunk-set.d.ts +0 -0
  536. /package/dist/{display → dataset}/chunk-set.js +0 -0
  537. /package/dist/{display → dataset}/dataset.d.ts +0 -0
  538. /package/dist/{display → dataset}/manager.js +0 -0
  539. /package/dist/{display → dataset}/provider.js +0 -0
  540. /package/dist/{display → dataset}/selection.d.ts +0 -0
  541. /package/dist/{display → dataset}/selection.js +0 -0
package/CHANGELOG.md CHANGED
@@ -6,12 +6,1119 @@ the project follows semantic versioning.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.1.0] - 2026-10-01
10
+
11
+ The standard UI package, the documentation site with twenty examples and
12
+ the playground on it, the event `options.changed`,
13
+ `Dataset.getStyleRule()`, and fixes to the order of the layers after a
14
+ diffed `setStyle`, to a drag across the antimeridian on the globe, to the
15
+ `/geometry` functions given a feature, and to `scaleWithZoom` changed at
16
+ runtime. Nothing changes incompatibly.
17
+
18
+ ### Added in 2.1.0
19
+
20
+ - The event `options.changed`, with `{ options, previous }`: what
21
+ `draw.options.get()` returns after and before a `draw.options.update`
22
+ that changed a value. An update that changes nothing fires nothing,
23
+ and the event is not a change of the document, so it fires no
24
+ `document.changed`.
25
+ - Twenty examples built with the standard UI, each with its page
26
+ on the site: `get-started`, `style-features`, `feature-properties`,
27
+ `layers-and-groups`, `style-rules-and-legend`, `snapping-and-tracing`,
28
+ `geometry-operations`, `images`, `editing-shapes`, `zoom-and-scale`,
29
+ `save-and-load`, `terrain`, `globe`, `200000-features`, `datasets`,
30
+ `columnar-data-in-a-worker`, `read-only-viewer`, `plugins`,
31
+ `custom-feature-types` and `custom-ui`. Their basemap menu offers the
32
+ OpenFreeMap styles.
33
+ - A sample of Overture Maps data for the examples, in
34
+ `examples/public/data/` (not in the package): the 10,477 buildings and
35
+ the 17,558 places of central Tokyo east of the station, as GeoJSON and
36
+ GeoParquet. `npm run data:overture` (`scripts/fetch-overture-sample.mjs`)
37
+ writes them again. The buildings are under the ODbL and the places
38
+ under the CDLA Permissive 2.0;
39
+ `THIRD_PARTY_NOTICES.md` and `examples/public/data/README.md` record
40
+ the attribution and the licenses of every source. The `datasets`,
41
+ `columnar-data-in-a-worker` and `style-rules-and-legend` examples show
42
+ them.
43
+ - `Dataset.getStyleRule()`, the style rule of a dataset: the
44
+ one last given to `setStyleRule`, or the one given to `datasets.add`,
45
+ or `undefined` when there is none. A legend of the datasets reads it.
46
+
47
+ ### Changed in 2.1.0
48
+
49
+ - The site (<https://sakuzu.github.io/maplibre-gl-draw/>) is
50
+ the documentation site: getting started and the guides in English and
51
+ Japanese, a gallery of the examples, each on a page that runs it
52
+ beside its code, the playground under `/playground/` and the API
53
+ reference under `/api/`, which opens with where each resource of
54
+ `Draw` is. The examples with buttons of their own (`basic`,
55
+ `save-load`, `style-rules`, `snapping-and-geometry`, `read-only`,
56
+ `plugin`, `custom-feature-type`, `large-data` and `table-worker`) are
57
+ replaced by the examples of the gallery, and their addresses, like
58
+ those of the HTML pages of the API reference of 1.0 and 2.0, redirect
59
+ to the pages that took their place. `npm run site:dev` serves the site
60
+ with the examples and the playground for a local check.
61
+ - The playground is built on the standard UI, with the tools
62
+ and the inspector sections of a plugin and of a custom feature type,
63
+ and the switches that are not tools on Shift and a letter. It opens on
64
+ an overview of every look one layer can hold; `?plain` opens it empty.
65
+ - The dev server of the examples (`npm run dev`) moves from
66
+ port 3000 to 3200, and that of the playground
67
+ (`npm run dev:playground`) from 3001 to 3300. They and
68
+ `npm run test:e2e` need the standard UI built first
69
+ (`npm run ui:build`).
70
+ - No sample geometry of the examples, the scenes of the
71
+ playground or the development page of the standard UI lies over the
72
+ Imperial Palace, its East Gardens or Kitanomaru Park. Each page keeps
73
+ its data in a `data.ts` of its own, and a test walks all of it and
74
+ fails when anything reaches into that area.
75
+
76
+ ### Fixed in 2.1.0
77
+
78
+ - After `map.setStyle` in its default diff mode, the drawing is
79
+ on top of the map again. maplibre leaves custom layers out of the
80
+ style it diffs, so the layers of the new style were added above the
81
+ drawing and hid it. The layers of the instance now move back on top on
82
+ every `style.load`, in their order, with the map layers placed between
83
+ them; a full `setStyle` (`diff: false`) works as before.
84
+ - `draw.options.update({ scaleWithZoom })` reaches the drawing
85
+ modes at once. They kept the value given to `createDraw`, so a feature
86
+ drawn after the option was turned off still got a reference zoom
87
+ (`maplibre-gl-draw:createdZoom`), and one drawn after it was turned on
88
+ got none.
89
+ - The functions of `/geometry` take a feature of the drawing as it
90
+ is, as documented. A feature whose `type` names a geometry type
91
+ (`Polygon`, `LineString` and so on) was read as a geometry and threw a
92
+ `GeometryError` (`invalid-input`); an object with a `geometry` member
93
+ that is a geometry is now read as a feature first, whatever its own
94
+ `type`.
95
+ - On the globe, a freehand stroke drawn across the antimeridian is
96
+ drawn as the stroke alone. The globe gives the pointer longitudes in
97
+ [-180, 180], so where the pointer crossed the line (or slid along the
98
+ edge of the sphere past it) the next point of the stroke was 360
99
+ degrees from the one before, and a line went once round the globe
100
+ along the parallel. The coordinates of a press now run on past 180 as
101
+ they do on the flat map.
102
+
103
+ ## [2.0.0] - 2026-09-30
104
+
105
+ 2.0.0 redesigns the public API around resources and their collections.
106
+ Every name of 1.0 changes, and no deprecated alias is kept, so code
107
+ written for 1.0 has to be migrated: the
108
+ [migration guide](docs/guides/migrating.md) walks through it and the
109
+ tables below list every name. The package has four entries: the main
110
+ entry `@sakuzu/maplibre-gl-draw` (the instance, the model and the
111
+ extension contract, all under semver), `/geometry`, `/table`, and
112
+ `/webgl` (the building blocks for custom shaders, which may change in a
113
+ minor release). The native file format is 3.0.0, and files of 2.x are
114
+ upgraded when they are loaded. The GeoJSON export writes the values of
115
+ the library in `properties` under the `maplibre-gl-draw:` prefix.
116
+
117
+ ### Added
118
+
119
+ - `draw.once` and `draw.transact(fn, { source, ignoreLocks })`; with
120
+ `ignoreLocks` the writes of `fn` change locked features, groups and
121
+ layers (read-only still refuses them).
122
+ - `getMany`, `count`, `has`, `createMany`, `updateMany` and
123
+ `deleteMany` on every collection that records, and filters for
124
+ `list` and `count`.
125
+ - `features.move`, `features.moveMany`, `groups.move` and
126
+ `groups.moveMany`, which take a `MoveTarget`; `selection.add`,
127
+ `selection.remove` and `selection.move`; `hidden.clear`;
128
+ `features.getAppliedStyle`, which gives the colors of the options and
129
+ of the feature as they were given; `features.isEditable`, which
130
+ answers for read-only and the locks of a feature, its group and its
131
+ layer.
132
+ - The events `feature.moved`, `document.loaded`,
133
+ `vertexSelection.changed`, `drag.started`, `drag.ended` and
134
+ `preview.changed`, which carries the shape being drawn and the
135
+ `confirmedVertices` and `highlightVertex` it was shown with.
136
+ - `document.loadMany`, which reads several sources and writes all of
137
+ them in one transaction: one `document.changed` for an import of
138
+ several files.
139
+ - `LoadOptions.layer` and `LoadOptions.group`, which create a layer for
140
+ the features and a group of them in the transaction of the load, for
141
+ `load` and for each item of `loadMany`, and `LoadResult.layerId` and
142
+ `LoadResult.groupId`, their IDs. An item of `loadMany` may name with
143
+ `layerId` the layer an earlier item creates.
144
+ - `DRAW_PROPERTY_PREFIX`, `isDrawProperty`, `DrawProperties` and
145
+ `MODES`.
146
+ - `layers.getOrder()`, the stacking order as `layers.reorder` takes it:
147
+ the layers, the `layer-order` datasets and the external entries.
148
+ - `FeatureFilter.shown`, which keeps the features whose own `visible`,
149
+ their group's and their layer's are all true; `visible` stays the
150
+ feature's own flag.
151
+ - `FeaturePatch`, `LayerInput`, `LayerPatch`, `GroupInput`,
152
+ `GroupPatch`, the filters, `MoveTarget`, `LoadSource`, and the `mode`
153
+ of `LoadOptions` (`replace` or `merge`).
154
+ - `FeatureStyle.pointStrokeColor` and `pointStrokeWidth`, the outline of
155
+ a point marker (white and 2 pixels by default). `strokeColor` and
156
+ `strokeWidth` are the lines and the outlines of areas, also in the
157
+ options `style.point` and `previewStyle`.
158
+ - `FeatureStyle.pointOpacity`, the option `previewStyle` for the shape
159
+ being drawn, and `selectionStyle.boxSelection` for the selection box.
160
+ - `ScreenContext.outline`, the four corners of the selection frame of
161
+ any feature on the screen, turned as the shape is, without the margin
162
+ the frame is drawn with.
163
+ - `draw.drawing`, which drives the shape the current drawing mode is
164
+ drawing from code: `addVertex`, `moveTo` and `finish` act as a click,
165
+ a pointer move and Enter would, without snapping and through the
166
+ `input` receivers of the plugins, and `cancel`, `undoVertex`,
167
+ `redoVertex`, `isActive` and `isDrawing` go with them. Their positions
168
+ are exact: the events carry `DrawPointerEvent.programmatic`, and the
169
+ click tolerance of the pointer does not apply to them.
170
+ - The contexts of the extensions: `terrain`, `names`, `screen` and
171
+ `invalidate` and `drawing` (the same object as `draw.drawing`) for
172
+ every kind, and
173
+ `hitTest`, `snap`, `commitFeature`, `preview`, `cursor` and
174
+ `listTraceRows` for a mode.
175
+ - `FeatureTypeDefinition.outline`, the four corners of the selection
176
+ frame of a type whose shape turns (the engine adds
177
+ `selectionStyle.boundingBox.margin` on every side when it draws the
178
+ frame), and `FeatureTypeDefinition.bbox`,
179
+ the extent on the map the spatial index takes for a type that draws
180
+ beyond its geometry.
181
+ - `onDragStart` and `onDragEnd` of `HandleProvider`, and
182
+ `onHandleDragStart` and `onHandleDragEnd` of `FeatureTypeDefinition`,
183
+ around a drag of a handle; `false` from the start refuses the drag.
184
+ - `DatasetRow.style`, the look of a row, which the rows read back
185
+ carry.
186
+ - `extensions.featureTypes.override`, which puts a definition in the
187
+ place of a built-in type of the same name until the function it
188
+ returns puts the built-in type back, and
189
+ `FeatureTypeDefinition.appliesTo`, which narrows an override to some
190
+ features of the type and leaves the others to the built-in type.
191
+ - In `/geometry`: `midpoint`, `along`, `nearestPointOnLine`,
192
+ `perimeter`, `makeValid`, `rewind` and `metersToDegrees`.
193
+ - In `/table`: `tableFromFeatures`, `createTableBuilder` and
194
+ `TableBuilder`, which build a table from GeoJSON, and
195
+ `PreparedTable.length` and `PreparedTable.bounds`, the number of rows
196
+ and the extent of a prepared table (`null` when no row has a
197
+ geometry).
198
+
199
+ ### Changed
200
+
201
+ - `createMapLibreGLDraw(map, options)` is `createDraw(map, options)`,
202
+ and the instance `MapLibreGLDraw` is `Draw`.
203
+ - The methods of the instance move under resources: the collections
204
+ `features`, `layers`, `groups`, `datasets` and `hidden`, the single
205
+ resources `selection`, `vertexSelection`, `metadata`, `options` and
206
+ `document`, and the collections of `extensions`. A collection that
207
+ records has the eleven standard methods `get`, `getMany`, `list`,
208
+ `count`, `has`, `create`, `createMany`, `update`, `updateMany`,
209
+ `delete` and `deleteMany`; a collection of things added and removed
210
+ has `get`, `list`, `count`, `has`, `add`, `addMany`, `remove` and
211
+ `removeMany`. What the standard methods cannot express is a verb on
212
+ the collection (`features.move`, `layers.reorder`, `features.union`).
213
+ - `create` and `update` return the resource they wrote, not an ID or a
214
+ boolean. `update(id, patch)` changes only the keys given, and merges
215
+ `properties` and `style` key by key; `undefined` removes a key.
216
+ - A method that takes several items (`createMany`, `deleteMany` and
217
+ the rest) runs in one transaction: all of them change, or none.
218
+ - A wrong argument (an unknown ID, an input of the wrong shape) throws
219
+ `DrawError`, which carries a `code`. A write refused because of the
220
+ state (read-only, a lock) returns `null` or `false`. Nothing is
221
+ ignored without a sign, and nothing changes when either happens.
222
+ - Events are named `resource.pastParticiple` (`feature.created`,
223
+ `layer.reordered`) in one list, `DrawEvents`, which apps and plugins
224
+ share. The events of the document carry their `source`, and
225
+ `document.changed` arrives once per transaction that changed the
226
+ document, with every change to features, layers, groups, metadata and
227
+ files.
228
+ - A feature holds a GeoJSON `geometry` in place of `coordinates`. Its
229
+ `properties` are the GeoJSON properties: the values of the library
230
+ are under keys with the `maplibre-gl-draw:` prefix, and every other
231
+ key is an attribute of the user. `style` is always present. The size,
232
+ rotation and opacity of an image move from its style to `properties`
233
+ and `imageOpacity`.
234
+ - `Layer.order` is `Layer.items`, read-only and changed with
235
+ `features.move` and `groups.move`. A group has the `layerId` of its
236
+ layer.
237
+ - The options `snap`, `trace` and `renderingStyle` are `snapping`,
238
+ `tracing` and `rendering`, `pixelRatio` moves into `rendering`, and
239
+ every color is a CSS color string. Every option but `defaultMode`,
240
+ `store` and `initDefaultLayer` can change at run time with
241
+ `draw.options.update`.
242
+ - Every kind of extension is registered the same way, with
243
+ `draw.extensions.<kind>.add`, and removed with the function it
244
+ returns or with `remove(name)`. Each kind receives one context with
245
+ only what it needs. A plugin has `onAdd` and `onRemove`, takes its
246
+ input through `input` and its hooks into selection through
247
+ `interaction`, and adds its modes, types, overlays and providers
248
+ through `ctx.extensions`, which removes them with the plugin.
249
+ - Modes and plugins receive `DrawPointerEvent` and `DrawKeyEvent`, and
250
+ a receiver consumes an event by returning true. A mode factory
251
+ receives its `ModeContext`.
252
+ - A renderer receives one `RenderContext`, with the offset already
253
+ computed, and `onAdd` and `onRemove` take `(map, gl)`.
254
+ - The building blocks for custom shaders (layer 2) move from the main
255
+ entry to `@sakuzu/maplibre-gl-draw/webgl`.
256
+ - The building blocks of `/webgl` that draw on the terrain take the
257
+ `RenderContext` of the draw call, or its `terrain`, in place of the
258
+ terrain state of the instance: `ProjectionUniformManager.setTerrain`,
259
+ `QuadShader.setTerrain`, `drawQuadSurfaceOnTerrain` and
260
+ `terrainTessellationStep`. The constructors of
261
+ `ProjectionUniformManager` and `QuadShader` no longer take a terrain.
262
+ - `@sakuzu/maplibre-gl-draw/geometry` takes and returns GeoJSON, uses
263
+ the names of Turf, measures in meters, and merges the two-argument
264
+ and array forms of a function into one. It goes from 60 exports to
265
+ 31. `EARTH_RADIUS_METERS` is 6371008.8, the mean radius of the Earth,
266
+ so measured lengths and areas change slightly.
267
+ - `@sakuzu/maplibre-gl-draw/columnar` is `@sakuzu/maplibre-gl-draw/table`,
268
+ and its types are named after the table, not the dataset.
269
+ - A dataset takes its rows as GeoJSON features in `rows`, or a table in
270
+ `table`, or starts empty with neither and is filled later with
271
+ `setRows` or `setTable`; `layers.reorder` places a `layer-order`
272
+ dataset as soon as it is added. Its members use the word row, and it
273
+ has its own events, `clicked`, `hovered` and `changed`.
274
+ - An extent is the four-number `BBox` of `/geometry`,
275
+ `[west, south, east, north]`, everywhere the main entry takes or
276
+ gives one: `FeatureFilter.bbox`, the argument of `DatasetProvider`,
277
+ the `Dataset` methods, `ModeContext.listTraceRows` and
278
+ `FeatureTypeDefinition.bbox`. GeoJSON's `BBox`, which may carry
279
+ heights in six numbers, is not used.
280
+ - The native format is 3.0.0. A file of 2.x is upgraded on load.
281
+ - Every load, of any format, is one transaction with the source `load`
282
+ once the source is read: a document of the library is no longer
283
+ loaded with `silent`, nor an image with `local`.
284
+ - The GeoJSON export writes the `properties` of a feature as they are
285
+ stored, with their prefix.
286
+ - The margin of the selection frame (`selectionStyle.boundingBox.margin`)
287
+ stands outside every edge of the outline of the selection, for every
288
+ type, points included, so a long and thin selection keeps it on its
289
+ long sides too; 1.0 pushed the corners out along the diagonals. The
290
+ resize and rotate handles sit on the corners of that frame.
291
+ - A built-in point is hit anywhere on its marker (the radius of
292
+ `pointRadius` and its outline) with the click tolerance around it;
293
+ 1.0 hit it only within the tolerance of its position, so a click on
294
+ the rim of the marker went to what was behind it, a companion drawn
295
+ from the point among others. A feature therefore always wins over its
296
+ own companion at the same point.
297
+ - A double click never zooms the map while a drawing mode (a mode with
298
+ `writes: true`) is the current mode, whether or not the mode takes
299
+ it; the freehand mode takes it, and a press it releases without a
300
+ drag leaves the pan of the map on.
301
+
302
+ ### Removed
303
+
304
+ - Every name of 1.0 that changed, with no deprecated alias. The export
305
+ `generateCirclePolygon` of the main entry, deprecated in 1.0, is
306
+ removed; use `circle` from `@sakuzu/maplibre-gl-draw/geometry`.
307
+ - `draw.input`, the synthetic input. `draw.drawing` drives a drawing
308
+ mode from code.
309
+ - The namespaces `draw.geometry`, `draw.snapping`, `draw.tracing` and
310
+ `draw.topology`: their operations are methods of `features`, options
311
+ of `draw.options` and `extensions.snapProviders`.
312
+ - `export(format)`, its options and `getSuggestedFileName`. Use
313
+ `document.toJSON()` and `document.toGeoJSON()`.
314
+ - The event `draw.geometry.applied`: the operations return their
315
+ result.
316
+ - `Plugin.hooks` and `PluginContext.emit`. Plugins subscribe to
317
+ `DrawEvents` and talk to each other through their `api`.
318
+ - From the main entry: the pure math (oriented boxes, conversions
319
+ between pixels, degrees and Mercator, contrast colors), the services
320
+ of the 1.0 contexts (registries, hit test services, the plugin
321
+ manager, the event emitter), `MemoryStore`, the lock predicates, the
322
+ factory of the guide snap provider and the trace graph functions.
323
+ - From the Store contract: the state of the input (the shape being
324
+ drawn, the box selection, the drag, the followed vertices).
325
+
326
+ ### Migration table
327
+
328
+ Every name the tables leave out keeps its name in 2.0; its shape may
329
+ still change, as the tables of the model and the extensions say.
330
+
331
+ #### Instance methods
332
+
333
+ The 81 members of `MapLibreGLDraw`, by the resource they move to. The
334
+ operations of the namespaces follow their namespace. `draw.` is left
335
+ out on both sides.
336
+
337
+ | 1.0 | 2.0 | Note |
338
+ | --- | --- | --- |
339
+ | `getMap` | `getMap` | |
340
+ | `getStore` | `getStore` | Returns a `StoreView` |
341
+ | `getMode` | `getMode` | |
342
+ | `setMode` | `setMode` | An unknown mode throws |
343
+ | `isReadOnly` | `isReadOnly` | |
344
+ | `setReadOnly` | `setReadOnly` | |
345
+ | `isInteractionLocked` | `isInteractionLocked` | |
346
+ | `setInteractionLock` | `setInteractionLocked` | |
347
+ | `getRenderSlots` | `getLayerStack` | |
348
+ | `getTerrainDiagnostics` | `debug.terrain()` | |
349
+ | `hasPendingWork` | `hasPendingWork` | |
350
+ | `on` | `on` | The names of `DrawEvents` |
351
+ | `off` | `off` | |
352
+ | `destroy` | `destroy` | |
353
+ | `addFeature` | `features.create` | Returns the `Feature` |
354
+ | `getFeature` | `features.get` | |
355
+ | `getAllFeatures` | `features.list()` | |
356
+ | `getVisibleFeatures` | `features.list({ shown: true })` | |
357
+ | `updateFeature` | `features.update` | A patch; returns the `Feature` |
358
+ | `deleteFeature` | `features.delete` | |
359
+ | `deleteAllFeatures` | `features.deleteMany(ids)` | Pass every ID |
360
+ | `addFeatureToGroup` | `features.move(id, { groupId, index })` | |
361
+ | `removeFeatureFromGroup` | `features.move(id, { groupId: null })` | |
362
+ | `reorderInGroup` | `features.move(id, { groupId, index })` | |
363
+ | `reorderInLayer` | `features.move`, `groups.move` | `{ layerId, index }` |
364
+ | `moveToLayer` | `features.move`, `groups.move` | `{ layerId }` |
365
+ | `geometry` | `features` | |
366
+ | `geometry.union` | `features.union(ids)` | Returns the `Feature` |
367
+ | `geometry.subtract` | `features.difference(id, ids)` | |
368
+ | `geometry.intersect` | `features.intersection(ids)` | |
369
+ | `geometry.split` | `features.split(id, lineId)` | Returns the features |
370
+ | `geometry.buffer` | `features.buffer(ids, options)` | `distanceMeters` |
371
+ | `getAllLayers` | `layers.list()` | |
372
+ | `getLayer` | `layers.get` | |
373
+ | `addLayer(name?)` | `layers.create({ name })` | Returns the `Layer` |
374
+ | `updateLayer` | `layers.update` | |
375
+ | `deleteLayer` | `layers.delete` | |
376
+ | `getLayerOrder` | `layers.list()` | Their `id`, from the back |
377
+ | `setLayerOrder` | `layers.reorder` | |
378
+ | `getActiveLayer` | `layers.getActive()` | Returns the `Layer` |
379
+ | `setActiveLayer` | `layers.setActive` | Returns a boolean |
380
+ | `getAllGroups` | `groups.list()` | |
381
+ | `getGroup` | `groups.get` | |
382
+ | `addGroup(ids, layerId, name?)` | `groups.create({ featureIds, name })` | |
383
+ | `updateGroup` | `groups.update` | |
384
+ | `deleteGroup` | `groups.delete` | The members stay |
385
+ | `ungroupGroup` | `groups.delete` | |
386
+ | `addDataset` | `datasets.add` | |
387
+ | `getDataset` | `datasets.get` | |
388
+ | `getDatasets` | `datasets.list()` | |
389
+ | `moveDataset` | `datasets.move` | |
390
+ | `removeDataset` | `datasets.remove` | An unknown ID throws |
391
+ | `isLocallyHidden` | `hidden.has` | |
392
+ | `getLocallyHidden` | `hidden.list()` | An array |
393
+ | `setLocallyHidden(id, true)` | `hidden.add(id)` | |
394
+ | `setLocallyHidden(id, false)` | `hidden.remove(id)` | |
395
+ | `getSelection` | `selection.get()` | |
396
+ | `getSelectedIds` | `selection.get().ids` | |
397
+ | `select(ids, type?)` | `selection.set(type, ids)` | The type comes first |
398
+ | `deselect` | `selection.clear()` | |
399
+ | `getSelectedFeatures` | `selection.features()` | |
400
+ | `deleteSelection` | `selection.delete()` | |
401
+ | `groupSelection` | `selection.group()` | Returns the `Group` |
402
+ | `ungroupSelection` | `selection.ungroup()` | Returns a boolean |
403
+ | `getSelectedVertices` | `vertexSelection.get()` | |
404
+ | `selectVertices` | `vertexSelection.set` | |
405
+ | `deselectVertices` | `vertexSelection.clear()` | |
406
+ | `deleteVertices` | `vertexSelection.delete()` | The selected ones |
407
+ | `getMetadata` | `metadata.get()` | |
408
+ | `setMetadata` | `metadata.update` | Returns the `Metadata` |
409
+ | `load` | `document.load`, `loadMany` | `null` when read-only |
410
+ | `export('native')` | `document.toJSON()` | An object, not a string |
411
+ | `export('geojson')` | `document.toGeoJSON()` | An object, not a string |
412
+ | `getSuggestedFileName` | (removed) | The app names its files |
413
+ | `getRenderScale` | `options.get()` | `rendering.renderScale` |
414
+ | `setRenderScale` | `options.update` | `rendering.renderScale` |
415
+ | `getPixelRatio` | `options.get()` | `rendering.pixelRatio` |
416
+ | `snapping` | `options`, `extensions.snapProviders` | |
417
+ | `snapping.register` | `extensions.snapProviders.add` | |
418
+ | `snapping.setEnabled` | `options.update` | `snapping.enabled` |
419
+ | `snapping.isEnabled` | `options.get()` | `snapping.enabled` |
420
+ | `snapping.setKindEnabled` | `options.update` | `snapping.kinds` |
421
+ | `snapping.isKindEnabled` | `options.get()` | `snapping.kinds` |
422
+ | `snapping.setDatasetsEnabled` | `options.update` | `snapping.datasets` |
423
+ | `snapping.isDatasetsEnabled` | `options.get()` | `snapping.datasets` |
424
+ | `snapping.setGuideStep` | `options.update` | `snapping.guideStepDegrees` |
425
+ | `snapping.getOptions` | `options.get().snapping` | |
426
+ | `snapping.getResult` | The event `snap.changed` | Its `result` |
427
+ | `snapping.resolve` | `ModeContext.snap(point)` | In a mode |
428
+ | `tracing` | `options` | |
429
+ | `tracing.setEnabled` | `options.update` | `tracing.enabled` |
430
+ | `tracing.isEnabled` | `options.get()` | `tracing.enabled` |
431
+ | `topology` | `options` | |
432
+ | `topology.setSharedVertexDrag` | `options.update` | See `TopologyOptions` |
433
+ | `topology.isSharedVertexDrag` | `options.get()` | See `TopologyOptions` |
434
+ | `input` | `drawing` | Drives a drawing mode |
435
+ | `input.click` | `drawing.addVertex` | No snapping |
436
+ | `input.move` | `drawing.moveTo` | No snapping |
437
+ | `input.key` | (removed) | `drawing.finish`, `drawing.cancel` |
438
+ | `input.setPointerHold` | (removed) | |
439
+ | `input.isPointerHeld` | (removed) | |
440
+ | `addPlugin` | `extensions.plugins.add` | |
441
+ | `getPluginApi` | `extensions.plugins.getApi` | |
442
+ | `registerMode` | `extensions.modes.add` | |
443
+ | `registerFeatureHandler` | `extensions.featureTypes.add` | |
444
+ | `addOverlayRenderer` | `extensions.overlays.add` | |
445
+ | `registerAuxiliaryHandleProvider` | `extensions.handleProviders.add` | |
446
+ | `registerFeatureCompanionProvider` | `extensions.companionProviders.add` | |
447
+
448
+ The operations of `geometry` used the selection when no ID was given;
449
+ the methods of `features` take the IDs (`selection.get().ids`). The
450
+ `vertexSelection.get()` of 2.0 has `vertices` in place of
451
+ `vertexIndices`. `deleteVertices` deletes the selected vertices, so
452
+ select them with `vertexSelection.set` first.
453
+
454
+ #### Events
455
+
456
+ A plugin of 1.0 subscribed to the same names without `draw.`
457
+ (`feature.create`); in 2.0 apps and plugins use the same names.
458
+
459
+ | 1.0 | 2.0 | Note |
460
+ | --- | --- | --- |
461
+ | `draw.feature.create` | `feature.created` | |
462
+ | `draw.feature.update` | `feature.updated` | With `intermediate` |
463
+ | `draw.feature.delete` | `feature.deleted` | |
464
+ | `draw.features.change` | `document.changed` | Only a change of the document |
465
+ | `draw.layer.create` | `layer.created` | |
466
+ | `draw.layer.update` | `layer.updated` | |
467
+ | `draw.layer.delete` | `layer.deleted` | |
468
+ | `draw.layer.reorder` | `layer.reordered` | |
469
+ | `draw.group.create` | `group.created` | |
470
+ | `draw.group.update` | `group.updated` | |
471
+ | `draw.group.delete` | `group.deleted` | |
472
+ | `draw.metadata.change` | `metadata.updated` | |
473
+ | `draw.selection.change` | `selection.changed` | `{ selection, previous }` |
474
+ | `draw.mode.change` | `mode.changed` | `previousMode` is `previous` |
475
+ | `draw.image.request` | `image.requested` | `{ lngLat, zoom, layerId }` |
476
+ | `draw.geometry.applied` | (removed) | The methods return the result |
477
+ | `draw.snap.change` | `snap.changed` | `{ result }` |
478
+ | `draw.dataset.click` | `dataset.clicked` | `row` and `rowIndex` |
479
+ | `draw.dataset.add` | `dataset.added` | `{ dataset }` |
480
+ | `draw.dataset.remove` | `dataset.removed` | |
481
+ | `draw.dataset.reorder` | `dataset.reordered` | With `previous` |
482
+ | `draw.map.click` | `map.clicked` | `{ lngLat, point, hit }` |
483
+ | `draw.renderslots.change` | `layerStack.changed` | `{ entries }` |
484
+ | `draw.load.error` | `error` | `{ error, source, featureId? }` |
485
+ | (none) | `feature.moved` | Between layers and groups |
486
+ | (none) | `document.loaded` | `{ result, source }` |
487
+ | (none) | `vertexSelection.changed` | |
488
+ | (none) | `hidden.changed` | `{ ids }`, the whole set |
489
+ | (none) | `readOnly.changed` | `{ readOnly }` |
490
+ | (none) | `interactionLock.changed` | `{ locked }` |
491
+ | The hook `drag:start` | `drag.started` | |
492
+ | The hook `drag:end` | `drag.ended` | With `cancelled` |
493
+
494
+ Every event of the document (`feature.*`, `layer.*`, `group.*`,
495
+ `metadata.updated`, `document.loaded`) carries `source`. In
496
+ `document.changed` the `source` is optional, and an update in progress
497
+ is marked by the `isIntermediate` of that update.
498
+
499
+ #### Options
500
+
501
+ `Options` is `DrawOptions`, and the options that can change while the
502
+ instance runs are `RuntimeOptions`, changed with `draw.options.update`.
503
+
504
+ | 1.0 | 2.0 | Note |
505
+ | --- | --- | --- |
506
+ | `defaultMode` | `defaultMode` | |
507
+ | `clickTolerance` | `clickTolerance` | |
508
+ | `dragThreshold` | `dragThreshold` | |
509
+ | `style` | `style` | A `FeatureStyle` per type |
510
+ | `style.point` | `style.point` | |
511
+ | `style.lineString` | `style.line` | |
512
+ | `style.polygon` | `style.polygon` | |
513
+ | (none) | `style.circle`, `style.image` | |
514
+ | `style.tentative` | `previewStyle` | A `Partial<FeatureStyle>` |
515
+ | `selectionStyle` | `selectionStyle` | CSS colors |
516
+ | `renderingStyle` | `rendering` | |
517
+ | `renderingStyle.storeRetained` | `rendering.cacheGeometry` | |
518
+ | `renderingStyle.timeSlicing` | `rendering.timeSlicing` | |
519
+ | `renderingStyle.boxSelectionStyle` | `selectionStyle.boxSelection` | |
520
+ | `pixelRatio` | `rendering.pixelRatio` | A number |
521
+ | (none) | `rendering.renderScale` | |
522
+ | `autoName` | `autoName` | `AutoNameOptions` or `false` |
523
+ | `autoName.enabled` | (removed) | `autoName: false` |
524
+ | `scaleWithZoom` | `scaleWithZoom` | |
525
+ | `snap` | `snapping` | The same fields |
526
+ | `trace` | `tracing` | |
527
+ | `topology` | `topology` | |
528
+ | `store` | `store` | A `Store` |
529
+ | `initDefaultLayer` | `initDefaultLayer` | |
530
+ | `isExternalEntry` | `isExternalEntry` | Takes an ID of the stack |
531
+ | `messages` | `messages` | |
532
+
533
+ #### Model
534
+
535
+ | 1.0 | 2.0 | Note |
536
+ | --- | --- | --- |
537
+ | `Feature.coordinates` | `Feature.geometry` | A GeoJSON geometry |
538
+ | `Feature.properties` | `Feature.properties` | Library keys are prefixed |
539
+ | `Feature.style?` | `Feature.style` | Always present, `{}` at least |
540
+ | `FeatureInput.coordinates` | `FeatureInput.geometry` | |
541
+ | (none) | `FeatureInput.groupId` | |
542
+ | `Partial<Feature>` | `FeaturePatch` | Without `id`, `type`, `layerId` |
543
+ | `Partial<Layer>` | `LayerPatch` | For `layers.update` |
544
+ | `Partial<Group>` | `GroupPatch` | For `groups.update` |
545
+ | `properties.createdZoom` | `maplibre-gl-draw:createdZoom` | |
546
+ | `properties.rotation` | `maplibre-gl-draw:rotation` | |
547
+ | `properties.scale` | `maplibre-gl-draw:scale` | |
548
+ | `properties.radiusMeters` | `maplibre-gl-draw:radiusMeters` | |
549
+ | `properties.radiusHandleAngle` | `maplibre-gl-draw:radiusHandleAngle` | |
550
+ | `properties.imageFileId` | `maplibre-gl-draw:imageFileId` | |
551
+ | `properties.imageWidth` | `maplibre-gl-draw:imageWidth` | |
552
+ | `properties.imageHeight` | `maplibre-gl-draw:imageHeight` | |
553
+ | `ImageStyle` | `FeatureStyle` | |
554
+ | `ImageStyle.width` | `maplibre-gl-draw:imageWidth` | |
555
+ | `ImageStyle.height` | `maplibre-gl-draw:imageHeight` | |
556
+ | `ImageStyle.rotation` | `maplibre-gl-draw:rotation` | Added to it |
557
+ | `ImageStyle.opacity` | `FeatureStyle.imageOpacity` | |
558
+ | (none) | `FeatureStyle.pointOpacity` | |
559
+ | `Layer.order` | `Layer.items` | Changed with `move` |
560
+ | (none) | `Group.layerId` | |
561
+ | `VertexSelection.vertexIndices` | `VertexSelection.vertices` | |
562
+ | `Coordinate`, `LngLat` | `Position` | GeoJSON `[lng, lat]` |
563
+ | `Data` | `DrawDocument` | |
564
+ | `Data.version` `2.0.0` | `3.0.0` | Upgraded on load |
565
+ | `LoadOptions.coordinate` | `LoadOptions.coordinate` | A `Position` |
566
+ | (none) | `LoadOptions.mode` | `replace` or `merge` |
567
+ | Plain `Error` | `DrawError` | `code` |
568
+
569
+ #### Extensions
570
+
571
+ The `Plugin`:
572
+
573
+ | 1.0 | 2.0 | Note |
574
+ | --- | --- | --- |
575
+ | `onInstall(ctx)` | `onAdd(ctx)` | Required |
576
+ | `onUninstall` | `onRemove` | |
577
+ | `hooks` | `ctx.on` | See the hooks below |
578
+ | `modes` | `ctx.extensions.modes.add` | |
579
+ | `api` | `api` | `Plugin<Api>` |
580
+ | `onKeyDown` | `input.onKeyDown` | `DrawKeyEvent` |
581
+ | `onMouseMove` | `input.onPointerMove` | `DrawPointerEvent` |
582
+ | `onDragMove` | `input.onDrag` | |
583
+ | `onMouseLeave` | `input.onPointerLeave` | |
584
+ | `filterSelection` | `interaction.filterSelection` | |
585
+ | `onFeatureClick(id)` | `interaction.onFeatureClick` | Takes the `Feature` |
586
+ | `onFeatureDoubleClick(id)` | `interaction.onFeatureDoubleClick` | |
587
+ | `onFeatureCreated` | `interaction.onDrawCommit` | Takes the `Feature` |
588
+ | `isInteracting` | `interaction.isBusy` | |
589
+ | `finishInteraction` | `interaction.finish` | |
590
+ | `cancelInteraction` | `interaction.cancel` | |
591
+ | `getInteractionContainer` | `interaction.container` | |
592
+
593
+ The hooks of `Plugin.hooks`:
594
+
595
+ | 1.0 | 2.0 | Note |
596
+ | --- | --- | --- |
597
+ | `feature:afterCreate` | `feature.created` | Or `document.changed` |
598
+ | `feature:afterUpdate` | `feature.updated` | |
599
+ | `feature:afterDelete` | `feature.deleted` | |
600
+ | `group:afterCreate` | `group.created` | |
601
+ | `group:afterUpdate` | `group.updated` | |
602
+ | `group:afterDelete` | `group.deleted` | |
603
+ | `layer:afterCreate` | `layer.created` | |
604
+ | `layer:afterUpdate` | `layer.updated` | |
605
+ | `layer:afterDelete` | `layer.deleted` | |
606
+ | `selection:afterChange` | `selection.changed` | |
607
+ | `drag:start` | `drag.started` | |
608
+ | `drag:end` | `drag.ended` | |
609
+ | `MutationContext.source` | `source` of the payload | |
610
+ | `MutationContext.batchId` | `document.changed` | Once per transaction |
611
+
612
+ The `PluginContext`. Its writes took a `source`; in 2.0 wrap them in
613
+ `ctx.draw.transact(fn, { source })`.
614
+
615
+ | 1.0 | 2.0 | Note |
616
+ | --- | --- | --- |
617
+ | `draw` | `draw` | A `Draw` |
618
+ | `getStore()` | `store` | A `StoreView`; write with `draw` |
619
+ | `autoNameGenerator` | `names` | `next(type)` |
620
+ | `getFeature`, `getAllFeatures` | `draw.features.get`, `list` | |
621
+ | `getGroup`, `getAllGroups` | `draw.groups.get`, `list` | |
622
+ | `getLayer`, `getAllLayers` | `draw.layers.get`, `list` | |
623
+ | `getLayerOrder`, `getLayerIds` | `draw.layers.list()` | Their `id` |
624
+ | `getSelection`, `getSelectedIds` | `draw.selection.get()` | |
625
+ | `getMode`, `setMode` | `draw.getMode`, `draw.setMode` | |
626
+ | `addFeatures(features, source)` | `draw.features.createMany` | |
627
+ | `updateFeature` | `draw.features.update` | |
628
+ | `deleteFeatures` | `draw.features.deleteMany` | |
629
+ | `createGroup` | `draw.groups.create` | |
630
+ | `updateGroup`, `deleteGroup` | `draw.groups.update`, `delete` | |
631
+ | `createLayer` | `draw.layers.create` | |
632
+ | `updateLayer`, `deleteLayer` | `draw.layers.update`, `delete` | |
633
+ | `addFeatureToGroup` | `draw.features.move` | `{ groupId, index }` |
634
+ | `removeFeatureFromGroup` | `draw.features.move` | `{ groupId: null }` |
635
+ | `addToLayer`, `removeFromLayer` | `draw.features.move` | `{ layerId }` |
636
+ | `moveItemToLayer` | `features.move`, `groups.move` | |
637
+ | `setLayerItemOrder` | `features.move`, `groups.move` | `index` |
638
+ | `findGroupForFeature` | `Feature.groupId` | |
639
+ | `findLayerForFeature` | `Feature.layerId` | |
640
+ | `setSelection` | `draw.selection.set` | |
641
+ | `emit` | (removed) | Plugins talk through `api` |
642
+ | `on`, `off` | `on`, `off`, `once` | Ended with the plugin |
643
+ | `batch(fn)` | `draw.transact(fn, options)` | |
644
+ | `notifyStateReset` | (removed) | The Store reports it |
645
+ | `undoVertex`, `redoVertex` | `drawing.undoVertex`, `redoVertex` | |
646
+ | (none) | `drawing.isDrawing`, `drawing.cancel` | |
647
+ | (none) | `drawing.addVertex`, `moveTo`, `finish`, `isActive` | |
648
+ | `invalidateFeatures(type)` | `invalidate({ type })` | |
649
+ | `projectAnchor(lng, lat)` | `terrain.project([lng, lat])` | |
650
+ | `anchorElevationMeters` | `terrain.elevation` | |
651
+ | `getAnchorElevationGeneration` | `terrain.generation` | |
652
+ | `computeBoundingBox` | `screen.bounds` | `{ min, max }` or `null` |
653
+
654
+ The `ModeHandler` and the `ModeContext`:
655
+
656
+ | 1.0 | 2.0 | Note |
657
+ | --- | --- | --- |
658
+ | `ModeFactory` `() => handler` | `(ctx: ModeContext) => handler` | |
659
+ | `modeName` | (removed) | The name given to `add` |
660
+ | `onStart(context)` | `onEnter()` | The factory has the context |
661
+ | `onStop` | `onExit` | |
662
+ | `onMouseDown`, `onMouseUp` | `onPointerDown`, `onPointerUp` | |
663
+ | `onMouseMove` | `onPointerMove` | |
664
+ | `onClick`, `onDoubleClick` | `onClick`, `onDoubleClick` | |
665
+ | `onDragMove` | `onDrag` | |
666
+ | `onDragStart`, `onDragEnd` | `onDragStart`, `onDragEnd` | |
667
+ | `onDragCancel` | `onDragCancel` | |
668
+ | `onKeyDown`, `onKeyUp` | `onKeyDown`, `onKeyUp` | `DrawKeyEvent` |
669
+ | `onExternalStateChange` | `ctx.on('document.changed')` | |
670
+ | `onSelectionChange` | `ctx.on('selection.changed')` | |
671
+ | (none) | `onCancel` | Escape |
672
+ | `writesFeatures` | `writes` | |
673
+ | `undoVertex`, `redoVertex` | `onUndoVertex`, `onRedoVertex` | |
674
+ | `getSnapPreference` | `snapPreference` | A `SnapPreference` |
675
+ | `isSnapEnabledFor` | `snapPreference` | |
676
+ | `ctx.map` | `ctx.draw.getMap()` | |
677
+ | `ctx.store` | `ctx.store`, `ctx.draw` | Read and write |
678
+ | `ctx.spatialIndex` | `ctx.hitTest` | |
679
+ | `ctx.hitTestService` | `ctx.hitTest` | |
680
+ | `ctx.hitTestTopmost` | `ctx.hitTest` | |
681
+ | `ctx.getDatasetFeature` | `ctx.hitTest` | Rows of datasets are hits |
682
+ | `ctx.getDatasetTraceFeatures` | `ctx.listTraceRows(bbox)` | |
683
+ | `ctx.featureCompanions` | (removed) | Companions are hits |
684
+ | `ctx.boxSelectionRegistry` | (removed) | |
685
+ | `ctx.selectionScope` | (removed) | |
686
+ | `ctx.eventEmitter` | `ctx.on`, `off`, `once` | |
687
+ | `ctx.selectionStyle` | `ctx.selectionStyle` | |
688
+ | `ctx.topology`, `trace` | `ctx.draw.options.get()` | |
689
+ | `ctx.snapOptions` | `ctx.draw.options.get()` | `snapping` |
690
+ | `ctx.autoNameGenerator` | `ctx.names` | |
691
+ | `ctx.pluginManager` | `extensions.plugins.getApi` | |
692
+ | `ctx.setMode` | `ctx.setMode` | Returns a boolean |
693
+ | `ctx.generateFeatureId` | `ctx.commitFeature(input)` | |
694
+ | `ctx.getCurrentLayerId` | `ctx.commitFeature(input)` | |
695
+ | `ctx.scaleWithZoom` | `ctx.commitFeature(input)` | |
696
+ | `ctx.getSnapResult` | `ctx.snap(point)` | |
697
+ | `store.setTentative` | `ctx.preview.set`, `clear` | |
698
+ | (none) | `ctx.cursor.set`, `reset` | |
699
+
700
+ `commitFeature` gives the feature its ID, its layer, its automatic name
701
+ and its reference zoom by the rules of the built-in modes. The receivers
702
+ of a mode and of `Plugin.input` consume the event by returning true.
703
+
704
+ The renderers and their `RenderContext`:
705
+
706
+ | 1.0 | 2.0 | Note |
707
+ | --- | --- | --- |
708
+ | `CustomRendererDrawContext` | `RenderContext` | |
709
+ | `shaderData` | `shader` | |
710
+ | `mainMatrixArray` | `projection` | MapLibre's `ProjectionData` |
711
+ | `centerLngLat` | `offset` | Computed `OffsetUniforms` |
712
+ | `pixelRatio` | `pixelRatio` | |
713
+ | `terrain` | `terrain` | `TerrainAnchors` |
714
+ | `opacity` | `opacity` | |
715
+ | `sdfLineRenderer` | `line` | `LineRenderer` |
716
+ | `fillShaderManager` | `fill` | `FillRenderer` |
717
+ | `pointShapeRenderer` | `point` | `PointRenderer` |
718
+ | (none) | `gl`, `zoom` | |
719
+ | `onAdd(gl, map)` | `onAdd(map, gl)` | The arguments swap |
720
+ | `onRemove()` | `onRemove(map, gl)` | |
721
+ | Feature `draw(...)` | `draw(feature, ctx)` | |
722
+ | Overlay `draw(data, zoom, ctx)` | `draw(ctx)` | |
723
+ | `LayerAwareOverlayRenderer` | `OverlayRenderer` | `drawForLayer` |
724
+ | Overlay `order` | `order` | A number |
725
+ | Overlay `drawVertices` | `drawVertices(ctx)` | |
726
+
727
+ The custom feature type, `CustomFeatureHandler` in 1.0 and
728
+ `FeatureTypeDefinition` in 2.0:
729
+
730
+ | 1.0 | 2.0 | Note |
731
+ | --- | --- | --- |
732
+ | `type` | `type` | |
733
+ | (none) | `geometry` | The kind of GeoJSON geometry |
734
+ | `renderer` | `renderer` | A `FeatureRenderer` |
735
+ | `hitTest` (a strategy) | `hitTest(feature, ctx)` | |
736
+ | `boxSelection` | `boxSelect(feature, box, ctx)` | |
737
+ | `getBoundingBox` | `bbox(feature)` | `[west, south, east, north]` |
738
+ | `getSelectionBoundingBox` | `bounds` or `outline(feature, ctx)` | |
739
+ | `getPointFrameExtent` | `bounds(feature, ctx)` | |
740
+ | `getAdditionalResizeHandles` | `handles(feature, ctx)` | |
741
+ | `computeCustomResize` | `onHandleDrag` | Returns a `FeaturePatch` |
742
+ | `getSnapTargets` | `snapCandidates(feature, ctx)` | |
743
+ | `resizeStrategy` | (removed) | `handles` and `onHandleDrag` |
744
+ | `candidateReachPx` | `hitPaddingPx` | |
745
+
746
+ The providers:
747
+
748
+ | 1.0 | 2.0 | Note |
749
+ | --- | --- | --- |
750
+ | `AuxiliaryHandleProvider` | `HandleProvider` | |
751
+ | `id` | `name` | |
752
+ | `getHandles` | `handles(feature, ctx)` | |
753
+ | `onHandleDragStart` | `onDragStart` | `false` refuses the drag |
754
+ | `onHandleDragMove` | `onDrag` | Returns a `FeaturePatch` |
755
+ | `onHandleDragEnd` | `onDragEnd` | After the last `onDrag` |
756
+ | `getGlobalHandles` | `globalHandles(ctx)` | |
757
+ | `FeatureCompanionProvider` | `CompanionProvider` | |
758
+ | `id` | `name` | |
759
+ | `draw` | `draw(feature, ctx)` | |
760
+ | `hitTest(feature, point, ctx)` | `hitTest(feature, ctx)` | |
761
+ | `has` | `has(feature)` | |
762
+ | `onCompanionClick` | `onClick(feature, hit, event)` | |
763
+ | `SnapProvider.candidates` | `candidates(ctx)` | No `bbox` argument |
764
+
765
+ The registration:
766
+
767
+ | 1.0 | 2.0 | Note |
768
+ | --- | --- | --- |
769
+ | `addPlugin` | `extensions.plugins.add` | |
770
+ | `registerMode` | `extensions.modes.add` | |
771
+ | `registerFeatureHandler` | `extensions.featureTypes.add` | |
772
+ | `addOverlayRenderer` | `extensions.overlays.add` | |
773
+ | `snapping.register` | `extensions.snapProviders.add` | |
774
+ | `registerAuxiliaryHandleProvider` | `extensions.handleProviders.add` | |
775
+ | `registerFeatureCompanionProvider` | `extensions.companionProviders.add` | |
776
+ | `Plugin.modes` | `ctx.extensions.modes.add` | |
777
+
778
+ The Store contract:
779
+
780
+ | 1.0 | 2.0 | Note |
781
+ | --- | --- | --- |
782
+ | `DocumentStore`, `UiState` | `Store` | |
783
+ | `getAllFeatures` | `listFeatures` | |
784
+ | `getOrderedFeatures` | `listFeaturesInOrder` | |
785
+ | `getAllLayers` | `listLayers` | |
786
+ | `getAllGroups` | `listGroups` | |
787
+ | `getAllFiles` | `listFiles` | |
788
+ | `getSelectedVertices` | `getVertexSelection` | |
789
+ | `isLocallyHidden` | `isHidden` | |
790
+ | `getLocallyHidden` | `listHidden` | |
791
+ | `subscribe` | `subscribe` | Receives `DocumentChange` |
792
+ | `StateChanges` | `DocumentChange` | |
793
+ | `getTentative`, `setTentative` | (removed) | |
794
+ | `getBoxSelection`, `setBoxSelection` | (removed) | |
795
+ | `getDragState`, `setDragState` | (removed) | |
796
+ | `getFollowedVertices` | (removed) | |
797
+ | `setFollowedVertices` | (removed) | |
798
+
799
+ #### Main entry
800
+
801
+ Every export of the main entry of 1.0 that does not keep its name, and
802
+ the two types of layer 2 that stay in the main entry. The
803
+ building blocks for custom shaders are in
804
+ `@sakuzu/maplibre-gl-draw/webgl`, with no promise across minor
805
+ releases.
806
+
807
+ | 1.0 | 2.0 | Note |
808
+ | --- | --- | --- |
809
+ | `createMapLibreGLDraw` | `createDraw` | |
810
+ | `MapLibreGLDraw` | `Draw` | |
811
+ | `Options` | `DrawOptions` | |
812
+ | `EventPayloads` | `DrawEvents` | |
813
+ | `EventMap` | `DrawEvents` | The same names as the app |
814
+ | `EventListener` | `DrawEventListener` | |
815
+ | `FeaturesChangePayload` | `DocumentChange` | |
816
+ | `StateChanges` | `DocumentChange` | |
817
+ | `Data` | `DrawDocument` | |
818
+ | `Coordinate` | `Position` | From GeoJSON |
819
+ | `LngLat` | `Position` | |
820
+ | `FeatureCoordinates` | `Geometry` of GeoJSON | `Feature.geometry` |
821
+ | `RenderSlot` | `LayerStackEntry` | |
822
+ | `SnapOptions` | `SnappingOptions` | |
823
+ | `TraceOptions` | `TracingOptions` | |
824
+ | `TraceConfig` | `TracingOptions` | |
825
+ | `TopologyConfig` | `TopologyOptions` | |
826
+ | `RenderingConfig` | `RenderingOptions` | |
827
+ | `SelectionUIConfig` | `SelectionStyleOptions` | |
828
+ | `AutoNameConfig` | `AutoNameOptions` | No `enabled` |
829
+ | `FeatureStyleConfig` | `DrawOptions.style` | |
830
+ | `PointFeatureStyle` | `FeatureStyle` | |
831
+ | `LineStringFeatureStyle` | `FeatureStyle` | |
832
+ | `PolygonFeatureStyle` | `FeatureStyle` | |
833
+ | `ImageStyle` | `FeatureStyle` | Folded (model table) |
834
+ | `ImageProperties` | `DrawProperties` | |
835
+ | `Color` | `string` | A CSS color |
836
+ | `BoundingBoxStyle` | `SelectionStyleOptions` | `boundingBox` |
837
+ | `ResizeHandleStyle` | `SelectionStyleOptions` | `resizeHandle` |
838
+ | `RotateHandleStyle` | `SelectionStyleOptions` | `rotateHandle` |
839
+ | `VertexHandleStyle` | `SelectionStyleOptions` | `vertexHandle` |
840
+ | `MidpointHandleStyle` | `SelectionStyleOptions` | `midpointHandle` |
841
+ | `RadiusHandleStyle` | `SelectionStyleOptions` | `radiusHandle` |
842
+ | `CenterMarkerStyle` | `SelectionStyleOptions` | `centerMarker` |
843
+ | `RadiusLineStyle` | `SelectionStyleOptions` | `radiusLine` |
844
+ | `PointStyle`, `StrokeStyle` | `SelectionStyleOptions` | Its fields |
845
+ | `SnapDisableKey` | `SnappingOptions` | `disableKey` |
846
+ | `SnapTargetKind` | `SnappingOptions` | The keys of `kinds` |
847
+ | `ResolvedSnapOptions` | `options.get().snapping` | |
848
+ | `AutoNameType` | `AutoNameOptions` | The keys of `typeNames` |
849
+ | `PixelRatioInput`, `PixelRatioProvider` | `RenderingOptions` | `pixelRatio` |
850
+ | `DocumentStore`, `UiState` | `Store` | |
851
+ | `AutoNameGenerator` | `NameGenerator` | `ctx.names` |
852
+ | `CustomFeatureHandler` | `FeatureTypeDefinition` | |
853
+ | `CustomFeatureRenderer` | `FeatureRenderer` | |
854
+ | `CustomOverlayRenderer` | `OverlayRenderer` | |
855
+ | `LayerAwareOverlayRenderer` | `OverlayRenderer` | `drawForLayer` |
856
+ | `CustomRendererDrawContext` | `RenderContext` | |
857
+ | `AuxiliaryHandleProvider` | `HandleProvider` | |
858
+ | `AuxiliaryHandle`, `HandleInfo` | `Handle` | |
859
+ | `AdditionalHandleInfo` | `Handle` | |
860
+ | `HandleType` | `Handle` | `kind` |
861
+ | `AuxiliaryHandleContext` | `ScreenContext` | |
862
+ | `AuxiliaryHandleHit`, `CompanionHit` | `Hit` | |
863
+ | `HitTestResult`, `FeatureCompanionHitResult` | `Hit` | |
864
+ | `CompanionHitContext` | `HitTestContext` | |
865
+ | `FeatureCompanionProvider` | `CompanionProvider` | |
866
+ | `SnapProviderContext` | `SnapContext` | |
867
+ | `SnapPointCandidate`, `SnapSegmentCandidate` | `SnapCandidate` | |
868
+ | `SnapTarget`, `SnapTargetSegment` | `SnapResult` | `target` |
869
+ | `SnapLngLat` | `Position` | |
870
+ | `NormalizedEvent`, `MouseNormalizedEvent` | `DrawPointerEvent` | |
871
+ | `DragNormalizedEvent`, `HoverEvent` | `DrawPointerEvent` | |
872
+ | `PointerType` | `DrawPointerEvent` | `pointerType` |
873
+ | `PointerOriginalEvent` | `DrawPointerEvent` | `original` |
874
+ | `KeyNormalizedEvent` | `DrawKeyEvent` | |
875
+ | `ModifierKeys` | `Modifiers` | |
876
+ | `MouseLeaveEvent` | `InputHandlers` | `onPointerLeave` |
877
+ | `DatasetFeatureInput` | `DatasetRow` | |
878
+ | `DatasetFeatureProvider` | `DatasetProvider` | |
879
+ | `DatasetEventMap` | `DatasetEvents` | |
880
+ | `DatasetClickPayload` | `DatasetEvents` | `clicked` |
881
+ | `DatasetHoverPayload` | `DatasetEvents` | `hovered` |
882
+ | `DatasetChangePayload` | `DatasetEvents` | `changed` |
883
+ | `DatasetClickEventPayload` | `DrawEvents` | `dataset.clicked` |
884
+ | `MapClickEventPayload` | `DrawEvents` | `map.clicked` |
885
+ | `LoadErrorPayload` | `DrawEvents` | `error` |
886
+ | `DragStartData`, `DragEndData` | `DrawEvents` | `drag.started`, `drag.ended` |
887
+ | `Hooks`, `MutationContext` | `DrawEvents` | The payload has `source` |
888
+ | `ResolvedCollisionThinning` | `DatasetCollisionThinning` | `Required<>` |
889
+ | `DatasetColumn` | `Column` | `/table` |
890
+ | `DatasetColumnarGeometry` | `TableGeometry` | `/table` |
891
+ | `DatasetColumnarGeometryType` | `GeometryType` | `/table` |
892
+ | `DatasetColumnarInput` | `Table` | `/table` |
893
+ | `DatasetColumnarMixedGeometry` | `TableMixedGeometry` | `/table` |
894
+ | `DatasetColumnarPrepared` | `PreparedTable` | `/table` |
895
+ | `DatasetDictionaryColumn` | `DictionaryColumn` | `/table` |
896
+ | `DatasetDictionaryCodes` | `DictionaryColumn` | `codes`, `/table` |
897
+ | `resolveFeatureStyle` | `features.getAppliedStyle` | |
898
+ | `getCreatedZoom`, `setCreatedZoom` | `maplibre-gl-draw:createdZoom` | |
899
+ | `getRotation`, `setRotation` | `maplibre-gl-draw:rotation` | |
900
+ | `getScale` | `maplibre-gl-draw:scale` | A key of `properties` |
901
+ | `HitTestStrategy` | `FeatureTypeDefinition` | `hitTest` |
902
+ | `BoxSelectionStrategy` | `FeatureTypeDefinition` | `boxSelect` |
903
+ | `CustomBoundingBoxCalculator` | `FeatureTypeDefinition` | `bounds` |
904
+ | `PointFrameExtent` | `FeatureTypeDefinition` | `bounds` |
905
+ | `PointFrameExtentProvider` | `FeatureTypeDefinition` | `bounds` |
906
+ | `AdditionalResizeHandlesCalculator` | `FeatureTypeDefinition` | `handles` |
907
+ | `CustomResizeCalculator` | `FeatureTypeDefinition` | `onHandleDrag` |
908
+ | `CustomResizeResult` | `FeaturePatch` | What `onHandleDrag` returns |
909
+ | `ResizeStrategy` | `FeatureTypeDefinition` | `onHandleDrag` |
910
+ | `HitTestOptions` | `ModeContext` | `hitTest` |
911
+ | `HitTestService`, `HitTestTopmost` | `ModeContext` | `hitTest` |
912
+ | `TopHit`, `TopmostHitTestOptions` | `ModeContext` | `hitTest` |
913
+ | `SpatialQuery` | `ModeContext` | `hitTest` |
914
+ | `TentativeState` | `ModeContext` | `preview` |
915
+ | `EventEmitter` | `ExtensionContext` | `on`, `off`, `once` |
916
+ | `PluginManager` | `extensions.plugins` | |
917
+ | `AuxiliaryHandleRegistry` | `extensions.handleProviders` | |
918
+ | `FeatureCompanionRegistry` | `extensions.companionProviders` | |
919
+ | `createFeatureCompanionRegistry` | `extensions.companionProviders` | |
920
+ | `SDFLineRenderer` | `LineRenderer` | |
921
+ | `FillShaderManager` | `FillRenderer` | |
922
+ | `PointShapeRenderer` | `PointRenderer` | |
923
+ | `UnprojectFunction` | `ScreenContext` | `unproject` |
924
+ | `computeBoundingBox` | `ScreenContext` | `bounds` |
925
+ | `BoundingBoxCoords` | `ScreenContext` | What `bounds` returns |
926
+ | `resolvePixelRatio` | `ScreenContext` | `pixelRatio` |
927
+ | `TerrainRenderDiagnostics` | `TerrainDiagnostics` | Its fields |
928
+ | `TerrainDrapeDebug` | `TerrainDiagnostics` | Its fields |
929
+ | `anchorElevationMeters` | `TerrainAnchors` | `elevation` |
930
+ | `anchorGhostOpacity` | `TerrainAnchors` | `ghostOpacity` |
931
+ | `getAnchorElevationGeneration` | `TerrainAnchors` | `generation` |
932
+ | `calculateOffsetUniforms` | `RenderContext` | `offset` |
933
+ | `getProjectionTransitionUniform` | `RenderContext` | `projection` |
934
+ | `GeometryOperations`, `GeometryApi` | `features` | `union` and the rest |
935
+ | `GeometryApiDeps`, `createGeometryApi` | `features` | |
936
+ | `GeometryBufferOptions` | `features.buffer` | Its options |
937
+ | `SnappingOperations` | `options` | `snapping` |
938
+ | `TracingOperations` | `options` | `tracing` |
939
+ | `TopologyOperations` | `options` | `topology` |
940
+ | `ExportFormat`, `ExportResult` | `document` | `toJSON`, `toGeoJSON` |
941
+ | `BoundingBox` | `BBox` | `/geometry` |
942
+ | `metersToDegreesLat`, `metersToDegreesLng` | `metersToDegrees` | `/geometry` |
943
+ | `generateCirclePolygon` | `circle` | `/geometry` |
944
+ | `getSelectedFeatureIds` | `selection.get().ids` | |
945
+ | `getStrokeDashPattern` | `dashPattern` | `/webgl` |
946
+ | `getTerrainTessellationStep` | `terrainTessellationStep` | `/webgl` |
947
+ | `ShaderData`, `OffsetUniforms` | Main entry | Now under semver |
948
+ | `applyDrawBlendState`, `BlendCapableGL` | `/webgl` | |
949
+ | `calculateLngLatOffset`, `computeQuadVertices` | `/webgl` | |
950
+ | `createProgram`, `DashSegment` | `/webgl` | |
951
+ | `DEFAULT_TILE_SIZE`, `densifyPath` | `/webgl` | |
952
+ | `DrapeQuadCorners`, `drawBillboardsWithoutDepth` | `/webgl` | |
953
+ | `drawQuadSurfaceOnTerrain`, `MercatorRect` | `/webgl` | |
954
+ | `OFFSET_MODE_GLSL`, `PointHitTestStrategy` | `/webgl` | |
955
+ | `ProjectionUniformLocations`, `ProjectionUniformManager` | `/webgl` | |
956
+ | `QUAD_GLYPH_STRIDE`, `QuadDrapeColor` | `/webgl` | |
957
+ | `QuadDrapeFill`, `QuadDrapeGlyphs` | `/webgl` | |
958
+ | `QuadDrapeSurface`, `QuadShader` | `/webgl` | |
959
+ | `QuadVertices`, `SDFStrokeOptions` | `/webgl` | |
960
+ | `SDFStrokeStyle`, `splitIntoDashes` | `/webgl` | |
961
+ | `TerrainContext`, `TerrainRenderState` | (removed) | `RenderContext` |
962
+ | `TessellationStep`, `TessellationTiling` | `/webgl` | |
963
+ | `WidthUnit` | `/webgl` | |
964
+ | `ExportOptions` | (removed) | Export every feature |
965
+ | `GeometryAppliedPayload` | (removed) | The methods return the result |
966
+ | `GeometryOperationName` | (removed) | |
967
+ | `InputOperations`, `SyntheticInputOptions` | (removed) | No synthetic input |
968
+ | `SyntheticKeyOptions`, `SyntheticLngLat` | (removed) | |
969
+ | `SyntheticModifiers`, `SnapInputType` | (removed) | |
970
+ | `UpdateFeatureOptions` | (removed) | `isIntermediate` in changes |
971
+ | `BoxSelection`, `DragState` | (removed) | Internal state |
972
+ | `DragOperationType`, `RotateInfo` | (removed) | |
973
+ | `BoundingBoxCoordsSimple`, `ResizeState` | (removed) | |
974
+ | `VertexHit`, `SnapExcludeVertex` | (removed) | |
975
+ | `HookName` | (removed) | |
976
+ | `FeatureLockStore`, `InteractionGateStore` | (removed) | Read `locked` |
977
+ | `isFeatureLocked`, `isGroupLocked` | `features.isEditable` | Read-only too |
978
+ | `isInteractionBlocked` | (removed) | `isInteractionLocked` |
979
+ | `MemoryStore` | (removed) | Leave `store` out |
980
+ | `MESSAGES_EN` | (removed) | Pass only your words |
981
+ | `createGuideSnapProvider` | (removed) | Guides are built in |
982
+ | `GuideSnapProviderDeps`, `GuideSnapProviderOptions` | (removed) | |
983
+ | `DEFAULT_SNAP_GUIDE_LINE_STYLE` | `snapping.guideLine` | An option |
984
+ | `DEFAULT_SNAP_INDICATOR_STYLES` | `snapping.indicator` | An option |
985
+ | `SnapIndicatorStyles` | `snapping.indicator` | |
986
+ | `buildTraceGraph`, `findTracePath` | (removed) | Tracing is built in |
987
+ | `TraceGraph`, `TraceGraphEdge` | (removed) | |
988
+ | `TraceGraphEndpoint`, `TraceGraphNode` | (removed) | |
989
+ | `applyRuleColor`, `resolveRuleColor` | (removed) | `evaluateStyleRule` |
990
+ | `StyleRuleChannel` | (removed) | |
991
+ | `BoxSelectionStrategyRegistry` | (removed) | |
992
+ | `SelectionExtensionRegistry`, `SelectionScope` | (removed) | |
993
+ | `createSelectionExtensionRegistry` | (removed) | |
994
+ | `metersToMercatorScale`, `lngLatToMercator` | (removed) | Keep your own |
995
+ | `MercatorCoord`, `OBB`, `OBBCorners` | (removed) | |
996
+ | `createOBB`, `distanceToOBB`, `getOBBAABB` | (removed) | |
997
+ | `rectangleIntersectsOBB`, `hasZeroArea` | (removed) | |
998
+ | `pixelsToDegreesLat`, `pixelsToDegreesLng` | (removed) | |
999
+ | `getContrastColor`, `getExpandedViewportBounds` | (removed) | |
1000
+ | `DEFAULT_VIEWPORT_EXPANSION_FACTOR` | (removed) | |
1001
+ | `DEFAULT_POINT_FRAME_SIZE` | (removed) | |
1002
+ | `TentativeStyle` | (removed) | `DrawOptions.previewStyle` |
1003
+ | `BoxSelectionStyleConfig` | (removed) | `boxSelection` |
1004
+ | `FillStyle` | (removed) | `boxSelection` |
1005
+
1006
+ #### Geometry
1007
+
1008
+ `@sakuzu/maplibre-gl-draw/geometry` goes from 60 exports to 31. The
1009
+ functions take GeoJSON geometries or features and return geometries;
1010
+ lengths are in meters.
1011
+
1012
+ | 1.0 | 2.0 | Note |
1013
+ | --- | --- | --- |
1014
+ | `haversineDistanceMeters` | `distance` | |
1015
+ | `initialBearingDegrees` | `bearing` | |
1016
+ | `destinationPoint` | `destination` | |
1017
+ | `getPointAtAngle` | `destination` | |
1018
+ | (none) | `midpoint`, `along` | |
1019
+ | (none) | `nearestPointOnLine` | |
1020
+ | `geodesicLength` | `length` | |
1021
+ | `sphericalArea` | `area` | |
1022
+ | (none) | `perimeter` | |
1023
+ | `centroid` | `centroid` | A `Point` or `null` |
1024
+ | `pointOnSurface` | `pointOnSurface` | A `Point` or `null` |
1025
+ | `generateCirclePolygon` | `circle` | |
1026
+ | `buffer` | `buffer` | |
1027
+ | `BufferOptions` | (removed) | `{ segments }` |
1028
+ | `DEFAULT_BUFFER_SEGMENTS` | (removed) | |
1029
+ | `union(a, b)` | `union([a, b])` | |
1030
+ | `unionAll` | `union` | |
1031
+ | `intersection(a, b)` | `intersection([a, b])` | |
1032
+ | `intersectionAll` | `intersection` | |
1033
+ | `clip` | `intersection` | |
1034
+ | `difference(a, b)` | `difference(a, [b])` | |
1035
+ | `differenceAll` | `difference` | |
1036
+ | `splitArea` | `split` | |
1037
+ | `pointInPolygon` | `pointInPolygon` | |
1038
+ | `intersects` | `overlaps` | Touching is false |
1039
+ | `contains` | `contains` | |
1040
+ | `within(a, b)` | `contains(b, a)` | |
1041
+ | `bboxIntersects` | `bboxIntersects` | |
1042
+ | `bboxContains` | `bboxContains` | |
1043
+ | `normalizeArea` | `makeValid` | |
1044
+ | `normalizeRingOrientation` | `rewind` | |
1045
+ | `normalizePolygonOrientation` | `rewind` | |
1046
+ | `normalizeMultiPolygonOrientation` | `rewind` | |
1047
+ | `isRingClockwise` | `rewind` | |
1048
+ | `simplify` | `simplify` | Tolerance in meters |
1049
+ | `boundingBox`, `coordinatesBBox` | `bbox` | Throws when empty |
1050
+ | `metersToDegreesLat` (main) | `metersToDegrees` | |
1051
+ | `metersToDegreesLng` (main) | `metersToDegrees` | |
1052
+ | `BBox` | `BBox` | |
1053
+ | `EARTH_RADIUS_METERS` | `EARTH_RADIUS_METERS` | 6371008.8 |
1054
+ | `GeometryError` | `GeometryError` | |
1055
+ | `GeometryErrorCode` | `GeometryErrorCode` | |
1056
+ | `GeometryOperation` | `GeometryError` | `operation` |
1057
+ | `closeRing`, `isRingClosed` | (removed) | |
1058
+ | `flattenAreaCoordinates` | (removed) | |
1059
+ | `isMultiPolygonCoordinates` | (removed) | |
1060
+ | `toMultiPolygonCoordinates` | (removed) | |
1061
+ | `signedRingArea` | (removed) | |
1062
+ | `segmentIntersection` | (removed) | |
1063
+ | `toDegrees`, `toRadians` | (removed) | |
1064
+ | `Coordinate`, `Ring` | GeoJSON `Position` | |
1065
+ | `AreaCoordinates` | GeoJSON `Polygon` | |
1066
+ | `PolygonCoordinates` | GeoJSON `Polygon` | |
1067
+ | `MultiPolygonCoordinates` | GeoJSON `MultiPolygon` | |
1068
+ | `GeometryInput` | GeoJSON `Geometry` | |
1069
+ | `PointGeometry` | GeoJSON `Point` | |
1070
+ | `MultiPointGeometry` | GeoJSON `MultiPoint` | |
1071
+ | `LineStringGeometry` | GeoJSON `LineString` | |
1072
+ | `MultiLineStringGeometry` | GeoJSON `MultiLineString` | |
1073
+ | `PolygonGeometry` | GeoJSON `Polygon` | |
1074
+ | `MultiPolygonGeometry` | GeoJSON `MultiPolygon` | |
1075
+
1076
+ #### Table
1077
+
1078
+ `@sakuzu/maplibre-gl-draw/columnar` is `@sakuzu/maplibre-gl-draw/table`.
1079
+
1080
+ | 1.0 | 2.0 | Note |
1081
+ | --- | --- | --- |
1082
+ | `prepareDatasetColumnar` | `prepareTable` | Returns the table with it |
1083
+ | `columnarTransferables` | `transferList` | |
1084
+ | `DatasetColumnarInput` | `Table` | |
1085
+ | `DatasetColumnarPrepared` | `PreparedTable` | |
1086
+ | `DatasetColumnarGeometry` | `TableGeometry` | |
1087
+ | `DatasetColumnarMixedGeometry` | `TableMixedGeometry` | |
1088
+ | `DatasetColumnarGeometryType` | `GeometryType` | |
1089
+ | `DatasetColumn` | `Column` | |
1090
+ | `DatasetDictionaryColumn` | `DictionaryColumn` | |
1091
+ | `DatasetDictionaryCodes` | `DictionaryColumn` | `codes` |
1092
+ | (none) | `tableFromFeatures` | |
1093
+ | (none) | `createTableBuilder`, `TableBuilder` | |
1094
+
1095
+ The members of a dataset:
1096
+
1097
+ | 1.0 | 2.0 | Note |
1098
+ | --- | --- | --- |
1099
+ | `DatasetOptions.features` | `DatasetOptions.rows` | |
1100
+ | `columnar`, `prepared` | `DatasetOptions.table` | Either form |
1101
+ | `DatasetOptions.provider` | `DatasetOptions.provider` | |
1102
+ | `setFeatures` | `setRows` | |
1103
+ | `setColumnar(input, prepared)` | `setTable(table)` | |
1104
+ | `getFeatures` | `listRows` | |
1105
+ | `collectVisible` | `listVisibleRows` | |
1106
+ | `collectDrawnRows` | `listDrawnRows` | |
1107
+ | `getRowFeature` | `getRow` | |
1108
+ | `getVisibleFeatureIds` | `listVisibleRowIds` | |
1109
+ | `getSelectedIds` | `getSelectedRowIds` | |
1110
+ | `setSelectedIds` | `setSelectedRowIds` | |
1111
+ | `invalidateProviderCache` | `refresh` | |
1112
+ | `remove()` | `draw.datasets.remove(id)` | |
1113
+ | The events `click`, `hover` | `clicked`, `hovered` | |
1114
+ | The event `change` | `changed` | Reason `features` is `rows` |
1115
+
9
1116
  ## [1.0.0] - 2026-09-27
10
1117
 
11
1118
  First public release, under AGPL-3.0-only. A commercial license is
12
1119
  available from Kasika, Inc.
13
1120
 
14
- ### Added
1121
+ ### Added in 1.0.0
15
1122
 
16
1123
  - Drawing points, lines, polygons, circles and freehand lines with the
17
1124
  mouse, touch, a pen or the keyboard, and placing images on the map.
@@ -39,5 +1146,5 @@ available from Kasika, Inc.
39
1146
  - A read-only mode and an interaction lock.
40
1147
  - Plugins, custom modes and custom feature types.
41
1148
 
42
- [Unreleased]: https://github.com/sakuzu/maplibre-gl-draw/compare/v1.0.0...HEAD
1149
+ [2.0.0]: https://github.com/sakuzu/maplibre-gl-draw/compare/v1.0.0...v2.0.0
43
1150
  [1.0.0]: https://github.com/sakuzu/maplibre-gl-draw/releases/tag/v1.0.0