react-three-map 0.8.1 → 1.0.0-next.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 (109) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +41 -24
  3. package/dist/cjs/main.js +1283 -44
  4. package/dist/es/main.mjs +2 -1
  5. package/dist/es/main10.mjs +71 -10
  6. package/dist/es/main10.mjs.map +1 -1
  7. package/dist/es/main11.mjs +12 -35
  8. package/dist/es/main11.mjs.map +1 -1
  9. package/dist/es/main12.mjs +12 -13
  10. package/dist/es/main12.mjs.map +1 -1
  11. package/dist/es/main13.mjs +42 -24
  12. package/dist/es/main13.mjs.map +1 -1
  13. package/dist/es/main14.mjs +13 -4
  14. package/dist/es/main14.mjs.map +1 -1
  15. package/dist/es/main15.mjs +22 -31
  16. package/dist/es/main15.mjs.map +1 -1
  17. package/dist/es/main16.mjs +87 -22
  18. package/dist/es/main16.mjs.map +1 -1
  19. package/dist/es/main17.mjs +14 -94
  20. package/dist/es/main17.mjs.map +1 -1
  21. package/dist/es/main18.mjs +22 -62
  22. package/dist/es/main18.mjs.map +1 -1
  23. package/dist/es/main19.mjs +27 -20
  24. package/dist/es/main19.mjs.map +1 -1
  25. package/dist/es/main20.mjs +8 -23
  26. package/dist/es/main20.mjs.map +1 -1
  27. package/dist/es/main21.mjs +34 -16
  28. package/dist/es/main21.mjs.map +1 -1
  29. package/dist/es/main22.mjs +12 -80
  30. package/dist/es/main22.mjs.map +1 -1
  31. package/dist/es/main23.mjs +26 -0
  32. package/dist/es/main23.mjs.map +1 -0
  33. package/dist/es/main24.mjs +5 -0
  34. package/dist/es/main24.mjs.map +1 -0
  35. package/dist/es/main25.mjs +33 -0
  36. package/dist/es/main25.mjs.map +1 -0
  37. package/dist/es/main26.mjs +27 -0
  38. package/dist/es/main26.mjs.map +1 -0
  39. package/dist/es/main27.mjs +98 -0
  40. package/dist/es/main27.mjs.map +1 -0
  41. package/dist/es/main28.mjs +66 -0
  42. package/dist/es/main28.mjs.map +1 -0
  43. package/dist/es/main29.mjs +23 -0
  44. package/dist/es/main29.mjs.map +1 -0
  45. package/dist/es/main3.mjs +13 -4
  46. package/dist/es/main3.mjs.map +1 -1
  47. package/dist/es/main30.mjs +27 -0
  48. package/dist/es/main30.mjs.map +1 -0
  49. package/dist/es/main31.mjs +19 -0
  50. package/dist/es/main31.mjs.map +1 -0
  51. package/dist/es/main32.mjs +83 -0
  52. package/dist/es/main32.mjs.map +1 -0
  53. package/dist/es/main33.mjs +501 -0
  54. package/dist/es/main33.mjs.map +1 -0
  55. package/dist/es/main34.mjs +90 -0
  56. package/dist/es/main34.mjs.map +1 -0
  57. package/dist/es/main35.mjs +6 -0
  58. package/dist/es/main35.mjs.map +1 -0
  59. package/dist/es/main36.mjs +26 -0
  60. package/dist/es/main36.mjs.map +1 -0
  61. package/dist/es/main37.mjs +19 -0
  62. package/dist/es/main37.mjs.map +1 -0
  63. package/dist/es/main38.mjs +50 -0
  64. package/dist/es/main38.mjs.map +1 -0
  65. package/dist/es/main39.mjs +31 -0
  66. package/dist/es/main39.mjs.map +1 -0
  67. package/dist/es/main4.mjs +3 -3
  68. package/dist/es/main40.mjs +9 -0
  69. package/dist/es/main40.mjs.map +1 -0
  70. package/dist/es/main41.mjs +62 -0
  71. package/dist/es/main41.mjs.map +1 -0
  72. package/dist/es/main42.mjs +42 -0
  73. package/dist/es/main42.mjs.map +1 -0
  74. package/dist/es/main5.mjs +22 -2
  75. package/dist/es/main5.mjs.map +1 -1
  76. package/dist/es/main6.mjs +1 -1
  77. package/dist/es/main7.mjs +1 -1
  78. package/dist/es/main8.mjs +87 -20
  79. package/dist/es/main8.mjs.map +1 -1
  80. package/dist/es/main9.mjs +80 -24
  81. package/dist/es/main9.mjs.map +1 -1
  82. package/dist/maplibre/cjs/main.js +30 -9
  83. package/dist/maplibre/es/main.mjs +2 -1
  84. package/dist/maplibre/es/main.mjs.map +1 -1
  85. package/dist/maplibre/es/main14.mjs +1 -1
  86. package/dist/maplibre/es/main14.mjs.map +1 -1
  87. package/dist/maplibre/es/main16.mjs +2 -1
  88. package/dist/maplibre/es/main16.mjs.map +1 -1
  89. package/dist/maplibre/es/main3.mjs +2 -2
  90. package/dist/maplibre/es/main3.mjs.map +1 -1
  91. package/dist/maplibre/es/main5.mjs +21 -1
  92. package/dist/maplibre/es/main5.mjs.map +1 -1
  93. package/dist/maplibre/types/api/coords-to-vector-3.d.ts +1 -0
  94. package/dist/maplibre/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
  95. package/dist/maplibre/types/core/canvas-in-layer/use-render.d.ts +5 -1
  96. package/dist/maplibre/types/core/earth-radius.d.ts +1 -1
  97. package/dist/maplibre/types/core/generic-map.d.ts +2 -2
  98. package/dist/maplibre/types/{mapbox → maplibre}/canvas.d.ts +1 -1
  99. package/dist/maplibre/types/maplibre.index.d.ts +1 -1
  100. package/dist/types/api/coords-to-vector-3.d.ts +1 -0
  101. package/dist/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
  102. package/dist/types/core/canvas-in-layer/use-render.d.ts +5 -1
  103. package/dist/types/core/earth-radius.d.ts +1 -1
  104. package/dist/types/core/generic-map.d.ts +2 -2
  105. package/dist/types/mapbox/canvas.d.ts +1 -1
  106. package/made-with/studio-carto-urban-project.webp +0 -0
  107. package/package.json +7 -7
  108. package/stories/package.json +4 -4
  109. package/stories/yarn.lock +175 -98
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # react-three-map
2
2
 
