ts-maps 0.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.
- package/README.md +284 -0
- package/dist/apply-transform.d.ts +47 -0
- package/dist/base-element.d.ts +5 -0
- package/dist/base.d.ts +19 -0
- package/dist/brasil.d.ts +1 -0
- package/dist/canada.d.ts +1 -0
- package/dist/canvas-element.d.ts +8 -0
- package/dist/coords-to-point.d.ts +26 -0
- package/dist/create-lines.d.ts +39 -0
- package/dist/create-markers.d.ts +51 -0
- package/dist/create-regions.d.ts +19 -0
- package/dist/create-series.d.ts +20 -0
- package/dist/data-visualization.d.ts +99 -0
- package/dist/deep-merge.d.ts +44 -0
- package/dist/event-handler.d.ts +12 -0
- package/dist/events.d.ts +14 -0
- package/dist/get-inset-for-point.d.ts +24 -0
- package/dist/get-marker-position.d.ts +15 -0
- package/dist/image-element.d.ts +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +2027 -0
- package/dist/interactable.d.ts +7 -0
- package/dist/italy.d.ts +1 -0
- package/dist/legend.d.ts +6 -0
- package/dist/line.d.ts +29 -0
- package/dist/map.d.ts +422 -0
- package/dist/marker.d.ts +31 -0
- package/dist/options.d.ts +5 -0
- package/dist/ordinal-scale.d.ts +32 -0
- package/dist/projection.d.ts +18 -0
- package/dist/region.d.ts +21 -0
- package/dist/reposition-labels.d.ts +27 -0
- package/dist/reposition-lines.d.ts +32 -0
- package/dist/reposition-markers.d.ts +26 -0
- package/dist/resize.d.ts +5 -0
- package/dist/series.d.ts +4 -0
- package/dist/set-focus.d.ts +58 -0
- package/dist/set-scale.d.ts +80 -0
- package/dist/setup-container-events.d.ts +48 -0
- package/dist/setup-container-touch-events.d.ts +68 -0
- package/dist/setup-element-events.d.ts +125 -0
- package/dist/setup-zoom-buttons.d.ts +21 -0
- package/dist/shape-element.d.ts +10 -0
- package/dist/spain.d.ts +1 -0
- package/dist/text-element.d.ts +1 -0
- package/dist/tooltip.d.ts +80 -0
- package/dist/types.d.ts +398 -0
- package/dist/update-size.d.ts +6 -0
- package/dist/us-aea-en.d.ts +266 -0
- package/dist/us-lcc-en.d.ts +266 -0
- package/dist/us-merc-en.d.ts +266 -0
- package/dist/us-mill-en.d.ts +266 -0
- package/dist/utils.d.ts +21 -0
- package/dist/vector-map.d.ts +15 -0
- package/dist/world-merc.d.ts +1 -0
- package/dist/world.d.ts +1 -0
- package/package.json +57 -0
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare interface Events {
|
|
2
|
+
onLoaded: string
|
|
3
|
+
onViewportChange: string
|
|
4
|
+
onRegionClick: string
|
|
5
|
+
onMarkerClick: string
|
|
6
|
+
onRegionSelected: string
|
|
7
|
+
onMarkerSelected: string
|
|
8
|
+
onRegionTooltipShow: string
|
|
9
|
+
onMarkerTooltipShow: string
|
|
10
|
+
onDestroyed: string
|
|
11
|
+
}
|
|
12
|
+
declare const events: Events;
|
|
13
|
+
|
|
14
|
+
export default events;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare interface Point {
|
|
2
|
+
x: number
|
|
3
|
+
y: number
|
|
4
|
+
}
|
|
5
|
+
declare interface Inset {
|
|
6
|
+
bbox: [Point, Point]
|
|
7
|
+
width: number
|
|
8
|
+
height: number
|
|
9
|
+
left: number
|
|
10
|
+
top: number
|
|
11
|
+
[key: string]: any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function getInsetForPoint(this: MapInterface, x: number, y: number): Inset | undefined {
|
|
15
|
+
const insets = Map.maps[this.params.map.name].insets
|
|
16
|
+
|
|
17
|
+
for (let index = 0; index < insets.length; index++) {
|
|
18
|
+
const [start, end] = insets[index].bbox
|
|
19
|
+
|
|
20
|
+
if (x > start.x && x < end.x && y > start.y && y < end.y) {
|
|
21
|
+
return insets[index]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare interface Point {
|
|
2
|
+
x: number
|
|
3
|
+
y: number
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default function getMarkerPosition(this: MapInterface, { coords }: MarkerConfig): Point | false {
|
|
7
|
+
if (Map.maps[this.params.map.name].projection) {
|
|
8
|
+
return this.coordsToPoint(...coords)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
x: coords[0] * this.scale + this.transX * this.scale,
|
|
13
|
+
y: coords[1] * this.scale + this.transY * this.scale,
|
|
14
|
+
}
|
|
15
|
+
};
|