@math.gl/web-mercator 4.0.1 → 4.1.0-alpha.1
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/dist/fit-bounds.d.ts +14 -12
- package/package.json +5 -2
- package/src/fit-bounds.ts +15 -14
package/dist/fit-bounds.d.ts
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options for fitBounds
|
|
3
|
-
* @param width - viewport width
|
|
4
|
-
* @param height - viewport height
|
|
5
|
-
* @param bounds - [[lon, lat], [lon, lat]]
|
|
6
|
-
* @param minExtent - The width/height of the bounded area will never be smaller than this
|
|
7
|
-
* @param padding - The amount of padding in pixels
|
|
8
|
-
* to add to the given bounds. Can also be an object with top, bottom, left and right
|
|
9
|
-
* properties defining the padding.
|
|
10
|
-
* @param options.offset= - The center of the given bounds relative to the map's center,
|
|
11
3
|
*/
|
|
12
4
|
export type FitBoundsOptions = {
|
|
5
|
+
/** viewport width */
|
|
13
6
|
width: number;
|
|
7
|
+
/** viewport height */
|
|
14
8
|
height: number;
|
|
9
|
+
/** [[lon, lat], [lon, lat]] */
|
|
15
10
|
bounds: [[number, number], [number, number]];
|
|
11
|
+
/** The width/height of the bounded area will never be smaller than this. 0.01 would be about 1000 meters (degree is ~110KM) */
|
|
16
12
|
minExtent?: number;
|
|
13
|
+
/** The maximum zoom level to fit the bounds within. */
|
|
17
14
|
maxZoom?: number;
|
|
15
|
+
/**
|
|
16
|
+
* padding - The amount of padding in pixels to add to the given bounds.
|
|
17
|
+
* Can also be an object with top, bottom, left and right properties defining the padding.
|
|
18
|
+
*/
|
|
18
19
|
padding?: number | Padding;
|
|
20
|
+
/** The center of the given bounds relative to the map's center, */
|
|
19
21
|
offset?: number[];
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
22
24
|
* An object describing the padding to add to the bounds.
|
|
23
|
-
* @property top - Padding from top in pixels to add to the given bounds
|
|
24
|
-
* @property bottom - Padding from bottom in pixels to add to the given bounds
|
|
25
|
-
* @property left - Padding from left in pixels to add to the given bounds
|
|
26
|
-
* @property right - Padding from right in pixels to add to the given bounds
|
|
27
25
|
*/
|
|
28
26
|
export type Padding = {
|
|
27
|
+
/** Padding from top in pixels to add to the given bounds */
|
|
29
28
|
top: number;
|
|
29
|
+
/** Padding from bottom in pixels to add to the given bounds */
|
|
30
30
|
bottom: number;
|
|
31
|
+
/** Padding from left in pixels to add to the given bounds */
|
|
31
32
|
left: number;
|
|
33
|
+
/** Padding from right in pixels to add to the given bounds */
|
|
32
34
|
right: number;
|
|
33
35
|
};
|
|
34
36
|
type ViewportProps = {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Uber Technologies, Inc.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "4.0.1",
|
|
7
|
+
"version": "4.1.0-alpha.1",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"webgl",
|
|
10
10
|
"javascript",
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
"dist",
|
|
34
34
|
"src"
|
|
35
35
|
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@math.gl/core": "4.1.0-alpha.1"
|
|
38
|
+
},
|
|
36
39
|
"devDependencies": {
|
|
37
40
|
"mock-browser": "^0.92.14"
|
|
38
41
|
},
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "1a4dbbc6ab46271459d610411a7c644e45135c2c"
|
|
40
43
|
}
|
package/src/fit-bounds.ts
CHANGED
|
@@ -4,37 +4,38 @@ import {MAX_LATITUDE, lngLatToWorld, worldToLngLat} from './web-mercator-utils';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Options for fitBounds
|
|
7
|
-
* @param width - viewport width
|
|
8
|
-
* @param height - viewport height
|
|
9
|
-
* @param bounds - [[lon, lat], [lon, lat]]
|
|
10
|
-
* @param minExtent - The width/height of the bounded area will never be smaller than this
|
|
11
|
-
* @param padding - The amount of padding in pixels
|
|
12
|
-
* to add to the given bounds. Can also be an object with top, bottom, left and right
|
|
13
|
-
* properties defining the padding.
|
|
14
|
-
* @param options.offset= - The center of the given bounds relative to the map's center,
|
|
15
7
|
*/
|
|
16
8
|
export type FitBoundsOptions = {
|
|
9
|
+
/** viewport width */
|
|
17
10
|
width: number;
|
|
11
|
+
/** viewport height */
|
|
18
12
|
height: number;
|
|
13
|
+
/** [[lon, lat], [lon, lat]] */
|
|
19
14
|
bounds: [[number, number], [number, number]];
|
|
20
|
-
|
|
15
|
+
/** The width/height of the bounded area will never be smaller than this. 0.01 would be about 1000 meters (degree is ~110KM) */
|
|
16
|
+
minExtent?: number;
|
|
17
|
+
/** The maximum zoom level to fit the bounds within. */
|
|
21
18
|
maxZoom?: number; // ~x4,000,000 => About 10 meter extents
|
|
22
|
-
|
|
19
|
+
/**
|
|
20
|
+
* padding - The amount of padding in pixels to add to the given bounds.
|
|
21
|
+
* Can also be an object with top, bottom, left and right properties defining the padding.
|
|
22
|
+
*/
|
|
23
23
|
padding?: number | Padding;
|
|
24
|
+
/** The center of the given bounds relative to the map's center, */
|
|
24
25
|
offset?: number[];
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* An object describing the padding to add to the bounds.
|
|
29
|
-
* @property top - Padding from top in pixels to add to the given bounds
|
|
30
|
-
* @property bottom - Padding from bottom in pixels to add to the given bounds
|
|
31
|
-
* @property left - Padding from left in pixels to add to the given bounds
|
|
32
|
-
* @property right - Padding from right in pixels to add to the given bounds
|
|
33
30
|
*/
|
|
34
31
|
export type Padding = {
|
|
32
|
+
/** Padding from top in pixels to add to the given bounds */
|
|
35
33
|
top: number;
|
|
34
|
+
/** Padding from bottom in pixels to add to the given bounds */
|
|
36
35
|
bottom: number;
|
|
36
|
+
/** Padding from left in pixels to add to the given bounds */
|
|
37
37
|
left: number;
|
|
38
|
+
/** Padding from right in pixels to add to the given bounds */
|
|
38
39
|
right: number;
|
|
39
40
|
};
|
|
40
41
|
|