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.
- package/CHANGELOG.md +19 -0
- package/README.md +41 -24
- package/dist/cjs/main.js +1283 -44
- package/dist/es/main.mjs +2 -1
- package/dist/es/main10.mjs +71 -10
- package/dist/es/main10.mjs.map +1 -1
- package/dist/es/main11.mjs +12 -35
- package/dist/es/main11.mjs.map +1 -1
- package/dist/es/main12.mjs +12 -13
- package/dist/es/main12.mjs.map +1 -1
- package/dist/es/main13.mjs +42 -24
- package/dist/es/main13.mjs.map +1 -1
- package/dist/es/main14.mjs +13 -4
- package/dist/es/main14.mjs.map +1 -1
- package/dist/es/main15.mjs +22 -31
- package/dist/es/main15.mjs.map +1 -1
- package/dist/es/main16.mjs +87 -22
- package/dist/es/main16.mjs.map +1 -1
- package/dist/es/main17.mjs +14 -94
- package/dist/es/main17.mjs.map +1 -1
- package/dist/es/main18.mjs +22 -62
- package/dist/es/main18.mjs.map +1 -1
- package/dist/es/main19.mjs +27 -20
- package/dist/es/main19.mjs.map +1 -1
- package/dist/es/main20.mjs +8 -23
- package/dist/es/main20.mjs.map +1 -1
- package/dist/es/main21.mjs +34 -16
- package/dist/es/main21.mjs.map +1 -1
- package/dist/es/main22.mjs +12 -80
- package/dist/es/main22.mjs.map +1 -1
- package/dist/es/main23.mjs +26 -0
- package/dist/es/main23.mjs.map +1 -0
- package/dist/es/main24.mjs +5 -0
- package/dist/es/main24.mjs.map +1 -0
- package/dist/es/main25.mjs +33 -0
- package/dist/es/main25.mjs.map +1 -0
- package/dist/es/main26.mjs +27 -0
- package/dist/es/main26.mjs.map +1 -0
- package/dist/es/main27.mjs +98 -0
- package/dist/es/main27.mjs.map +1 -0
- package/dist/es/main28.mjs +66 -0
- package/dist/es/main28.mjs.map +1 -0
- package/dist/es/main29.mjs +23 -0
- package/dist/es/main29.mjs.map +1 -0
- package/dist/es/main3.mjs +13 -4
- package/dist/es/main3.mjs.map +1 -1
- package/dist/es/main30.mjs +27 -0
- package/dist/es/main30.mjs.map +1 -0
- package/dist/es/main31.mjs +19 -0
- package/dist/es/main31.mjs.map +1 -0
- package/dist/es/main32.mjs +83 -0
- package/dist/es/main32.mjs.map +1 -0
- package/dist/es/main33.mjs +501 -0
- package/dist/es/main33.mjs.map +1 -0
- package/dist/es/main34.mjs +90 -0
- package/dist/es/main34.mjs.map +1 -0
- package/dist/es/main35.mjs +6 -0
- package/dist/es/main35.mjs.map +1 -0
- package/dist/es/main36.mjs +26 -0
- package/dist/es/main36.mjs.map +1 -0
- package/dist/es/main37.mjs +19 -0
- package/dist/es/main37.mjs.map +1 -0
- package/dist/es/main38.mjs +50 -0
- package/dist/es/main38.mjs.map +1 -0
- package/dist/es/main39.mjs +31 -0
- package/dist/es/main39.mjs.map +1 -0
- package/dist/es/main4.mjs +3 -3
- package/dist/es/main40.mjs +9 -0
- package/dist/es/main40.mjs.map +1 -0
- package/dist/es/main41.mjs +62 -0
- package/dist/es/main41.mjs.map +1 -0
- package/dist/es/main42.mjs +42 -0
- package/dist/es/main42.mjs.map +1 -0
- package/dist/es/main5.mjs +22 -2
- package/dist/es/main5.mjs.map +1 -1
- package/dist/es/main6.mjs +1 -1
- package/dist/es/main7.mjs +1 -1
- package/dist/es/main8.mjs +87 -20
- package/dist/es/main8.mjs.map +1 -1
- package/dist/es/main9.mjs +80 -24
- package/dist/es/main9.mjs.map +1 -1
- package/dist/maplibre/cjs/main.js +30 -9
- package/dist/maplibre/es/main.mjs +2 -1
- package/dist/maplibre/es/main.mjs.map +1 -1
- package/dist/maplibre/es/main14.mjs +1 -1
- package/dist/maplibre/es/main14.mjs.map +1 -1
- package/dist/maplibre/es/main16.mjs +2 -1
- package/dist/maplibre/es/main16.mjs.map +1 -1
- package/dist/maplibre/es/main3.mjs +2 -2
- package/dist/maplibre/es/main3.mjs.map +1 -1
- package/dist/maplibre/es/main5.mjs +21 -1
- package/dist/maplibre/es/main5.mjs.map +1 -1
- package/dist/maplibre/types/api/coords-to-vector-3.d.ts +1 -0
- package/dist/maplibre/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
- package/dist/maplibre/types/core/canvas-in-layer/use-render.d.ts +5 -1
- package/dist/maplibre/types/core/earth-radius.d.ts +1 -1
- package/dist/maplibre/types/core/generic-map.d.ts +2 -2
- package/dist/maplibre/types/{mapbox → maplibre}/canvas.d.ts +1 -1
- package/dist/maplibre/types/maplibre.index.d.ts +1 -1
- package/dist/types/api/coords-to-vector-3.d.ts +1 -0
- package/dist/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
- package/dist/types/core/canvas-in-layer/use-render.d.ts +5 -1
- package/dist/types/core/earth-radius.d.ts +1 -1
- package/dist/types/core/generic-map.d.ts +2 -2
- package/dist/types/mapbox/canvas.d.ts +1 -1
- package/made-with/studio-carto-urban-project.webp +0 -0
- package/package.json +7 -7
- package/stories/package.json +4 -4
- 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
|
|
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/
|
|
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/
|
|
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
|
|
124
|
-
| ---------
|
|
125
|
-
| latitude
|
|
126
|
-
| longitude
|
|
127
|
-
| altitude
|
|
128
|
-
| frameloop
|
|
129
|
-
| overlay
|
|
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
|
|
176
|
-
| ---------
|
|
177
|
-
| latitude
|
|
178
|
-
| longitude
|
|
179
|
-
| altitude
|
|
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://rodrigohamuy.github.io/react-three-map/?story=multi-coordinates--default)
|
|
184
199
|
|
|
185
|
-
Same as `Coordinates`, but
|
|
200
|
+
Same as `Coordinates`, but scale is ignored in exchange of being able to be rendered under the same scene.
|
|
186
201
|
|
|
187
|
-
|
|
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
|
|
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`
|
|
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.
|