react-bing-map 1.0.4 → 1.0.6
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 +21 -21
- package/lib/cjs/components/MapView/BingMaps.d.ts +3 -0
- package/lib/cjs/components/index.d.ts +1 -1
- package/lib/cjs/hooks/useBingMaps.d.ts +10 -10
- package/lib/cjs/index.js +88 -28
- package/lib/cjs/index.js.map +1 -1
- package/lib/{esm/stories/Header.stories.d.ts → cjs/stories/BingMaps.stories.d.ts} +2 -2
- package/lib/cjs/type/component.type.d.ts +30 -0
- package/lib/esm/components/MapView/BingMaps.d.ts +3 -0
- package/lib/esm/components/index.d.ts +1 -1
- package/lib/esm/hooks/useBingMaps.d.ts +10 -10
- package/lib/esm/index.js +88 -28
- package/lib/esm/index.js.map +1 -1
- package/lib/{cjs/stories/Header.stories.d.ts → esm/stories/BingMaps.stories.d.ts} +2 -2
- package/lib/esm/type/component.type.d.ts +30 -0
- package/package.json +1 -1
- package/lib/cjs/components/MapView/MapView.d.ts +0 -2
- package/lib/cjs/stories/Button.d.ts +0 -29
- package/lib/cjs/stories/Button.stories.d.ts +0 -8
- package/lib/cjs/stories/MapView.stories.d.ts +0 -8
- package/lib/esm/components/MapView/MapView.d.ts +0 -2
- package/lib/esm/stories/Button.d.ts +0 -29
- package/lib/esm/stories/Button.stories.d.ts +0 -8
- package/lib/esm/stories/MapView.stories.d.ts +0 -8
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## React - Bing
|
|
1
|
+
## React - Bing Map
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
## Prerequisites
|
|
@@ -21,32 +21,32 @@ npm i react-bing-map
|
|
|
21
21
|
|
|
22
22
|
Import the Bing Maps component
|
|
23
23
|
|
|
24
|
-
```
|
|
25
|
-
import
|
|
24
|
+
```js
|
|
25
|
+
import { BingMaps } from "react-bing-map";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
#### Customized Example:
|
|
29
29
|
|
|
30
|
-
```
|
|
31
|
-
<
|
|
32
|
-
mapType
|
|
33
|
-
bingKey
|
|
34
|
-
centerLocation
|
|
35
|
-
language
|
|
36
|
-
zoom =
|
|
37
|
-
pushPins
|
|
38
|
-
pushPinIcon
|
|
39
|
-
showScalebar
|
|
40
|
-
showCopyright
|
|
41
|
-
showLogo
|
|
42
|
-
disableZooming
|
|
43
|
-
showBreadcrumb
|
|
44
|
-
showLocateMeButton
|
|
45
|
-
showZoomButtons
|
|
46
|
-
showMapTypeSelector
|
|
30
|
+
```js
|
|
31
|
+
<BingMaps
|
|
32
|
+
mapType=''
|
|
33
|
+
bingKey='key'
|
|
34
|
+
centerLocation={[28.6448, 77.216721]}
|
|
35
|
+
language={'en-IN'}
|
|
36
|
+
zoom ={0}
|
|
37
|
+
pushPins= {[]}
|
|
38
|
+
pushPinIcon=''
|
|
39
|
+
showScalebar={true}
|
|
40
|
+
showCopyright={true}
|
|
41
|
+
showLogo={true}
|
|
42
|
+
disableZooming={false}
|
|
43
|
+
showBreadcrumb={true}
|
|
44
|
+
showLocateMeButton={true}
|
|
45
|
+
showZoomButtons={true}
|
|
46
|
+
showMapTypeSelector={true}
|
|
47
47
|
/>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
#### Output:
|
|
51
51
|
|
|
52
|
-

