@types/mapboxgl-spiderifier 1.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.
- mapboxgl-spiderifier/LICENSE +21 -0
- mapboxgl-spiderifier/README.md +92 -0
- mapboxgl-spiderifier/index.d.ts +73 -0
- mapboxgl-spiderifier/package.json +30 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/mapboxgl-spiderifier`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for mapboxgl-spiderifier (https://github.com/bewithjonam/mapboxgl-spiderifier).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapboxgl-spiderifier.
|
|
9
|
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapboxgl-spiderifier/index.d.ts)
|
|
10
|
+
````ts
|
|
11
|
+
// https://github.com/bewithjonam/mapboxgl-spiderifier
|
|
12
|
+
import { LngLat, Map, MapboxGeoJSONFeature, Marker } from "mapbox-gl";
|
|
13
|
+
|
|
14
|
+
export function popupOffsetForSpiderLeg(spiderLeg: SpiderLeg, offset?: number): SpiderLegOffsets;
|
|
15
|
+
|
|
16
|
+
export interface SpiderLegOffsets {
|
|
17
|
+
top: SpiderLegOffset;
|
|
18
|
+
"top-left": SpiderlegOffset;
|
|
19
|
+
"top-right": SpiderlegOffset;
|
|
20
|
+
bottom: SpiderlegOffset;
|
|
21
|
+
"bottom-left": SpiderlegOffset;
|
|
22
|
+
"bottom-right": SpiderlegOffset;
|
|
23
|
+
left: SpiderlegOffset;
|
|
24
|
+
right: SpiderlegOffset;
|
|
25
|
+
}
|
|
26
|
+
export type SpiderLegOffset = [number, number];
|
|
27
|
+
|
|
28
|
+
class MapboxglSpiderifier {
|
|
29
|
+
constructor(map: Map, options: Options);
|
|
30
|
+
|
|
31
|
+
each: (spiderLeg: SpiderLeg) => void;
|
|
32
|
+
spiderfy: (latLng: LngLat | [number, number], features: Array<Record<string, unknown>>) => void;
|
|
33
|
+
unspiderfy: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Options {
|
|
37
|
+
/** Default: false */
|
|
38
|
+
animate?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Number in milliseconds
|
|
41
|
+
* Default 200 */
|
|
42
|
+
animationSpeed?: number;
|
|
43
|
+
/**
|
|
44
|
+
* number of markers till which the spider will be circular and beyond this threshold,
|
|
45
|
+
* it will spider in spiral.
|
|
46
|
+
* Default: 9
|
|
47
|
+
*/
|
|
48
|
+
circleSpiralSwitchover?: number;
|
|
49
|
+
customPin?: boolean;
|
|
50
|
+
initializeLeg?: (spiderLeg: SpiderLeg) => void;
|
|
51
|
+
onClick?: (event: MouseEvent, spiderLeg: SpiderLeg) => void;
|
|
52
|
+
// --- <SPIDER TUNING Params>
|
|
53
|
+
// circleSpiralSwitchover: show spiral instead of circle from this marker count upwards
|
|
54
|
+
// 0 -> always spiral; Infinity -> always circle
|
|
55
|
+
circleSpiralSwitchover?: number; // Default: 9,
|
|
56
|
+
circleFootSeparation?: number; // Default: 25, // related to circumference of circle
|
|
57
|
+
spiralFootSeparation?: number; // Default: 28, // related to size of spiral (experiment!)
|
|
58
|
+
spiralLengthStart?: number; // Default: 15, // ditto
|
|
59
|
+
spiralLengthFactor?: number; // Default: 4, // ditto
|
|
60
|
+
}
|
|
61
|
+
export default MapboxglSpiderifier;
|
|
62
|
+
|
|
63
|
+
export interface SpiderLeg {
|
|
64
|
+
feature: MapboxGeoJSONFeature;
|
|
65
|
+
elements: {
|
|
66
|
+
container: HTMLElement;
|
|
67
|
+
line: HTMLElement;
|
|
68
|
+
pin: HTMLElement;
|
|
69
|
+
};
|
|
70
|
+
mapboxMarker: Marker;
|
|
71
|
+
params: {
|
|
72
|
+
/** horizontal offset of pin from the center of spider */
|
|
73
|
+
x: number;
|
|
74
|
+
/** vertical offset of pin from the center of spider */
|
|
75
|
+
y: number;
|
|
76
|
+
/** angle of line from the center of spider */
|
|
77
|
+
angle: number;
|
|
78
|
+
/** leg line length */
|
|
79
|
+
legLength: number;
|
|
80
|
+
/** index of spider leg */
|
|
81
|
+
index: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
````
|
|
86
|
+
|
|
87
|
+
### Additional Details
|
|
88
|
+
* Last updated: Thu, 25 Jan 2024 16:07:26 GMT
|
|
89
|
+
* Dependencies: none
|
|
90
|
+
|
|
91
|
+
# Credits
|
|
92
|
+
These definitions were written by [manoj kumar](https://github.com/bewithjonam), and [Lance Gliser](https://github.com/lancegliser).
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// https://github.com/bewithjonam/mapboxgl-spiderifier
|
|
2
|
+
import { LngLat, Map, MapboxGeoJSONFeature, Marker } from "mapbox-gl";
|
|
3
|
+
|
|
4
|
+
export function popupOffsetForSpiderLeg(spiderLeg: SpiderLeg, offset?: number): SpiderLegOffsets;
|
|
5
|
+
|
|
6
|
+
export interface SpiderLegOffsets {
|
|
7
|
+
top: SpiderLegOffset;
|
|
8
|
+
"top-left": SpiderlegOffset;
|
|
9
|
+
"top-right": SpiderlegOffset;
|
|
10
|
+
bottom: SpiderlegOffset;
|
|
11
|
+
"bottom-left": SpiderlegOffset;
|
|
12
|
+
"bottom-right": SpiderlegOffset;
|
|
13
|
+
left: SpiderlegOffset;
|
|
14
|
+
right: SpiderlegOffset;
|
|
15
|
+
}
|
|
16
|
+
export type SpiderLegOffset = [number, number];
|
|
17
|
+
|
|
18
|
+
class MapboxglSpiderifier {
|
|
19
|
+
constructor(map: Map, options: Options);
|
|
20
|
+
|
|
21
|
+
each: (spiderLeg: SpiderLeg) => void;
|
|
22
|
+
spiderfy: (latLng: LngLat | [number, number], features: Array<Record<string, unknown>>) => void;
|
|
23
|
+
unspiderfy: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Options {
|
|
27
|
+
/** Default: false */
|
|
28
|
+
animate?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Number in milliseconds
|
|
31
|
+
* Default 200 */
|
|
32
|
+
animationSpeed?: number;
|
|
33
|
+
/**
|
|
34
|
+
* number of markers till which the spider will be circular and beyond this threshold,
|
|
35
|
+
* it will spider in spiral.
|
|
36
|
+
* Default: 9
|
|
37
|
+
*/
|
|
38
|
+
circleSpiralSwitchover?: number;
|
|
39
|
+
customPin?: boolean;
|
|
40
|
+
initializeLeg?: (spiderLeg: SpiderLeg) => void;
|
|
41
|
+
onClick?: (event: MouseEvent, spiderLeg: SpiderLeg) => void;
|
|
42
|
+
// --- <SPIDER TUNING Params>
|
|
43
|
+
// circleSpiralSwitchover: show spiral instead of circle from this marker count upwards
|
|
44
|
+
// 0 -> always spiral; Infinity -> always circle
|
|
45
|
+
circleSpiralSwitchover?: number; // Default: 9,
|
|
46
|
+
circleFootSeparation?: number; // Default: 25, // related to circumference of circle
|
|
47
|
+
spiralFootSeparation?: number; // Default: 28, // related to size of spiral (experiment!)
|
|
48
|
+
spiralLengthStart?: number; // Default: 15, // ditto
|
|
49
|
+
spiralLengthFactor?: number; // Default: 4, // ditto
|
|
50
|
+
}
|
|
51
|
+
export default MapboxglSpiderifier;
|
|
52
|
+
|
|
53
|
+
export interface SpiderLeg {
|
|
54
|
+
feature: MapboxGeoJSONFeature;
|
|
55
|
+
elements: {
|
|
56
|
+
container: HTMLElement;
|
|
57
|
+
line: HTMLElement;
|
|
58
|
+
pin: HTMLElement;
|
|
59
|
+
};
|
|
60
|
+
mapboxMarker: Marker;
|
|
61
|
+
params: {
|
|
62
|
+
/** horizontal offset of pin from the center of spider */
|
|
63
|
+
x: number;
|
|
64
|
+
/** vertical offset of pin from the center of spider */
|
|
65
|
+
y: number;
|
|
66
|
+
/** angle of line from the center of spider */
|
|
67
|
+
angle: number;
|
|
68
|
+
/** leg line length */
|
|
69
|
+
legLength: number;
|
|
70
|
+
/** index of spider leg */
|
|
71
|
+
index: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/mapboxgl-spiderifier",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript definitions for mapboxgl-spiderifier",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapboxgl-spiderifier",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "manoj kumar",
|
|
10
|
+
"githubUsername": "bewithjonam",
|
|
11
|
+
"url": "https://github.com/bewithjonam"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Lance Gliser",
|
|
15
|
+
"githubUsername": "lancegliser",
|
|
16
|
+
"url": "https://github.com/lancegliser"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"main": "",
|
|
20
|
+
"types": "index.d.ts",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
24
|
+
"directory": "types/mapboxgl-spiderifier"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {},
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"typesPublisherContentHash": "ed43d1081e0fe88ec748a6139190c799652f1f75eb1feeadfaaf82621b10145d",
|
|
29
|
+
"typeScriptVersion": "4.6"
|
|
30
|
+
}
|