3
+ ## 1.0.0-next.0
4
+
5
+ ### Major Changes
6
+
7
+ - 9be6c41: Updated to work with `react-map-gl >= 8.0.0`.
8
+
9
+ This has the cascade effect of requiring also to upgrade either of the map providers you are using:
10
+
11
+ - `mapbox-gl >= 3.5.0`
12
+ - `maplibre-gl >= 4.0.0`
13
+
14
+ ## 0.8.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 58c42d9: - Improve accuracy at long distances for `coordsToVector3`.
19
+ - Improve translation accuracy for `NearCoordinates`, but scale is still ignored.
20
+ - Update `earthRadius` from `6378137` to `6371008.8` to match [Mapbox](https://github.com/maplibre/maplibre-gl-js/blob/8ea76118210dd18fa52fdb83f2cbdd1229807346/src/geo/lng_lat.ts#L8) and [Maplibre](https://github.com/maplibre/maplibre-gl-js/blob/main/src/geo/lng_lat.ts#L8).
21
+
3
22
  ## 0.8.1
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -11,10 +11,10 @@
11
11
 
12
12
  Until now you had:
13
13
 
14
- | imperative | declarative (react) |
15
- | --------------- | ----------------- |
16
- | Maplibre/Mapbox | react-map-gl |
17
- | THREE.js | react-three-fiber |
14
+ | imperative | declarative (react) |
15
+ | --------------- | ------------------- |
16
+ | Maplibre/Mapbox | react-map-gl |
17
+ | THREE.js | react-three-fiber |
18
18
 
19
19
  Now with `react-three-map`, you can use them together :fist_right::star::fist_left:.
20
20
 
@@ -22,6 +22,21 @@ Now with `react-three-map`, you can use them together :fist_right::star::fist_le
22
22
  npm install react-three-map
23
23
  ```
24
24
 
25
+ - [React Three Map](#react-three-map)
26
+ - [:book: Examples](#book-examples)
27
+ - [:mag: What does it look like?](#mag-what-does-it-look-like)
28
+ - [:thinking: Why we build this?](#thinking-why-we-build-this)
29
+ - [:gear: API](#gear-api)
30
+ - [Canvas](#canvas)
31
+ - [Render Props](#render-props)
32
+ - [Render Props removed from `@react-three/fiber`](#render-props-removed-from-react-threefiber)
33
+ - [Coordinates](#coordinates)
34
+ - [NearCoordinates](#nearcoordinates)
35
+ - [useMap](#usemap)
36
+ - [coordsToVector3](#coordstovector3)
37
+ - [vector3ToCoords](#vector3tocoords)
38
+
39
+
25
40
  ## :book: Examples
26
41
 
27
42
  Check out our examples [here](https://rodrigohamuy.github.io/react-three-map) (powered by [Ladle](https://ladle.dev/)).
@@ -32,9 +47,9 @@ Check out our examples [here](https://rodrigohamuy.github.io/react-three-map) (p
32
47
  <table>
33
48
  <tbody>
34
49
  <tr>
35
- <td>Let's build the same <code>react-three-fiber</code> basic example, but now it can be inside a map. (<a href="https://codesandbox.io/p/sandbox/vigorous-snyder-2n9vpl?file=%2Fsrc%2FApp.tsx%3A48%2C45">live demo</a>).</td>
50
+ <td>Let's build the same <code>react-three-fiber</code> basic example, but now it can be inside a map. (<a href="https://codesandbox.io/p/sandbox/react-three-map-gettings-started-dhw34w">live demo</a>).</td>
36
51
  <td>
37
- <a href="https://codesandbox.io/p/sandbox/vigorous-snyder-2n9vpl?file=%2Fsrc%2FApp.tsx%3A48%2C45">
52
+ <a href="https://codesandbox.io/p/sandbox/react-three-map-gettings-started-dhw34w">
38
53
  <img src="docs/basic-app.gif" />
39
54
  </a>
40
55
  </td>
@@ -120,13 +135,13 @@ It shares most of the props from R3F `<Canvas>`, so you can check them directly
120
135
 
121
136
  #### Render Props
122
137
 
123
- | Prop | Description | Default |
124
- | --------- | ------------------------------------------------ | ---------- |
125
- | latitude | The latitude coordinate where to add the scene. | |
126
- | longitude | The longitude coordinate where to add the scene. | |
127
- | altitude | The altitude coordinate where to add the scene. | `0` |
128
- | frameloop | Render mode: `"always"`, `"demand"`. | `"always"` |
129
- | overlay | Render on a separated canvas. | `false` |
138
+ | Prop | Description | Default |
139
+ | --------- | ------------------------------------------------ | ---------- |
140
+ | latitude | The latitude coordinate where to add the scene. | |
141
+ | longitude | The longitude coordinate where to add the scene. | |
142
+ | altitude | The altitude coordinate where to add the scene. | `0` |
143
+ | frameloop | Render mode: `"always"`, `"demand"`. | `"always"` |
144
+ | overlay | Render on a separated canvas. | `false` |
130
145
 
131
146
  **About `overlay`**
132
147
 
@@ -172,21 +187,21 @@ import { Canvas, Coordinates } from 'react-three-map'
172
187
  </Canvas>
173
188
  ```
174
189
 
175
- | Props | Description | Default |
176
- | --------- | ------------------------------------------------ | ---------- |
177
- | latitude | The latitude coordinate where to add the scene. | |
178
- | longitude | The longitude coordinate where to add the scene. | |
179
- | altitude | The altitude coordinate where to add the scene. | `0` |
190
+ | Props | Description | Default |
191
+ | --------- | ------------------------------------------------ | ------- |
192
+ | latitude | The latitude coordinate where to add the scene. | |
193
+ | longitude | The longitude coordinate where to add the scene. | |
194
+ | altitude | The altitude coordinate where to add the scene. | `0` |
180
195
 
181
196
  ### NearCoordinates
182
197
 
183
198
  [![](https://img.shields.io/badge/-demo-%23ff69b4)](https://rodrigohamuy.github.io/react-three-map/?story=multi-coordinates--default)
184
199
 
185
- Same as `Coordinates`, but with an error margin that increases the further you are from the origin.
200
+ Same as `Coordinates`, but scale is ignored in exchange of being able to be rendered under the same scene.
186
201
 
187
- Recommended to use at city level distances, but margin errors will be noticeable at country level distances.
202
+ Works well at city level distances, but since scale remains unchanged, is not recommended at country level distances.
188
203
 
189
- Check the story to see the difference between the two.
204
+ Check the story to see the difference between the two or check #102 for more info.
190
205
 
191
206
  ### useMap
192
207
 
@@ -208,7 +223,7 @@ const Component = () => {
208
223
 
209
224
  This utility function converts geographic coordinates into a `Vector3Tuple`, which represents a 3D vector in meters.
210
225
 
211
- Similar to `NearCoordinates` it has a relatively good precision at city distances, but is not recommended if your distances are too big.
226
+ Similar to `NearCoordinates`, remember that this only updates positions (translation) but that scale is not taken into account, which has an important factor at very long distances (country level).
212
227
 
213
228
 
214
229
  | Parameter | Description |
@@ -224,11 +239,13 @@ Returns a `Vector3Tuple` representing the 3D position of the point relative to t
224
239
 
225
240
  This utility function converts a `Vector3Tuple`, which represents a 3D vector in meters, back into geographic coordinates.
226
241
 
227
- It is the inverse of `coordsToVector3` and maintains the same level of precision. It is not recommended for use with very large distances.
242
+ It is the inverse of `coordsToVector3` but it does not have a good level of precision at long distances since we haven't reverse engineered #102 fix yet.
243
+
244
+ Recommended to use at city level distances, but margin errors will be noticeable at country level distances.
228
245
 
229
246
  | Parameter | Description |
230
247
  | ------------------------ | --------------------------------------------------------------- |
231
248
  | `position: Vector3Tuple` | The 3D vector to convert back into geographic coordinates. |
232
249
  | `origin: Coords` | The geographic coordinates used as the origin for calculations. |
233
250
 
234
- Returns a `Coords` object representing the geographic coordinates of the point relative to the origin.
251
+ Returns a `Coords` object representing the geographic coordinates of the point relative to the origin.