|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BingMaps } from './MapView/BingMaps';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
mapType?: string;
|
|
3
|
-
bingKey: string;
|
|
4
|
-
centerLocation?: [number, number];
|
|
5
|
-
initZoom?: number;
|
|
6
|
-
pushPins?: [];
|
|
7
|
-
pushPinIcon?: any;
|
|
8
|
-
};
|
|
9
|
-
declare const useBingMaps: ({ mapType, bingKey, centerLocation, initZoom, pushPins, pushPinIcon }: {
|
|
1
|
+
declare const useBingMaps: ({ mapType, bingKey, centerLocation, zoom, pushPins, pushPinIcon, showScalebar, showCopyright, showLogo, disableZooming, showBreadcrumb, showLocateMeButton, showZoomButtons, showMapTypeSelector }: {
|
|
10
2
|
mapType?: string | undefined;
|
|
11
3
|
bingKey?: string | undefined;
|
|
12
4
|
centerLocation?: number[] | undefined;
|
|
13
|
-
|
|
5
|
+
zoom?: number | undefined;
|
|
14
6
|
pushPins?: never[] | undefined;
|
|
15
7
|
pushPinIcon?: string | undefined;
|
|
8
|
+
showScalebar?: boolean | undefined;
|
|
9
|
+
showCopyright?: boolean | undefined;
|
|
10
|
+
showLogo?: boolean | undefined;
|
|
11
|
+
disableZooming?: boolean | undefined;
|
|
12
|
+
showBreadcrumb?: boolean | undefined;
|
|
13
|
+
showLocateMeButton?: boolean | undefined;
|
|
14
|
+
showZoomButtons?: boolean | undefined;
|
|
15
|
+
showMapTypeSelector?: boolean | undefined;
|
|
16
16
|
}) => [any, any];
|
|
17
17
|
export default useBingMaps;
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,58 +3,118 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
5
|
var useBingMaps = function (_a) {
|
|
6
|
-
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.
|
|
6
|
+
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.zoom, zoom = _e === void 0 ? 0 : _e, _f = _a.pushPins, pushPins = _f === void 0 ? [] : _f; _a.pushPinIcon; var _h = _a.showScalebar, showScalebar = _h === void 0 ? true : _h, _j = _a.showCopyright, showCopyright = _j === void 0 ? true : _j, _k = _a.showLogo, showLogo = _k === void 0 ? true : _k, _l = _a.disableZooming, disableZooming = _l === void 0 ? false : _l, _m = _a.showBreadcrumb, showBreadcrumb = _m === void 0 ? true : _m, _o = _a.showLocateMeButton, showLocateMeButton = _o === void 0 ? true : _o, _p = _a.showZoomButtons, showZoomButtons = _p === void 0 ? true : _p, _q = _a.showMapTypeSelector, showMapTypeSelector = _q === void 0 ? true : _q;
|
|
7
|
+
var CONFIG = {
|
|
8
|
+
NORTH: 49.234,
|
|
9
|
+
SOUTH: 24.175,
|
|
10
|
+
EAST: -65.573,
|
|
11
|
+
WEST: -125.778,
|
|
12
|
+
ZOOM: 3
|
|
13
|
+
};
|
|
7
14
|
var myWindow = window;
|
|
8
15
|
var initMap = React.useCallback(function () {
|
|
9
16
|
var Maps = myWindow.Microsoft.Maps;
|
|
17
|
+
var center = new Maps.Location(centerLocation[0], centerLocation[1]);
|
|
10
18
|
var map = new Maps.Map('#bing-map', {
|
|
11
19
|
credentials: bingKey,
|
|
12
|
-
center:
|
|
20
|
+
center: center,
|
|
21
|
+
bounds: Maps.LocationRect.fromEdges(CONFIG.NORTH, CONFIG.WEST, CONFIG.SOUTH, CONFIG.EAST),
|
|
13
22
|
mapTypeId: Maps.MapTypeId[mapType],
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
zoom: zoom,
|
|
24
|
+
showScalebar: showScalebar,
|
|
25
|
+
showCopyright: showCopyright,
|
|
26
|
+
showLogo: showLogo,
|
|
27
|
+
disableZooming: disableZooming,
|
|
28
|
+
showBreadcrumb: showBreadcrumb,
|
|
29
|
+
showLocateMeButton: showLocateMeButton,
|
|
30
|
+
showZoomButtons: showZoomButtons,
|
|
31
|
+
showMapTypeSelector: showMapTypeSelector
|
|
16
32
|
});
|
|
17
|
-
var
|
|
33
|
+
var infoBox = new Maps.Infobox(map.getCenter(), {
|
|
18
34
|
visible: false
|
|
19
35
|
});
|
|
20
|
-
|
|
21
|
-
addPushPins(map,
|
|
22
|
-
}, []);
|
|
23
|
-
var addPushPins = function (map,
|
|
24
|
-
|
|
25
|
-
new Maps.Pushpin(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
36
|
+
infoBox.setMap(map);
|
|
37
|
+
addPushPins(center, infoBox, map, Maps, pushPins);
|
|
38
|
+
}, [pushPins]);
|
|
39
|
+
var addPushPins = function (center, infoBox, map, Maps, pushPins) {
|
|
40
|
+
pushPins.forEach(function (item) {
|
|
41
|
+
var pin = new Maps.Pushpin(item.center, null);
|
|
42
|
+
var data = item.content;
|
|
43
|
+
handleOnInfoBox(center, data, infoBox, map, Maps, pin);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var handleOnInfoBox = function (center, data, infoBox, map, Maps, pin) {
|
|
47
|
+
Maps.Events.addHandler(pin, 'click', function (e) {
|
|
48
|
+
infoBox.setOptions({
|
|
49
|
+
visible: true,
|
|
50
|
+
location: e.target.getLocation(),
|
|
51
|
+
title: data.title,
|
|
52
|
+
description: data.description.name
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
map.entities.push(pin);
|
|
56
|
+
var zoomLevel = getZoomLevel(100, map.getCenter().latitude, 350, 250);
|
|
57
|
+
map.setView({
|
|
58
|
+
center: center,
|
|
59
|
+
zoom: zoom ? zoom : zoomLevel,
|
|
60
|
+
padding: 100,
|
|
61
|
+
strokeOpacity: 0.6
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var getZoomLevel = function (radius, latitude, heightOfMapInPixels, widthOfMapInPixels) {
|
|
65
|
+
var range = radius * 1.6 * 1000;
|
|
66
|
+
var limitBoundPixels = Math.min(heightOfMapInPixels, widthOfMapInPixels);
|
|
67
|
+
var zoom = Math.floor(Math.log((156543.03392 * Math.cos((latitude * Math.PI) / 180)) /
|
|
68
|
+
(range / limitBoundPixels)) / Math.log(2));
|
|
69
|
+
return zoom;
|
|
29
70
|
};
|
|
30
|
-
// myWindow.initMap = initMap;
|
|
31
71
|
return [myWindow, initMap];
|
|
32
72
|
};
|
|
33
73
|
|
|
34
|
-
|
|
74
|
+
// const logo: string = require("../assets/legend-f.svg");
|
|
75
|
+
// import * as logo from 'logo.svg'
|
|
76
|
+
// const logo = require("../../assets/legend-f.svg") as string;
|
|
77
|
+
var BingMaps = function (_a) {
|
|
78
|
+
var _b = _a.mapType, mapType = _b === void 0 ? 'grayscale' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.language, language = _e === void 0 ? 'en-IN' : _e, _f = _a.zoom, zoom = _f === void 0 ? 0 : _f, _g = _a.pushPins, pushPins = _g === void 0 ? [] : _g, _h = _a.pushPinIcon, pushPinIcon = _h === void 0 ? '' : _h, _j = _a.showScalebar, showScalebar = _j === void 0 ? true : _j, _k = _a.showCopyright, showCopyright = _k === void 0 ? true : _k, _l = _a.showLogo, showLogo = _l === void 0 ? true : _l, _m = _a.disableZooming, disableZooming = _m === void 0 ? false : _m, _o = _a.showBreadcrumb, showBreadcrumb = _o === void 0 ? true : _o, _p = _a.showLocateMeButton, showLocateMeButton = _p === void 0 ? true : _p, _q = _a.showZoomButtons, showZoomButtons = _q === void 0 ? true : _q, _r = _a.showMapTypeSelector, showMapTypeSelector = _r === void 0 ? true : _r;
|
|
35
79
|
var mapView = {
|
|
36
|
-
mapType:
|
|
37
|
-
bingKey:
|
|
38
|
-
centerLocation:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
80
|
+
mapType: mapType,
|
|
81
|
+
bingKey: bingKey,
|
|
82
|
+
centerLocation: centerLocation,
|
|
83
|
+
language: language,
|
|
84
|
+
zoom: zoom,
|
|
85
|
+
pushPins: pushPins,
|
|
86
|
+
pushPinIcon: pushPinIcon,
|
|
87
|
+
showScalebar: showScalebar,
|
|
88
|
+
showCopyright: showCopyright,
|
|
89
|
+
showLogo: showLogo,
|
|
90
|
+
disableZooming: disableZooming,
|
|
91
|
+
showBreadcrumb: showBreadcrumb,
|
|
92
|
+
showLocateMeButton: showLocateMeButton,
|
|
93
|
+
showZoomButtons: showZoomButtons,
|
|
94
|
+
showMapTypeSelector: showMapTypeSelector
|
|
42
95
|
};
|
|
43
|
-
var
|
|
96
|
+
var _s = useBingMaps(mapView), myWindow = _s[0], initMap = _s[1];
|
|
44
97
|
myWindow.initMap = initMap;
|
|
45
98
|
React.useEffect(function () {
|
|
46
99
|
if (!document.querySelector('[data-bing="true"]')) {
|
|
47
100
|
var scriptTag = document.createElement('script');
|
|
48
101
|
scriptTag.src =
|
|
49
|
-
|
|
102
|
+
"https://www.bing.com/api/maps/mapcontrol?callback=initMap&setLang=".concat(language);
|
|
50
103
|
scriptTag.async = true;
|
|
51
104
|
scriptTag.dataset.bing = 'true';
|
|
52
105
|
document.body.appendChild(scriptTag);
|
|
53
106
|
}
|
|
54
|
-
}, []);
|
|
55
|
-
return (React.createElement("div", {
|
|
56
|
-
|
|
107
|
+
}, [initMap]);
|
|
108
|
+
return (React.createElement("div", { id: 'bing-map', style: {
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: '100%',
|
|
112
|
+
top: 0,
|
|
113
|
+
bottom: 0,
|
|
114
|
+
left: 0,
|
|
115
|
+
right: 0
|
|
116
|
+
} }));
|
|
57
117
|
};
|
|
58
118
|
|
|
59
|
-
exports.
|
|
119
|
+
exports.BingMaps = BingMaps;
|
|
60
120
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/BingMaps.tsx"],"sourcesContent":[null,null],"names":["useCallback","useEffect"],"mappings":";;;;AAGA,IAAM,WAAW,GAAG,UAAC,EAepB,EAAA;QAdC,EAAY,GAAA,EAAA,CAAA,OAAA,CAAA,CAAZ,OAAO,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,EAAE,KAAA,CACZ,CAAA,EAAA,GAAA,EAAA,CAAA,OAAY,EAAZ,OAAO,GAAA,EAA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YAAA,GAAG,EAAE,CAAC;AACN,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,KAAK,EAAE,CAAC;AACT,SAAA,EAAA,CACD,EACF;AACJ;;;;"}
|
|
@@ -2,5 +2,5 @@ import type { StoryObj } from '@storybook/react';
|
|
|
2
2
|
declare const meta: any;
|
|
3
3
|
export default meta;
|
|
4
4
|
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Map_View: Story;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type TDescription = {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
export type TContent = {
|
|
5
|
+
title: string;
|
|
6
|
+
description: TDescription;
|
|
7
|
+
};
|
|
8
|
+
export type TPushPin = {
|
|
9
|
+
icon: string;
|
|
10
|
+
center: {};
|
|
11
|
+
content: TContent;
|
|
12
|
+
};
|
|
13
|
+
export type TMapView = {
|
|
14
|
+
mapType: string;
|
|
15
|
+
bingKey: string;
|
|
16
|
+
centerLocation?: [number, number];
|
|
17
|
+
language?: string;
|
|
18
|
+
zoom?: number;
|
|
19
|
+
pushPins?: [];
|
|
20
|
+
pushPinIcon?: any;
|
|
21
|
+
showScalebar?: boolean;
|
|
22
|
+
showCopyright?: boolean;
|
|
23
|
+
showLogo?: boolean;
|
|
24
|
+
disableZooming?: boolean;
|
|
25
|
+
showBreadcrumb?: boolean;
|
|
26
|
+
showLocateMeButton: boolean;
|
|
27
|
+
showZoomButtons?: boolean;
|
|
28
|
+
showMapTypeSelector?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BingMaps } from './MapView/BingMaps';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
mapType?: string;
|
|
3
|
-
bingKey: string;
|
|
4
|
-
centerLocation?: [number, number];
|
|
5
|
-
initZoom?: number;
|
|
6
|
-
pushPins?: [];
|
|
7
|
-
pushPinIcon?: any;
|
|
8
|
-
};
|
|
9
|
-
declare const useBingMaps: ({ mapType, bingKey, centerLocation, initZoom, pushPins, pushPinIcon }: {
|
|
1
|
+
declare const useBingMaps: ({ mapType, bingKey, centerLocation, zoom, pushPins, pushPinIcon, showScalebar, showCopyright, showLogo, disableZooming, showBreadcrumb, showLocateMeButton, showZoomButtons, showMapTypeSelector }: {
|
|
10
2
|
mapType?: string | undefined;
|
|
11
3
|
bingKey?: string | undefined;
|
|
12
4
|
centerLocation?: number[] | undefined;
|
|
13
|
-
|
|
5
|
+
zoom?: number | undefined;
|
|
14
6
|
pushPins?: never[] | undefined;
|
|
15
7
|
pushPinIcon?: string | undefined;
|
|
8
|
+
showScalebar?: boolean | undefined;
|
|
9
|
+
showCopyright?: boolean | undefined;
|
|
10
|
+
showLogo?: boolean | undefined;
|
|
11
|
+
disableZooming?: boolean | undefined;
|
|
12
|
+
showBreadcrumb?: boolean | undefined;
|
|
13
|
+
showLocateMeButton?: boolean | undefined;
|
|
14
|
+
showZoomButtons?: boolean | undefined;
|
|
15
|
+
showMapTypeSelector?: boolean | undefined;
|
|
16
16
|
}) => [any, any];
|
|
17
17
|
export default useBingMaps;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,58 +1,118 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
var useBingMaps = function (_a) {
|
|
4
|
-
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.
|
|
4
|
+
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.zoom, zoom = _e === void 0 ? 0 : _e, _f = _a.pushPins, pushPins = _f === void 0 ? [] : _f; _a.pushPinIcon; var _h = _a.showScalebar, showScalebar = _h === void 0 ? true : _h, _j = _a.showCopyright, showCopyright = _j === void 0 ? true : _j, _k = _a.showLogo, showLogo = _k === void 0 ? true : _k, _l = _a.disableZooming, disableZooming = _l === void 0 ? false : _l, _m = _a.showBreadcrumb, showBreadcrumb = _m === void 0 ? true : _m, _o = _a.showLocateMeButton, showLocateMeButton = _o === void 0 ? true : _o, _p = _a.showZoomButtons, showZoomButtons = _p === void 0 ? true : _p, _q = _a.showMapTypeSelector, showMapTypeSelector = _q === void 0 ? true : _q;
|
|
5
|
+
var CONFIG = {
|
|
6
|
+
NORTH: 49.234,
|
|
7
|
+
SOUTH: 24.175,
|
|
8
|
+
EAST: -65.573,
|
|
9
|
+
WEST: -125.778,
|
|
10
|
+
ZOOM: 3
|
|
11
|
+
};
|
|
5
12
|
var myWindow = window;
|
|
6
13
|
var initMap = useCallback(function () {
|
|
7
14
|
var Maps = myWindow.Microsoft.Maps;
|
|
15
|
+
var center = new Maps.Location(centerLocation[0], centerLocation[1]);
|
|
8
16
|
var map = new Maps.Map('#bing-map', {
|
|
9
17
|
credentials: bingKey,
|
|
10
|
-
center:
|
|
18
|
+
center: center,
|
|
19
|
+
bounds: Maps.LocationRect.fromEdges(CONFIG.NORTH, CONFIG.WEST, CONFIG.SOUTH, CONFIG.EAST),
|
|
11
20
|
mapTypeId: Maps.MapTypeId[mapType],
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
zoom: zoom,
|
|
22
|
+
showScalebar: showScalebar,
|
|
23
|
+
showCopyright: showCopyright,
|
|
24
|
+
showLogo: showLogo,
|
|
25
|
+
disableZooming: disableZooming,
|
|
26
|
+
showBreadcrumb: showBreadcrumb,
|
|
27
|
+
showLocateMeButton: showLocateMeButton,
|
|
28
|
+
showZoomButtons: showZoomButtons,
|
|
29
|
+
showMapTypeSelector: showMapTypeSelector
|
|
14
30
|
});
|
|
15
|
-
var
|
|
31
|
+
var infoBox = new Maps.Infobox(map.getCenter(), {
|
|
16
32
|
visible: false
|
|
17
33
|
});
|
|
18
|
-
|
|
19
|
-
addPushPins(map,
|
|
20
|
-
}, []);
|
|
21
|
-
var addPushPins = function (map,
|
|
22
|
-
|
|
23
|
-
new Maps.Pushpin(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
34
|
+
infoBox.setMap(map);
|
|
35
|
+
addPushPins(center, infoBox, map, Maps, pushPins);
|
|
36
|
+
}, [pushPins]);
|
|
37
|
+
var addPushPins = function (center, infoBox, map, Maps, pushPins) {
|
|
38
|
+
pushPins.forEach(function (item) {
|
|
39
|
+
var pin = new Maps.Pushpin(item.center, null);
|
|
40
|
+
var data = item.content;
|
|
41
|
+
handleOnInfoBox(center, data, infoBox, map, Maps, pin);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var handleOnInfoBox = function (center, data, infoBox, map, Maps, pin) {
|
|
45
|
+
Maps.Events.addHandler(pin, 'click', function (e) {
|
|
46
|
+
infoBox.setOptions({
|
|
47
|
+
visible: true,
|
|
48
|
+
location: e.target.getLocation(),
|
|
49
|
+
title: data.title,
|
|
50
|
+
description: data.description.name
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
map.entities.push(pin);
|
|
54
|
+
var zoomLevel = getZoomLevel(100, map.getCenter().latitude, 350, 250);
|
|
55
|
+
map.setView({
|
|
56
|
+
center: center,
|
|
57
|
+
zoom: zoom ? zoom : zoomLevel,
|
|
58
|
+
padding: 100,
|
|
59
|
+
strokeOpacity: 0.6
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var getZoomLevel = function (radius, latitude, heightOfMapInPixels, widthOfMapInPixels) {
|
|
63
|
+
var range = radius * 1.6 * 1000;
|
|
64
|
+
var limitBoundPixels = Math.min(heightOfMapInPixels, widthOfMapInPixels);
|
|
65
|
+
var zoom = Math.floor(Math.log((156543.03392 * Math.cos((latitude * Math.PI) / 180)) /
|
|
66
|
+
(range / limitBoundPixels)) / Math.log(2));
|
|
67
|
+
return zoom;
|
|
27
68
|
};
|
|
28
|
-
// myWindow.initMap = initMap;
|
|
29
69
|
return [myWindow, initMap];
|
|
30
70
|
};
|
|
31
71
|
|
|
32
|
-
|
|
72
|
+
// const logo: string = require("../assets/legend-f.svg");
|
|
73
|
+
// import * as logo from 'logo.svg'
|
|
74
|
+
// const logo = require("../../assets/legend-f.svg") as string;
|
|
75
|
+
var BingMaps = function (_a) {
|
|
76
|
+
var _b = _a.mapType, mapType = _b === void 0 ? 'grayscale' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.language, language = _e === void 0 ? 'en-IN' : _e, _f = _a.zoom, zoom = _f === void 0 ? 0 : _f, _g = _a.pushPins, pushPins = _g === void 0 ? [] : _g, _h = _a.pushPinIcon, pushPinIcon = _h === void 0 ? '' : _h, _j = _a.showScalebar, showScalebar = _j === void 0 ? true : _j, _k = _a.showCopyright, showCopyright = _k === void 0 ? true : _k, _l = _a.showLogo, showLogo = _l === void 0 ? true : _l, _m = _a.disableZooming, disableZooming = _m === void 0 ? false : _m, _o = _a.showBreadcrumb, showBreadcrumb = _o === void 0 ? true : _o, _p = _a.showLocateMeButton, showLocateMeButton = _p === void 0 ? true : _p, _q = _a.showZoomButtons, showZoomButtons = _q === void 0 ? true : _q, _r = _a.showMapTypeSelector, showMapTypeSelector = _r === void 0 ? true : _r;
|
|
33
77
|
var mapView = {
|
|
34
|
-
mapType:
|
|
35
|
-
bingKey:
|
|
36
|
-
centerLocation:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
78
|
+
mapType: mapType,
|
|
79
|
+
bingKey: bingKey,
|
|
80
|
+
centerLocation: centerLocation,
|
|
81
|
+
language: language,
|
|
82
|
+
zoom: zoom,
|
|
83
|
+
pushPins: pushPins,
|
|
84
|
+
pushPinIcon: pushPinIcon,
|
|
85
|
+
showScalebar: showScalebar,
|
|
86
|
+
showCopyright: showCopyright,
|
|
87
|
+
showLogo: showLogo,
|
|
88
|
+
disableZooming: disableZooming,
|
|
89
|
+
showBreadcrumb: showBreadcrumb,
|
|
90
|
+
showLocateMeButton: showLocateMeButton,
|
|
91
|
+
showZoomButtons: showZoomButtons,
|
|
92
|
+
showMapTypeSelector: showMapTypeSelector
|
|
40
93
|
};
|
|
41
|
-
var
|
|
94
|
+
var _s = useBingMaps(mapView), myWindow = _s[0], initMap = _s[1];
|
|
42
95
|
myWindow.initMap = initMap;
|
|
43
96
|
useEffect(function () {
|
|
44
97
|
if (!document.querySelector('[data-bing="true"]')) {
|
|
45
98
|
var scriptTag = document.createElement('script');
|
|
46
99
|
scriptTag.src =
|
|
47
|
-
|
|
100
|
+
"https://www.bing.com/api/maps/mapcontrol?callback=initMap&setLang=".concat(language);
|
|
48
101
|
scriptTag.async = true;
|
|
49
102
|
scriptTag.dataset.bing = 'true';
|
|
50
103
|
document.body.appendChild(scriptTag);
|
|
51
104
|
}
|
|
52
|
-
}, []);
|
|
53
|
-
return (React.createElement("div", {
|
|
54
|
-
|
|
105
|
+
}, [initMap]);
|
|
106
|
+
return (React.createElement("div", { id: 'bing-map', style: {
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
width: '100%',
|
|
109
|
+
height: '100%',
|
|
110
|
+
top: 0,
|
|
111
|
+
bottom: 0,
|
|
112
|
+
left: 0,
|
|
113
|
+
right: 0
|
|
114
|
+
} }));
|
|
55
115
|
};
|
|
56
116
|
|
|
57
|
-
export {
|
|
117
|
+
export { BingMaps };
|
|
58
118
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/BingMaps.tsx"],"sourcesContent":[null,null],"names":[],"mappings":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AAO,CAAC,CAAC,CAAC;AAEd,IAAA,QACE,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,EAAE,EAAC,UAAU,EACb,KAAK,EAAE;AACL,YAAA,QAAQ,EAAE,UAAU;AACpB,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,GAAG,EAAE,CAAC;AACN,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,KAAK,EAAE,CAAC;AACT,SAAA,EAAA,CACD,EACF;AACJ;;;;"}
|
|
@@ -2,5 +2,5 @@ import type { StoryObj } from '@storybook/react';
|
|
|
2
2
|
declare const meta: any;
|
|
3
3
|
export default meta;
|
|
4
4
|
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Map_View: Story;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type TDescription = {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
export type TContent = {
|
|
5
|
+
title: string;
|
|
6
|
+
description: TDescription;
|
|
7
|
+
};
|
|
8
|
+
export type TPushPin = {
|
|
9
|
+
icon: string;
|
|
10
|
+
center: {};
|
|
11
|
+
content: TContent;
|
|
12
|
+
};
|
|
13
|
+
export type TMapView = {
|
|
14
|
+
mapType: string;
|
|
15
|
+
bingKey: string;
|
|
16
|
+
centerLocation?: [number, number];
|
|
17
|
+
language?: string;
|
|
18
|
+
zoom?: number;
|
|
19
|
+
pushPins?: [];
|
|
20
|
+
pushPinIcon?: any;
|
|
21
|
+
showScalebar?: boolean;
|
|
22
|
+
showCopyright?: boolean;
|
|
23
|
+
showLogo?: boolean;
|
|
24
|
+
disableZooming?: boolean;
|
|
25
|
+
showBreadcrumb?: boolean;
|
|
26
|
+
showLocateMeButton: boolean;
|
|
27
|
+
showZoomButtons?: boolean;
|
|
28
|
+
showMapTypeSelector?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './button.css';
|
|
3
|
-
interface ButtonProps {
|
|
4
|
-
/**
|
|
5
|
-
* Is this the principal call to action on the page?
|
|
6
|
-
*/
|
|
7
|
-
primary?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* What background color to use
|
|
10
|
-
*/
|
|
11
|
-
backgroundColor?: string;
|
|
12
|
-
/**
|
|
13
|
-
* How large should the button be?
|
|
14
|
-
*/
|
|
15
|
-
size?: 'small' | 'medium' | 'large';
|
|
16
|
-
/**
|
|
17
|
-
* Button contents
|
|
18
|
-
*/
|
|
19
|
-
label: string;
|
|
20
|
-
/**
|
|
21
|
-
* Optional click handler
|
|
22
|
-
*/
|
|
23
|
-
onClick?: () => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Primary UI component for user interaction
|
|
27
|
-
*/
|
|
28
|
-
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
|
|
29
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: any;
|
|
3
|
-
export default meta;
|
|
4
|
-
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const Primary: Story;
|
|
6
|
-
export declare const Secondary: Story;
|
|
7
|
-
export declare const Large: Story;
|
|
8
|
-
export declare const Small: Story;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: any;
|
|
3
|
-
export default meta;
|
|
4
|
-
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const Primary: Story;
|
|
6
|
-
export declare const Secondary: Story;
|
|
7
|
-
export declare const Large: Story;
|
|
8
|
-
export declare const Small: Story;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './button.css';
|
|
3
|
-
interface ButtonProps {
|
|
4
|
-
/**
|
|
5
|
-
* Is this the principal call to action on the page?
|
|
6
|
-
*/
|
|
7
|
-
primary?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* What background color to use
|
|
10
|
-
*/
|
|
11
|
-
backgroundColor?: string;
|
|
12
|
-
/**
|
|
13
|
-
* How large should the button be?
|
|
14
|
-
*/
|
|
15
|
-
size?: 'small' | 'medium' | 'large';
|
|
16
|
-
/**
|
|
17
|
-
* Button contents
|
|
18
|
-
*/
|
|
19
|
-
label: string;
|
|
20
|
-
/**
|
|
21
|
-
* Optional click handler
|
|
22
|
-
*/
|
|
23
|
-
onClick?: () => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Primary UI component for user interaction
|
|
27
|
-
*/
|
|
28
|
-
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
|
|
29
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: any;
|
|
3
|
-
export default meta;
|
|
4
|
-
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const Primary: Story;
|
|
6
|
-
export declare const Secondary: Story;
|
|
7
|
-
export declare const Large: Story;
|
|
8
|
-
export declare const Small: Story;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: any;
|
|
3
|
-
export default meta;
|
|
4
|
-
type Story = StoryObj<typeof meta>;
|
|
5
|
-
export declare const Primary: Story;
|
|
6
|
-
export declare const Secondary: Story;
|
|
7
|
-
export declare const Large: Story;
|
|
8
|
-
export declare const Small: Story;
|