@sakuzu/maplibre-gl-draw 1.0.0 → 2.0.0

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