@mint-ui/map 0.4.5-beta → 0.5.0-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/.eslintrc.js +109 -109
- package/LICENSE +21 -21
- package/README.md +73 -73
- package/dist/components/mint-map/MintMap.d.ts +10 -117
- package/dist/components/mint-map/MintMap.js +24 -421
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapCanvasRenderer.js +3 -1
- package/dist/components/mint-map/core/MintMapController.d.ts +64 -44
- package/dist/components/mint-map/core/MintMapController.js +49 -15
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/MintMapCore.js +22 -10
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +11 -7
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -0
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.js +257 -0
- package/dist/components/mint-map/core/advanced/index.d.ts +3 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -0
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +137 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +188 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +54 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +152 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +60 -0
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -0
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +21 -9
- package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
- package/dist/components/mint-map/core/index.d.ts +8 -8
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
- package/dist/components/mint-map/core/provider/index.d.ts +1 -1
- package/dist/components/mint-map/core/util/animation.d.ts +16 -16
- package/dist/components/mint-map/core/util/animation.js +14 -5
- package/dist/components/mint-map/core/util/calculate.d.ts +66 -34
- package/dist/components/mint-map/core/util/calculate.js +233 -27
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/cluster.js +14 -9
- package/dist/components/mint-map/core/util/index.d.ts +4 -4
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/util/waiting.js +6 -2
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +32 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +76 -28
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +224 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +265 -66
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +53 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +237 -50
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
- package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
- package/dist/components/mint-map/types/MapDrawables.js +92 -0
- package/dist/components/mint-map/types/MapEventTypes.d.ts +41 -0
- package/dist/components/mint-map/types/MapEventTypes.js +57 -0
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -0
- package/dist/components/mint-map/types/MapTypes.js +155 -0
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
- package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
- package/dist/components/mint-map/types/index.d.ts +6 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +2638 -975
- package/dist/index.js +25 -9
- package/dist/index.umd.js +2644 -974
- package/package.json +77 -77
- package/test.ts +0 -7
|
@@ -3,16 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var MintMap = require('../MintMap.js');
|
|
7
6
|
var uuid = require('uuid');
|
|
7
|
+
var MapTypes = require('../types/MapTypes.js');
|
|
8
8
|
|
|
9
|
-
var MintMapController =
|
|
9
|
+
var MintMapController =
|
|
10
|
+
/** @class */
|
|
11
|
+
function () {
|
|
12
|
+
//constructor
|
|
10
13
|
function MintMapController(props) {
|
|
11
14
|
this.mapApiLoaded = false;
|
|
12
15
|
this.mapInitialized = false;
|
|
13
|
-
this.processedTime = 0;
|
|
16
|
+
this.processedTime = 0; //props
|
|
17
|
+
|
|
14
18
|
this.mapProps = props;
|
|
15
|
-
}
|
|
19
|
+
} //기본 기능
|
|
20
|
+
|
|
16
21
|
|
|
17
22
|
MintMapController.prototype.getMap = function () {
|
|
18
23
|
return this.map;
|
|
@@ -20,7 +25,8 @@ var MintMapController = function () {
|
|
|
20
25
|
|
|
21
26
|
MintMapController.prototype.getMapType = function () {
|
|
22
27
|
return this.type;
|
|
23
|
-
};
|
|
28
|
+
}; //기본 기능 - 좌표 변환
|
|
29
|
+
|
|
24
30
|
|
|
25
31
|
MintMapController.prototype.positionToOffset = function (position) {
|
|
26
32
|
var div = this.mapDivElement;
|
|
@@ -35,7 +41,7 @@ var MintMapController = function () {
|
|
|
35
41
|
var minLat = bounds.sw.lat;
|
|
36
42
|
var lat = Math.abs(maxLat - minLat);
|
|
37
43
|
var y = h * (maxLat - position.lat) / lat;
|
|
38
|
-
return new
|
|
44
|
+
return new MapTypes.Offset(x, y);
|
|
39
45
|
};
|
|
40
46
|
|
|
41
47
|
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
@@ -45,32 +51,44 @@ var MintMapController = function () {
|
|
|
45
51
|
var bounds = this.getCurrBounds();
|
|
46
52
|
var maxLng = bounds.ne.lng;
|
|
47
53
|
var minLng = bounds.sw.lng;
|
|
48
|
-
var lng = Math.abs(maxLng - minLng);
|
|
54
|
+
var lng = Math.abs(maxLng - minLng); //const x = w * (position.lng - minLng) / lng
|
|
55
|
+
|
|
49
56
|
var lngVal = offset.x * lng / w + minLng;
|
|
50
57
|
var maxLat = bounds.ne.lat;
|
|
51
58
|
var minLat = bounds.sw.lat;
|
|
52
|
-
var lat = Math.abs(maxLat - minLat);
|
|
59
|
+
var lat = Math.abs(maxLat - minLat); //const y = h * (maxLat - position.lat) / lat
|
|
60
|
+
|
|
53
61
|
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
54
|
-
return new
|
|
55
|
-
};
|
|
62
|
+
return new MapTypes.Position(latVal, lngVal);
|
|
63
|
+
}; //스크립트 로드
|
|
64
|
+
|
|
56
65
|
|
|
57
66
|
MintMapController.prototype.loadScript = function (url, id, checkLoaded) {
|
|
58
67
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
59
68
|
return tslib.__generator(this, function (_a) {
|
|
60
|
-
|
|
69
|
+
//boolean -> script 로드 후 callback 실행 여부
|
|
70
|
+
//** callback 실행이 여기서 안된 경우는 바깥에서 해줘야한다.
|
|
71
|
+
return [2
|
|
72
|
+
/*return*/
|
|
73
|
+
, new Promise(function (resolve) {
|
|
74
|
+
//이미 로드되어 있으면 종료
|
|
61
75
|
if (checkLoaded()) {
|
|
62
76
|
resolve(false);
|
|
63
77
|
return;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
|
-
var prevElement = id ? document.getElementById(id) : undefined;
|
|
80
|
+
var prevElement = id ? document.getElementById(id) : undefined; //기존 스크립트 로드 정보가 있으면
|
|
67
81
|
|
|
68
82
|
if (prevElement) {
|
|
83
|
+
// console.log(`already loaded script => ${id}`)
|
|
84
|
+
//로드 되어 있지 않으면 스크립트 load 이벤트 끼워넣기
|
|
69
85
|
prevElement.addEventListener('load', function () {
|
|
86
|
+
// console.log('script loaded!!!')
|
|
70
87
|
resolve(false);
|
|
71
88
|
});
|
|
72
89
|
return;
|
|
73
|
-
}
|
|
90
|
+
} //스크립트 로드 처리
|
|
91
|
+
|
|
74
92
|
|
|
75
93
|
var script = document.createElement('script');
|
|
76
94
|
script.src = url;
|
|
@@ -89,6 +107,14 @@ var MintMapController = function () {
|
|
|
89
107
|
MintMapController.prototype.getRandomFunctionName = function (prefix) {
|
|
90
108
|
return "".concat(prefix, "_").concat(uuid.v4().replace(/-/g, '_'));
|
|
91
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* URL 빌더 메서드
|
|
112
|
+
*
|
|
113
|
+
* @param {string} baseUrl: 기본 URL
|
|
114
|
+
* @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
|
|
115
|
+
* @returns {string} URL
|
|
116
|
+
*/
|
|
117
|
+
|
|
92
118
|
|
|
93
119
|
MintMapController.prototype.buildUrl = function (baseUrl, param) {
|
|
94
120
|
var params = Object.entries(param).map(function (_a) {
|
|
@@ -99,9 +125,15 @@ var MintMapController = function () {
|
|
|
99
125
|
}).join('&');
|
|
100
126
|
return "".concat(baseUrl, "?").concat(params);
|
|
101
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* 쓰로틀링 처리
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
|
|
102
133
|
|
|
103
134
|
MintMapController.prototype.checkBoundsChangeThrottleTime = function () {
|
|
104
|
-
if (!this.mapProps.boundsChangeThrottlingTime) return true;
|
|
135
|
+
if (!this.mapProps.boundsChangeThrottlingTime) return true; //boundsChangeThrottlingTime 이내의 연속 요청은 제외시킴
|
|
136
|
+
|
|
105
137
|
var time = new Date().getTime();
|
|
106
138
|
|
|
107
139
|
if (this.processedTime > 0 && time - this.processedTime < this.mapProps.boundsChangeThrottlingTime) {
|
|
@@ -139,7 +171,9 @@ var MintMapController = function () {
|
|
|
139
171
|
return MintMapController;
|
|
140
172
|
}();
|
|
141
173
|
|
|
142
|
-
var MapZoomInfo =
|
|
174
|
+
var MapZoomInfo =
|
|
175
|
+
/** @class */
|
|
176
|
+
function () {
|
|
143
177
|
function MapZoomInfo() {}
|
|
144
178
|
|
|
145
179
|
MapZoomInfo.BASE_TO_MAP = new Map([[1, new Map([['google', {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { MintMapProps } from "../
|
|
3
|
-
export declare function MintMapCore({ onLoad, visible, zoomLevel, center, centerMoveWithPanning, children }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { MintMapProps } from "../types/MintMapProps";
|
|
3
|
+
export declare function MintMapCore({ onLoad, visible, zoomLevel, center, centerMoveWithPanning, children }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
@@ -5,7 +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
|
|
8
|
+
var MapTypes = require('../types/MapTypes.js');
|
|
9
9
|
var MintMapProvider = require('./provider/MintMapProvider.js');
|
|
10
10
|
var MintMapCore_module = require('./MintMapCore.module.scss.js');
|
|
11
11
|
|
|
@@ -25,8 +25,10 @@ function MintMapCore(_a) {
|
|
|
25
25
|
center = _a.center,
|
|
26
26
|
_c = _a.centerMoveWithPanning,
|
|
27
27
|
centerMoveWithPanning = _c === void 0 ? false : _c,
|
|
28
|
-
children = _a.children;
|
|
29
|
-
|
|
28
|
+
children = _a.children; //controller
|
|
29
|
+
|
|
30
|
+
var controller = MintMapProvider.useMintMapController(); //맵 초기화
|
|
31
|
+
|
|
30
32
|
var elementRef = React.useRef(null);
|
|
31
33
|
|
|
32
34
|
var _d = React.useState(false),
|
|
@@ -40,11 +42,17 @@ function MintMapCore(_a) {
|
|
|
40
42
|
return tslib.__generator(this, function (_a) {
|
|
41
43
|
switch (_a.label) {
|
|
42
44
|
case 0:
|
|
43
|
-
if (!(elementRef && elementRef.current)) return [3
|
|
44
|
-
|
|
45
|
+
if (!(elementRef && elementRef.current)) return [3
|
|
46
|
+
/*break*/
|
|
47
|
+
, 2];
|
|
48
|
+
return [4
|
|
49
|
+
/*yield*/
|
|
50
|
+
, controller.initializingMap(elementRef.current) //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
51
|
+
];
|
|
45
52
|
|
|
46
53
|
case 1:
|
|
47
|
-
map_1 = _a.sent();
|
|
54
|
+
map_1 = _a.sent(); //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
55
|
+
|
|
48
56
|
setTimeout(function () {
|
|
49
57
|
setMapInitialized(true);
|
|
50
58
|
onLoad && onLoad(map_1, controller);
|
|
@@ -52,7 +60,9 @@ function MintMapCore(_a) {
|
|
|
52
60
|
_a.label = 2;
|
|
53
61
|
|
|
54
62
|
case 2:
|
|
55
|
-
return [2
|
|
63
|
+
return [2
|
|
64
|
+
/*return*/
|
|
65
|
+
];
|
|
56
66
|
}
|
|
57
67
|
});
|
|
58
68
|
});
|
|
@@ -61,7 +71,8 @@ function MintMapCore(_a) {
|
|
|
61
71
|
return function () {
|
|
62
72
|
controller && controller.destroyMap();
|
|
63
73
|
};
|
|
64
|
-
}, [controller, elementRef]);
|
|
74
|
+
}, [controller, elementRef]); //줌레벨
|
|
75
|
+
|
|
65
76
|
React.useEffect(function () {
|
|
66
77
|
if (zoomLevel && controller && mapInitialized) {
|
|
67
78
|
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
@@ -70,12 +81,13 @@ function MintMapCore(_a) {
|
|
|
70
81
|
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
71
82
|
}
|
|
72
83
|
}
|
|
73
|
-
}, [zoomLevel]);
|
|
84
|
+
}, [zoomLevel]); //센터
|
|
85
|
+
|
|
74
86
|
React.useEffect(function () {
|
|
75
87
|
if (center && controller && mapInitialized) {
|
|
76
88
|
var prevCenter = controller.getCenter();
|
|
77
89
|
|
|
78
|
-
if (!
|
|
90
|
+
if (!MapTypes.Position.equals(prevCenter, center)) {
|
|
79
91
|
centerMoveWithPanning ? controller === null || controller === void 0 ? void 0 : controller.panningTo(center) : controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
80
92
|
}
|
|
81
93
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Position } from "../../
|
|
3
|
-
interface MapBuildingProjectionProps {
|
|
4
|
-
basePolygonPath: Position[];
|
|
5
|
-
numberOfFloor: number;
|
|
6
|
-
heightOfFloor?: number;
|
|
7
|
-
lineColor?: string;
|
|
8
|
-
lineOpacity?: number;
|
|
9
|
-
fillColor?: string;
|
|
10
|
-
fillOpacity?: number;
|
|
11
|
-
title?: string;
|
|
12
|
-
titleElement?: JSX.Element;
|
|
13
|
-
}
|
|
14
|
-
export declare function MapBuildingProjection(props: MapBuildingProjectionProps): JSX.Element;
|
|
15
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Position } from "../../types/MapTypes";
|
|
3
|
+
interface MapBuildingProjectionProps {
|
|
4
|
+
basePolygonPath: Position[];
|
|
5
|
+
numberOfFloor: number;
|
|
6
|
+
heightOfFloor?: number;
|
|
7
|
+
lineColor?: string;
|
|
8
|
+
lineOpacity?: number;
|
|
9
|
+
fillColor?: string;
|
|
10
|
+
fillOpacity?: number;
|
|
11
|
+
title?: string;
|
|
12
|
+
titleElement?: JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export declare function MapBuildingProjection(props: MapBuildingProjectionProps): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var MapTypes = require('../../types/MapTypes.js');
|
|
8
8
|
var calculate = require('../util/calculate.js');
|
|
9
9
|
var MapMarkerWrapper = require('../wrapper/MapMarkerWrapper.js');
|
|
10
10
|
var MapPolygonWrapper = require('../wrapper/MapPolygonWrapper.js');
|
|
@@ -77,21 +77,24 @@ function MapBuildingProjection(props) {
|
|
|
77
77
|
var wallPolygons = React.useRef();
|
|
78
78
|
var titlePosition = React.useRef();
|
|
79
79
|
React.useEffect(function () {
|
|
80
|
+
//베이스 폴리곤
|
|
80
81
|
var base = {
|
|
81
82
|
position: basePolygonPath
|
|
82
83
|
};
|
|
83
84
|
var height = numberOfFloor * heightOfFloor;
|
|
84
|
-
var projectionHeight = calculate.GeoCalulator.convertMeterToLatitudeValue(height);
|
|
85
|
+
var projectionHeight = calculate.GeoCalulator.convertMeterToLatitudeValue(height); //roof
|
|
86
|
+
|
|
85
87
|
var roofPaths = [];
|
|
86
88
|
|
|
87
89
|
for (var _i = 0, basePolygonPath_1 = basePolygonPath; _i < basePolygonPath_1.length; _i++) {
|
|
88
90
|
var pos = basePolygonPath_1[_i];
|
|
89
|
-
roofPaths.push(new
|
|
91
|
+
roofPaths.push(new MapTypes.Position(pos.lat + projectionHeight, pos.lng));
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
roofPolygon.current = {
|
|
93
95
|
position: roofPaths
|
|
94
|
-
};
|
|
96
|
+
}; //walls
|
|
97
|
+
|
|
95
98
|
wallPolygons.current = [];
|
|
96
99
|
|
|
97
100
|
for (var i = 0; i < basePolygonPath.length; i++) {
|
|
@@ -102,13 +105,14 @@ function MapBuildingProjection(props) {
|
|
|
102
105
|
wallPolygons.current.push({
|
|
103
106
|
position: [start, startNext, endNext, end]
|
|
104
107
|
});
|
|
105
|
-
}
|
|
108
|
+
} //latitude 기준으로 배열 재정렬
|
|
109
|
+
|
|
106
110
|
|
|
107
111
|
wallPolygons.current.sort(function (a, b) {
|
|
108
112
|
var maxA = getMaxLat(a.position);
|
|
109
113
|
var maxB = getMaxLat(b.position);
|
|
110
114
|
return maxA.lat < maxB.lat ? 1 : -1;
|
|
111
|
-
});
|
|
115
|
+
}); //latitude 가장 높은값과 longitude 중간값으로 타이틀 위치 결정
|
|
112
116
|
|
|
113
117
|
if (title || titleElement) {
|
|
114
118
|
var maxPos = getMaxLat(wallPolygons.current[0].position);
|
|
@@ -118,7 +122,7 @@ function MapBuildingProjection(props) {
|
|
|
118
122
|
var minLng = getLngMinMax(minLngPos.position, false);
|
|
119
123
|
var mid = minLng.lng + (maxLng.lng - minLng.lng) / 2;
|
|
120
124
|
titlePosition.current = {
|
|
121
|
-
position: new
|
|
125
|
+
position: new MapTypes.Position(maxPos.lat, mid)
|
|
122
126
|
};
|
|
123
127
|
} else {
|
|
124
128
|
titlePosition.current = undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* 유틸 컴포넌트 : 텍스트 로딩
|
|
4
|
+
*/
|
|
5
|
+
export interface PointLoadingProps {
|
|
6
|
+
text?: string;
|
|
7
|
+
pointCount?: number;
|
|
8
|
+
speedMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function PointLoading({ text, pointCount, speedMs }: PointLoadingProps): JSX.Element;
|
|
11
|
+
export declare function MapLoadingWithImage({ size }: MapImageLoadingProps): JSX.Element;
|
|
12
|
+
interface MapImageLoadingProps {
|
|
13
|
+
size?: number;
|
|
14
|
+
duration?: number;
|
|
15
|
+
delay?: number;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var classNames = require('classnames/bind');
|
|
7
|
+
var MintMap_module = require('../../MintMap.module.scss.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
13
|
+
|
|
14
|
+
var cn = classNames__default["default"].bind(MintMap_module);
|
|
15
|
+
function PointLoading(_a) {
|
|
16
|
+
var _b = _a.text,
|
|
17
|
+
text = _b === void 0 ? 'Loading' : _b,
|
|
18
|
+
_c = _a.pointCount,
|
|
19
|
+
pointCount = _c === void 0 ? 4 : _c,
|
|
20
|
+
_d = _a.speedMs,
|
|
21
|
+
speedMs = _d === void 0 ? 200 : _d;
|
|
22
|
+
var pointStringPool = React.useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
23
|
+
return Array.from(Array(idx + 1)).map(function () {
|
|
24
|
+
return '.';
|
|
25
|
+
}).join('');
|
|
26
|
+
}))[0];
|
|
27
|
+
|
|
28
|
+
var _e = React.useState(''),
|
|
29
|
+
pointString = _e[0],
|
|
30
|
+
setPointString = _e[1];
|
|
31
|
+
|
|
32
|
+
React.useEffect(function () {
|
|
33
|
+
var pointStringIndex = 0;
|
|
34
|
+
var interval = setInterval(function () {
|
|
35
|
+
pointStringIndex += 1;
|
|
36
|
+
|
|
37
|
+
if (pointStringIndex >= pointCount) {
|
|
38
|
+
pointStringIndex = 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setPointString(pointStringPool[pointStringIndex]);
|
|
42
|
+
}, speedMs);
|
|
43
|
+
return function () {
|
|
44
|
+
interval && clearInterval(interval);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
return React__default["default"].createElement("div", {
|
|
48
|
+
className: cn('loading-point-container')
|
|
49
|
+
}, React__default["default"].createElement("div", {
|
|
50
|
+
style: {
|
|
51
|
+
width: '300px',
|
|
52
|
+
fontSize: '16px',
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
color: 'gray',
|
|
55
|
+
transform: 'translateX(130px)'
|
|
56
|
+
}
|
|
57
|
+
}, "".concat(text, " ").concat(pointString)));
|
|
58
|
+
}
|
|
59
|
+
function MapLoadingWithImage(_a) {
|
|
60
|
+
var _b = _a.size,
|
|
61
|
+
size = _b === void 0 ? 256 : _b;
|
|
62
|
+
|
|
63
|
+
var _c = React.useState(),
|
|
64
|
+
width = _c[0],
|
|
65
|
+
setWidth = _c[1];
|
|
66
|
+
|
|
67
|
+
var _d = React.useState(),
|
|
68
|
+
height = _d[0],
|
|
69
|
+
setHeight = _d[1];
|
|
70
|
+
|
|
71
|
+
var render = React.useMemo(function () {
|
|
72
|
+
if (!height || !width) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var row = Math.ceil(height / size);
|
|
77
|
+
var col = Math.ceil(width / size);
|
|
78
|
+
console.log('re render', width, height, row, col);
|
|
79
|
+
return Array.from(Array(row)).map(function () {
|
|
80
|
+
return React__default["default"].createElement("div", {
|
|
81
|
+
style: {
|
|
82
|
+
display: 'flex'
|
|
83
|
+
}
|
|
84
|
+
}, Array.from(Array(col)).map(function () {
|
|
85
|
+
var duration = Number((Math.random() * 4).toFixed(1)) + 1;
|
|
86
|
+
var delay = Number((Math.random() * 4).toFixed(1)) + 2;
|
|
87
|
+
return React__default["default"].createElement(LoadingImage, {
|
|
88
|
+
size: size,
|
|
89
|
+
duration: duration,
|
|
90
|
+
delay: delay
|
|
91
|
+
});
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
}, [width, height]);
|
|
95
|
+
return React__default["default"].createElement("div", {
|
|
96
|
+
ref: function (refs) {
|
|
97
|
+
setWidth(refs === null || refs === void 0 ? void 0 : refs.offsetWidth);
|
|
98
|
+
setHeight(refs === null || refs === void 0 ? void 0 : refs.offsetHeight);
|
|
99
|
+
},
|
|
100
|
+
style: {
|
|
101
|
+
width: '100%',
|
|
102
|
+
height: '100%',
|
|
103
|
+
overflow: 'hidden'
|
|
104
|
+
}
|
|
105
|
+
}, render);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function LoadingImage(_a) {
|
|
109
|
+
var _b = _a.size,
|
|
110
|
+
size = _b === void 0 ? 256 : _b,
|
|
111
|
+
_c = _a.duration,
|
|
112
|
+
duration = _c === void 0 ? 1 : _c,
|
|
113
|
+
_d = _a.delay,
|
|
114
|
+
delay = _d === void 0 ? 1 : _d;
|
|
115
|
+
var scale = 256 / 4000;
|
|
116
|
+
return React__default["default"].createElement("svg", {
|
|
117
|
+
className: cn("ani-fade-in"),
|
|
118
|
+
style: {
|
|
119
|
+
flex: "0 0 ".concat(size, "px"),
|
|
120
|
+
opacity: 0,
|
|
121
|
+
animationDelay: "".concat(delay, "s"),
|
|
122
|
+
animationDuration: "".concat(duration, "s"),
|
|
123
|
+
animationFillMode: 'forwards'
|
|
124
|
+
},
|
|
125
|
+
width: size,
|
|
126
|
+
height: size,
|
|
127
|
+
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
128
|
+
fill: "none",
|
|
129
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
130
|
+
}, React__default["default"].createElement("g", {
|
|
131
|
+
transform: "scale(".concat(scale, ")"),
|
|
132
|
+
"clip-path": "url(#clip0_5_701)"
|
|
133
|
+
}, React__default["default"].createElement("rect", {
|
|
134
|
+
width: "4000",
|
|
135
|
+
height: "4000",
|
|
136
|
+
transform: "translate(0 4000) rotate(-90)",
|
|
137
|
+
fill: "#F8F8F8"
|
|
138
|
+
}), React__default["default"].createElement("path", {
|
|
139
|
+
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
140
|
+
fill: "#E6E6E6"
|
|
141
|
+
}), React__default["default"].createElement("path", {
|
|
142
|
+
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
143
|
+
fill: "#F6E4DD"
|
|
144
|
+
}), React__default["default"].createElement("path", {
|
|
145
|
+
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
146
|
+
fill: "#DCEACA"
|
|
147
|
+
}), React__default["default"].createElement("path", {
|
|
148
|
+
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
149
|
+
fill: "#E6E6E6"
|
|
150
|
+
}), React__default["default"].createElement("path", {
|
|
151
|
+
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
152
|
+
fill: "#DCEACA"
|
|
153
|
+
}), React__default["default"].createElement("path", {
|
|
154
|
+
d: "M2094.05 1450.88C2127.97 1531.67 2192.23 1496.11 2250.02 1514.4C2567.73 1559.37 2608.68 1362.05 2668.2 1302.01C2736.79 1232.83 2612.15 1065.8 2523.28 1090.46C2434.42 1115.13 2432.96 1150.53 2415.25 1229.76C2397.53 1308.98 2233.45 1247.46 2177.4 1257.03C2121.35 1266.61 2051.65 1349.89 2094.05 1450.88Z",
|
|
155
|
+
fill: "#A2CAEE"
|
|
156
|
+
}), React__default["default"].createElement("circle", {
|
|
157
|
+
cx: "958",
|
|
158
|
+
cy: "3092",
|
|
159
|
+
r: "95",
|
|
160
|
+
fill: "#A2CAEE"
|
|
161
|
+
}), React__default["default"].createElement("circle", {
|
|
162
|
+
cx: "1127",
|
|
163
|
+
cy: "3176",
|
|
164
|
+
r: "56",
|
|
165
|
+
fill: "#A2CAEE"
|
|
166
|
+
}), React__default["default"].createElement("path", {
|
|
167
|
+
"fill-rule": "evenodd",
|
|
168
|
+
"clip-rule": "evenodd",
|
|
169
|
+
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
170
|
+
fill: "white"
|
|
171
|
+
}), React__default["default"].createElement("path", {
|
|
172
|
+
"fill-rule": "evenodd",
|
|
173
|
+
"clip-rule": "evenodd",
|
|
174
|
+
d: "M-317.721 1447.99L595.333 2953.94L1201.76 4004.26L1143.74 4037.76L537.668 2988.06L-375.013 1482.72L-317.721 1447.99ZM1058.06 1406.15L1789.22 920.04L1109.17 -5.66436L1163.17 -45.3311L1844.92 882.695L2486.62 448.527L3047.72 1427.91L2989.59 1461.22L2464.38 544.474L1855.66 956.322L1855.55 956.398L1095.15 1461.94L1058.06 1406.15ZM1384.39 3114.5L2197.8 2552.05L1838.4 2105.93L1890.57 2063.9L2253.06 2513.84L2642 2244.89L2680.11 2300L1883.89 2850.56L2238.69 3352.52L2183.98 3391.19L1828.78 2888.67L1422.5 3169.61L1384.39 3114.5Z",
|
|
175
|
+
fill: "white"
|
|
176
|
+
}), React__default["default"].createElement("path", {
|
|
177
|
+
"fill-rule": "evenodd",
|
|
178
|
+
"clip-rule": "evenodd",
|
|
179
|
+
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
180
|
+
fill: "#FBEDB1"
|
|
181
|
+
}), React__default["default"].createElement("path", {
|
|
182
|
+
"fill-rule": "evenodd",
|
|
183
|
+
"clip-rule": "evenodd",
|
|
184
|
+
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
185
|
+
fill: "white"
|
|
186
|
+
}), React__default["default"].createElement("path", {
|
|
187
|
+
"fill-rule": "evenodd",
|
|
188
|
+
"clip-rule": "evenodd",
|
|
189
|
+
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
190
|
+
fill: "white"
|
|
191
|
+
}), React__default["default"].createElement("path", {
|
|
192
|
+
"fill-rule": "evenodd",
|
|
193
|
+
"clip-rule": "evenodd",
|
|
194
|
+
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
195
|
+
fill: "white"
|
|
196
|
+
}), React__default["default"].createElement("path", {
|
|
197
|
+
"fill-rule": "evenodd",
|
|
198
|
+
"clip-rule": "evenodd",
|
|
199
|
+
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
200
|
+
fill: "white"
|
|
201
|
+
}), React__default["default"].createElement("path", {
|
|
202
|
+
"fill-rule": "evenodd",
|
|
203
|
+
"clip-rule": "evenodd",
|
|
204
|
+
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
205
|
+
fill: "white"
|
|
206
|
+
}), React__default["default"].createElement("path", {
|
|
207
|
+
"fill-rule": "evenodd",
|
|
208
|
+
"clip-rule": "evenodd",
|
|
209
|
+
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
210
|
+
fill: "white"
|
|
211
|
+
}), React__default["default"].createElement("path", {
|
|
212
|
+
"fill-rule": "evenodd",
|
|
213
|
+
"clip-rule": "evenodd",
|
|
214
|
+
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
215
|
+
fill: "white"
|
|
216
|
+
}), React__default["default"].createElement("path", {
|
|
217
|
+
"fill-rule": "evenodd",
|
|
218
|
+
"clip-rule": "evenodd",
|
|
219
|
+
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
220
|
+
fill: "white"
|
|
221
|
+
}), React__default["default"].createElement("path", {
|
|
222
|
+
"fill-rule": "evenodd",
|
|
223
|
+
"clip-rule": "evenodd",
|
|
224
|
+
d: "M466.178 1695.89L522.822 1660.11L813.709 2120.58L1365.65 1773.15L1401.35 1829.85L849.492 2177.23L1140.32 2637.61L1083.68 2673.39L466.178 1695.89Z",
|
|
225
|
+
fill: "white"
|
|
226
|
+
}), React__default["default"].createElement("path", {
|
|
227
|
+
"fill-rule": "evenodd",
|
|
228
|
+
"clip-rule": "evenodd",
|
|
229
|
+
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
230
|
+
fill: "white"
|
|
231
|
+
}), React__default["default"].createElement("path", {
|
|
232
|
+
"fill-rule": "evenodd",
|
|
233
|
+
"clip-rule": "evenodd",
|
|
234
|
+
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
235
|
+
fill: "white"
|
|
236
|
+
}), React__default["default"].createElement("path", {
|
|
237
|
+
"fill-rule": "evenodd",
|
|
238
|
+
"clip-rule": "evenodd",
|
|
239
|
+
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
240
|
+
fill: "white"
|
|
241
|
+
}), React__default["default"].createElement("path", {
|
|
242
|
+
"fill-rule": "evenodd",
|
|
243
|
+
"clip-rule": "evenodd",
|
|
244
|
+
d: "M-102.531 3333.52L1563.16 2259.21L418.867 413.751L541.25 337.866L1684.19 2181.14L4025.32 666.934L4103.57 787.82L2336.63 1931.51L3187.41 2659.17L4104.73 3340.1L4018.9 3455.73L3139.75 2803.13L956.929 4221.62L878.381 4100.93L1666.1 3588.26L1086.77 2737.81L-24.4816 3454.53L-102.531 3333.52ZM1207.82 2659.74L1786.86 3509.76L3022.47 2707.58L2210.46 2013.07L1207.82 2659.74Z",
|
|
245
|
+
fill: "#FBEDB1"
|
|
246
|
+
})), React__default["default"].createElement("defs", null, React__default["default"].createElement("clipPath", {
|
|
247
|
+
id: "clip0_5_701"
|
|
248
|
+
}, React__default["default"].createElement("rect", {
|
|
249
|
+
width: "4000",
|
|
250
|
+
height: "4000",
|
|
251
|
+
fill: "white",
|
|
252
|
+
transform: "translate(0 4000) rotate(-90)"
|
|
253
|
+
}))));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
exports.MapLoadingWithImage = MapLoadingWithImage;
|
|
257
|
+
exports.PointLoading = PointLoading;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { Position } from "../../../types";
|
|
3
|
+
export interface CircleMarkerProps {
|
|
4
|
+
center: Position;
|
|
5
|
+
radius: number;
|
|
6
|
+
radiusUnit?: 'PIXEL' | 'METER';
|
|
7
|
+
background?: string;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
zIndex?: number;
|
|
10
|
+
svgProperties?: React.SVGProps<SVGSVGElement>;
|
|
11
|
+
shapeProperties?: React.SVGProps<SVGCircleElement>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CircleMarker
|
|
15
|
+
*
|
|
16
|
+
* @param {CircleMarkerProps} CircleMarkerProps
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element} JSX
|
|
19
|
+
*/
|
|
20
|
+
export declare function CircleMarker({ children, center, radius, radiusUnit, background, svgProperties, shapeProperties, visible, zIndex, }: PropsWithChildren<CircleMarkerProps>): JSX.Element;
|