@mint-ui/map 0.3.5-beta → 0.3.6-beta
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/components/mint-map/MintMap.d.ts +7 -1
- package/dist/components/mint-map/MintMap.js +13 -5
- package/dist/components/mint-map/core/MintMapController.d.ts +2 -0
- package/dist/components/mint-map/core/MintMapCore.d.ts +1 -1
- package/dist/components/mint-map/core/MintMapCore.js +20 -9
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +2 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +12 -1
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +2 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +13 -0
- package/dist/index.es.js +58 -16
- package/dist/index.umd.js +57 -15
- package/package.json +1 -1
|
@@ -10,9 +10,14 @@ export interface MintMapProps extends MintMapEvents {
|
|
|
10
10
|
mapId?: string;
|
|
11
11
|
base?: BaseProps;
|
|
12
12
|
visible?: boolean;
|
|
13
|
+
center?: Position;
|
|
14
|
+
zoomLevel?: number;
|
|
15
|
+
draggable?: boolean;
|
|
16
|
+
keyboardShortcuts?: boolean;
|
|
13
17
|
markerCache?: boolean;
|
|
14
18
|
markerCachePoolSize?: number;
|
|
15
19
|
boundsChangeThrottlingTime?: number;
|
|
20
|
+
mapLoadingComponent?: () => JSX.Element;
|
|
16
21
|
}
|
|
17
22
|
export interface MintMapEvents {
|
|
18
23
|
onBoundsChanged?: (bounds: Bounds) => void;
|
|
@@ -26,6 +31,7 @@ export declare class Position {
|
|
|
26
31
|
lng: number;
|
|
27
32
|
offset?: Offset;
|
|
28
33
|
constructor(lat: number, lng: number);
|
|
34
|
+
static equals(pos1: Position, pos2: Position): boolean;
|
|
29
35
|
}
|
|
30
36
|
export declare class Bounds {
|
|
31
37
|
nw: Position;
|
|
@@ -93,4 +99,4 @@ export declare class Polygon extends Drawable {
|
|
|
93
99
|
constructor(options: PolygonOptions);
|
|
94
100
|
getCenter(): Position;
|
|
95
101
|
}
|
|
96
|
-
export declare function MintMap({ mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
102
|
+
export declare function MintMap({ mapLoadingComponent, mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
@@ -25,6 +25,10 @@ var Position = function () {
|
|
|
25
25
|
this.lng = lng;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
Position.equals = function (pos1, pos2) {
|
|
29
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
return Position;
|
|
29
33
|
}();
|
|
30
34
|
|
|
@@ -189,19 +193,25 @@ var DEFAULT_CENTER = {
|
|
|
189
193
|
lng: 127.0448698
|
|
190
194
|
};
|
|
191
195
|
function MintMap(_a) {
|
|
192
|
-
var
|
|
196
|
+
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
197
|
+
mapType = _a.mapType,
|
|
193
198
|
children = _a.children,
|
|
194
199
|
_b = _a.base,
|
|
195
200
|
base = _b === void 0 ? {
|
|
196
201
|
center: DEFAULT_CENTER,
|
|
197
202
|
zoomLevel: 12
|
|
198
203
|
} : _b,
|
|
199
|
-
props = tslib.__rest(_a, ["mapType", "children", "base"]);
|
|
204
|
+
props = tslib.__rest(_a, ["mapLoadingComponent", "mapType", "children", "base"]);
|
|
200
205
|
|
|
201
206
|
var _c = React.useState(),
|
|
202
207
|
controller = _c[0],
|
|
203
208
|
setController = _c[1];
|
|
204
209
|
|
|
210
|
+
var loading = React.useMemo(function () {
|
|
211
|
+
return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(PointLoading, {
|
|
212
|
+
text: "Loading"
|
|
213
|
+
});
|
|
214
|
+
}, [mapLoadingComponent]);
|
|
205
215
|
React.useEffect(function () {
|
|
206
216
|
if (mapType && mapType.length > 0) {
|
|
207
217
|
setController(undefined);
|
|
@@ -232,9 +242,7 @@ function MintMap(_a) {
|
|
|
232
242
|
mapType: mapType
|
|
233
243
|
}, props, {
|
|
234
244
|
base: base
|
|
235
|
-
}), children)) : React__default["default"].createElement(
|
|
236
|
-
text: "Loading"
|
|
237
|
-
}));
|
|
245
|
+
}), children)) : React__default["default"].createElement(React__default["default"].Fragment, null, loading));
|
|
238
246
|
}
|
|
239
247
|
|
|
240
248
|
function PointLoading(_a) {
|
|
@@ -10,6 +10,8 @@ export declare abstract class MintMapController {
|
|
|
10
10
|
abstract panningTo(targetCenter: Position): void;
|
|
11
11
|
abstract getZoomLevel(): number;
|
|
12
12
|
abstract setZoomLevel(zoom: number): void;
|
|
13
|
+
abstract getCenter(): Position;
|
|
14
|
+
abstract setCenter(position: Position): void;
|
|
13
15
|
abstract createMarker(marker: Marker): void;
|
|
14
16
|
abstract updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
15
17
|
abstract clearDrawable(drawable: Drawable): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
2
|
import { MintMapProps } from "../MintMap";
|
|
3
|
-
export declare function MintMapCore({ onLoad, visible,
|
|
3
|
+
export declare function MintMapCore({ onLoad, visible, zoomLevel, center, children }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var classNames = require('classnames/bind');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var MintMap = require('../MintMap.js');
|
|
8
9
|
var MintMapProvider = require('./provider/MintMapProvider.js');
|
|
9
10
|
var MintMapCore_module = require('./MintMapCore.module.scss.js');
|
|
10
11
|
|
|
@@ -20,7 +21,8 @@ function MintMapCore(_a) {
|
|
|
20
21
|
var onLoad = _a.onLoad,
|
|
21
22
|
_b = _a.visible,
|
|
22
23
|
visible = _b === void 0 ? true : _b,
|
|
23
|
-
|
|
24
|
+
zoomLevel = _a.zoomLevel,
|
|
25
|
+
center = _a.center,
|
|
24
26
|
children = _a.children;
|
|
25
27
|
var controller = MintMapProvider.useMintMapController();
|
|
26
28
|
var elementRef = React.useRef(null);
|
|
@@ -59,21 +61,30 @@ function MintMapCore(_a) {
|
|
|
59
61
|
};
|
|
60
62
|
}, [controller, elementRef]);
|
|
61
63
|
React.useEffect(function () {
|
|
62
|
-
if (
|
|
64
|
+
if (zoomLevel && controller && mapInitialized) {
|
|
63
65
|
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
64
66
|
|
|
65
|
-
if (prevZoomLevel !==
|
|
66
|
-
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(
|
|
67
|
+
if (prevZoomLevel !== zoomLevel) {
|
|
68
|
+
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
}, [zoomLevel]);
|
|
72
|
+
React.useEffect(function () {
|
|
73
|
+
if (center && controller && mapInitialized) {
|
|
74
|
+
var prevCenter = controller.getCenter();
|
|
75
|
+
|
|
76
|
+
if (!MintMap.Position.equals(prevCenter, center)) {
|
|
77
|
+
controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
78
|
+
}
|
|
74
79
|
}
|
|
80
|
+
}, [center]);
|
|
81
|
+
return React__default["default"].createElement("div", {
|
|
82
|
+
className: cn('mint-map-root')
|
|
75
83
|
}, mapInitialized && children, React__default["default"].createElement("div", {
|
|
76
84
|
className: cn('mint-map-container'),
|
|
85
|
+
style: {
|
|
86
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
87
|
+
},
|
|
77
88
|
ref: elementRef
|
|
78
89
|
}));
|
|
79
90
|
}
|
|
@@ -396,7 +396,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
396
396
|
minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
|
|
397
397
|
zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
|
|
398
398
|
disableDefaultUI: true,
|
|
399
|
-
gestureHandling: 'greedy',
|
|
399
|
+
gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
|
|
400
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
400
401
|
clickableIcons: false
|
|
401
402
|
});
|
|
402
403
|
this.map = map;
|
|
@@ -468,6 +469,16 @@ var GoogleMintMapController = function (_super) {
|
|
|
468
469
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom);
|
|
469
470
|
};
|
|
470
471
|
|
|
472
|
+
GoogleMintMapController.prototype.getCenter = function () {
|
|
473
|
+
return this.getCurrBounds().getCenter();
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
GoogleMintMapController.prototype.setCenter = function (position) {
|
|
477
|
+
var _a;
|
|
478
|
+
|
|
479
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
480
|
+
};
|
|
481
|
+
|
|
471
482
|
return GoogleMintMapController;
|
|
472
483
|
}(MintMapController.MintMapController);
|
|
473
484
|
|
|
@@ -394,6 +394,9 @@ var NaverMintMapController = function (_super) {
|
|
|
394
394
|
options = {
|
|
395
395
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
396
396
|
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
397
|
+
draggable: this.mapProps.draggable === false ? false : true,
|
|
398
|
+
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
399
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
397
400
|
logoControl: false,
|
|
398
401
|
mapDataControl: false,
|
|
399
402
|
mapTypeControl: false,
|
|
@@ -515,6 +518,16 @@ var NaverMintMapController = function (_super) {
|
|
|
515
518
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom, true);
|
|
516
519
|
};
|
|
517
520
|
|
|
521
|
+
NaverMintMapController.prototype.getCenter = function () {
|
|
522
|
+
return this.getCurrBounds().getCenter();
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
NaverMintMapController.prototype.setCenter = function (position) {
|
|
526
|
+
var _a;
|
|
527
|
+
|
|
528
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
529
|
+
};
|
|
530
|
+
|
|
518
531
|
return NaverMintMapController;
|
|
519
532
|
}(MintMapController.MintMapController);
|
|
520
533
|
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __generator, __extends, __assign, __rest, __spreadArray } from 'tslib';
|
|
2
|
-
import React, { createContext, useContext, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import React, { createContext, useContext, useRef, useState, useEffect, useMemo } from 'react';
|
|
3
3
|
import classNames from 'classnames/bind';
|
|
4
4
|
import styleInject from 'style-inject';
|
|
5
5
|
import { ObjectPool } from '@mint-ui/tools';
|
|
@@ -38,7 +38,8 @@ function MintMapCore(_a) {
|
|
|
38
38
|
var onLoad = _a.onLoad,
|
|
39
39
|
_b = _a.visible,
|
|
40
40
|
visible = _b === void 0 ? true : _b,
|
|
41
|
-
|
|
41
|
+
zoomLevel = _a.zoomLevel,
|
|
42
|
+
center = _a.center,
|
|
42
43
|
children = _a.children;
|
|
43
44
|
var controller = useMintMapController();
|
|
44
45
|
var elementRef = useRef(null);
|
|
@@ -77,21 +78,30 @@ function MintMapCore(_a) {
|
|
|
77
78
|
};
|
|
78
79
|
}, [controller, elementRef]);
|
|
79
80
|
useEffect(function () {
|
|
80
|
-
if (
|
|
81
|
+
if (zoomLevel && controller && mapInitialized) {
|
|
81
82
|
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
82
83
|
|
|
83
|
-
if (prevZoomLevel !==
|
|
84
|
-
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(
|
|
84
|
+
if (prevZoomLevel !== zoomLevel) {
|
|
85
|
+
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
}, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
}, [zoomLevel]);
|
|
89
|
+
useEffect(function () {
|
|
90
|
+
if (center && controller && mapInitialized) {
|
|
91
|
+
var prevCenter = controller.getCenter();
|
|
92
|
+
|
|
93
|
+
if (!Position.equals(prevCenter, center)) {
|
|
94
|
+
controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
95
|
+
}
|
|
92
96
|
}
|
|
97
|
+
}, [center]);
|
|
98
|
+
return React.createElement("div", {
|
|
99
|
+
className: cn$2('mint-map-root')
|
|
93
100
|
}, mapInitialized && children, React.createElement("div", {
|
|
94
101
|
className: cn$2('mint-map-container'),
|
|
102
|
+
style: {
|
|
103
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
104
|
+
},
|
|
95
105
|
ref: elementRef
|
|
96
106
|
}));
|
|
97
107
|
}
|
|
@@ -791,6 +801,9 @@ var NaverMintMapController = function (_super) {
|
|
|
791
801
|
options = {
|
|
792
802
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
793
803
|
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
804
|
+
draggable: this.mapProps.draggable === false ? false : true,
|
|
805
|
+
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
806
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
794
807
|
logoControl: false,
|
|
795
808
|
mapDataControl: false,
|
|
796
809
|
mapTypeControl: false,
|
|
@@ -912,6 +925,16 @@ var NaverMintMapController = function (_super) {
|
|
|
912
925
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom, true);
|
|
913
926
|
};
|
|
914
927
|
|
|
928
|
+
NaverMintMapController.prototype.getCenter = function () {
|
|
929
|
+
return this.getCurrBounds().getCenter();
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
NaverMintMapController.prototype.setCenter = function (position) {
|
|
933
|
+
var _a;
|
|
934
|
+
|
|
935
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
936
|
+
};
|
|
937
|
+
|
|
915
938
|
return NaverMintMapController;
|
|
916
939
|
}(MintMapController);
|
|
917
940
|
|
|
@@ -1304,7 +1327,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
1304
1327
|
minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
|
|
1305
1328
|
zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
|
|
1306
1329
|
disableDefaultUI: true,
|
|
1307
|
-
gestureHandling: 'greedy',
|
|
1330
|
+
gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
|
|
1331
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
1308
1332
|
clickableIcons: false
|
|
1309
1333
|
});
|
|
1310
1334
|
this.map = map;
|
|
@@ -1376,6 +1400,16 @@ var GoogleMintMapController = function (_super) {
|
|
|
1376
1400
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom);
|
|
1377
1401
|
};
|
|
1378
1402
|
|
|
1403
|
+
GoogleMintMapController.prototype.getCenter = function () {
|
|
1404
|
+
return this.getCurrBounds().getCenter();
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
GoogleMintMapController.prototype.setCenter = function (position) {
|
|
1408
|
+
var _a;
|
|
1409
|
+
|
|
1410
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1379
1413
|
return GoogleMintMapController;
|
|
1380
1414
|
}(MintMapController);
|
|
1381
1415
|
|
|
@@ -1387,6 +1421,10 @@ var Position = function () {
|
|
|
1387
1421
|
this.lng = lng;
|
|
1388
1422
|
}
|
|
1389
1423
|
|
|
1424
|
+
Position.equals = function (pos1, pos2) {
|
|
1425
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1390
1428
|
return Position;
|
|
1391
1429
|
}();
|
|
1392
1430
|
|
|
@@ -1551,19 +1589,25 @@ var DEFAULT_CENTER = {
|
|
|
1551
1589
|
lng: 127.0448698
|
|
1552
1590
|
};
|
|
1553
1591
|
function MintMap(_a) {
|
|
1554
|
-
var
|
|
1592
|
+
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
1593
|
+
mapType = _a.mapType,
|
|
1555
1594
|
children = _a.children,
|
|
1556
1595
|
_b = _a.base,
|
|
1557
1596
|
base = _b === void 0 ? {
|
|
1558
1597
|
center: DEFAULT_CENTER,
|
|
1559
1598
|
zoomLevel: 12
|
|
1560
1599
|
} : _b,
|
|
1561
|
-
props = __rest(_a, ["mapType", "children", "base"]);
|
|
1600
|
+
props = __rest(_a, ["mapLoadingComponent", "mapType", "children", "base"]);
|
|
1562
1601
|
|
|
1563
1602
|
var _c = useState(),
|
|
1564
1603
|
controller = _c[0],
|
|
1565
1604
|
setController = _c[1];
|
|
1566
1605
|
|
|
1606
|
+
var loading = useMemo(function () {
|
|
1607
|
+
return mapLoadingComponent ? mapLoadingComponent() : React.createElement(PointLoading, {
|
|
1608
|
+
text: "Loading"
|
|
1609
|
+
});
|
|
1610
|
+
}, [mapLoadingComponent]);
|
|
1567
1611
|
useEffect(function () {
|
|
1568
1612
|
if (mapType && mapType.length > 0) {
|
|
1569
1613
|
setController(undefined);
|
|
@@ -1594,9 +1638,7 @@ function MintMap(_a) {
|
|
|
1594
1638
|
mapType: mapType
|
|
1595
1639
|
}, props, {
|
|
1596
1640
|
base: base
|
|
1597
|
-
}), children)) : React.createElement(
|
|
1598
|
-
text: "Loading"
|
|
1599
|
-
}));
|
|
1641
|
+
}), children)) : React.createElement(React.Fragment, null, loading));
|
|
1600
1642
|
}
|
|
1601
1643
|
|
|
1602
1644
|
function PointLoading(_a) {
|
package/dist/index.umd.js
CHANGED
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
var onLoad = _a.onLoad,
|
|
44
44
|
_b = _a.visible,
|
|
45
45
|
visible = _b === void 0 ? true : _b,
|
|
46
|
-
|
|
46
|
+
zoomLevel = _a.zoomLevel,
|
|
47
|
+
center = _a.center,
|
|
47
48
|
children = _a.children;
|
|
48
49
|
var controller = useMintMapController();
|
|
49
50
|
var elementRef = React.useRef(null);
|
|
@@ -82,21 +83,30 @@
|
|
|
82
83
|
};
|
|
83
84
|
}, [controller, elementRef]);
|
|
84
85
|
React.useEffect(function () {
|
|
85
|
-
if (
|
|
86
|
+
if (zoomLevel && controller && mapInitialized) {
|
|
86
87
|
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
87
88
|
|
|
88
|
-
if (prevZoomLevel !==
|
|
89
|
-
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(
|
|
89
|
+
if (prevZoomLevel !== zoomLevel) {
|
|
90
|
+
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
}, [zoomLevel]);
|
|
94
|
+
React.useEffect(function () {
|
|
95
|
+
if (center && controller && mapInitialized) {
|
|
96
|
+
var prevCenter = controller.getCenter();
|
|
97
|
+
|
|
98
|
+
if (!Position.equals(prevCenter, center)) {
|
|
99
|
+
controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
100
|
+
}
|
|
97
101
|
}
|
|
102
|
+
}, [center]);
|
|
103
|
+
return React__default["default"].createElement("div", {
|
|
104
|
+
className: cn$2('mint-map-root')
|
|
98
105
|
}, mapInitialized && children, React__default["default"].createElement("div", {
|
|
99
106
|
className: cn$2('mint-map-container'),
|
|
107
|
+
style: {
|
|
108
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
109
|
+
},
|
|
100
110
|
ref: elementRef
|
|
101
111
|
}));
|
|
102
112
|
}
|
|
@@ -796,6 +806,9 @@
|
|
|
796
806
|
options = {
|
|
797
807
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
798
808
|
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
809
|
+
draggable: this.mapProps.draggable === false ? false : true,
|
|
810
|
+
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
811
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
799
812
|
logoControl: false,
|
|
800
813
|
mapDataControl: false,
|
|
801
814
|
mapTypeControl: false,
|
|
@@ -917,6 +930,16 @@
|
|
|
917
930
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom, true);
|
|
918
931
|
};
|
|
919
932
|
|
|
933
|
+
NaverMintMapController.prototype.getCenter = function () {
|
|
934
|
+
return this.getCurrBounds().getCenter();
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
NaverMintMapController.prototype.setCenter = function (position) {
|
|
938
|
+
var _a;
|
|
939
|
+
|
|
940
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
941
|
+
};
|
|
942
|
+
|
|
920
943
|
return NaverMintMapController;
|
|
921
944
|
}(MintMapController);
|
|
922
945
|
|
|
@@ -1309,7 +1332,8 @@
|
|
|
1309
1332
|
minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
|
|
1310
1333
|
zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
|
|
1311
1334
|
disableDefaultUI: true,
|
|
1312
|
-
gestureHandling: 'greedy',
|
|
1335
|
+
gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
|
|
1336
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
1313
1337
|
clickableIcons: false
|
|
1314
1338
|
});
|
|
1315
1339
|
this.map = map;
|
|
@@ -1381,6 +1405,16 @@
|
|
|
1381
1405
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom);
|
|
1382
1406
|
};
|
|
1383
1407
|
|
|
1408
|
+
GoogleMintMapController.prototype.getCenter = function () {
|
|
1409
|
+
return this.getCurrBounds().getCenter();
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
GoogleMintMapController.prototype.setCenter = function (position) {
|
|
1413
|
+
var _a;
|
|
1414
|
+
|
|
1415
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1384
1418
|
return GoogleMintMapController;
|
|
1385
1419
|
}(MintMapController);
|
|
1386
1420
|
|
|
@@ -1392,6 +1426,10 @@
|
|
|
1392
1426
|
this.lng = lng;
|
|
1393
1427
|
}
|
|
1394
1428
|
|
|
1429
|
+
Position.equals = function (pos1, pos2) {
|
|
1430
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1395
1433
|
return Position;
|
|
1396
1434
|
}();
|
|
1397
1435
|
|
|
@@ -1556,19 +1594,25 @@
|
|
|
1556
1594
|
lng: 127.0448698
|
|
1557
1595
|
};
|
|
1558
1596
|
function MintMap(_a) {
|
|
1559
|
-
var
|
|
1597
|
+
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
1598
|
+
mapType = _a.mapType,
|
|
1560
1599
|
children = _a.children,
|
|
1561
1600
|
_b = _a.base,
|
|
1562
1601
|
base = _b === void 0 ? {
|
|
1563
1602
|
center: DEFAULT_CENTER,
|
|
1564
1603
|
zoomLevel: 12
|
|
1565
1604
|
} : _b,
|
|
1566
|
-
props = tslib.__rest(_a, ["mapType", "children", "base"]);
|
|
1605
|
+
props = tslib.__rest(_a, ["mapLoadingComponent", "mapType", "children", "base"]);
|
|
1567
1606
|
|
|
1568
1607
|
var _c = React.useState(),
|
|
1569
1608
|
controller = _c[0],
|
|
1570
1609
|
setController = _c[1];
|
|
1571
1610
|
|
|
1611
|
+
var loading = React.useMemo(function () {
|
|
1612
|
+
return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(PointLoading, {
|
|
1613
|
+
text: "Loading"
|
|
1614
|
+
});
|
|
1615
|
+
}, [mapLoadingComponent]);
|
|
1572
1616
|
React.useEffect(function () {
|
|
1573
1617
|
if (mapType && mapType.length > 0) {
|
|
1574
1618
|
setController(undefined);
|
|
@@ -1599,9 +1643,7 @@
|
|
|
1599
1643
|
mapType: mapType
|
|
1600
1644
|
}, props, {
|
|
1601
1645
|
base: base
|
|
1602
|
-
}), children)) : React__default["default"].createElement(
|
|
1603
|
-
text: "Loading"
|
|
1604
|
-
}));
|
|
1646
|
+
}), children)) : React__default["default"].createElement(React__default["default"].Fragment, null, loading));
|
|
1605
1647
|
}
|
|
1606
1648
|
|
|
1607
1649
|
function PointLoading(_a) {
|