@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
package/dist/index.es.js
CHANGED
|
@@ -10,106 +10,9 @@ var css_248z$2 = ".MintMap-module_loading-point-container__znk6l {\n display: f
|
|
|
10
10
|
var styles$2 = {"loading-point-container":"MintMap-module_loading-point-container__znk6l","ani-blink":"MintMap-module_ani-blink__K89JK","blink":"MintMap-module_blink__mqfeV","ani-fade-in":"MintMap-module_ani-fade-in__lpHuy","fade-in":"MintMap-module_fade-in__jHpv1","ani-fade-out":"MintMap-module_ani-fade-out__5-esw","fade-out":"MintMap-module_fade-out__CIjGe","ani-expansion":"MintMap-module_ani-expansion__S2vOZ","expansion":"MintMap-module_expansion__WMo5-"};
|
|
11
11
|
styleInject(css_248z$2);
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
children = _a.children;
|
|
17
|
-
return React.createElement(MintMapControllerContext.Provider, {
|
|
18
|
-
value: controller
|
|
19
|
-
}, children);
|
|
20
|
-
}
|
|
21
|
-
function useMintMapController() {
|
|
22
|
-
var controller = useContext(MintMapControllerContext);
|
|
23
|
-
|
|
24
|
-
if (controller === null) {
|
|
25
|
-
throw new Error('controller is not initialized');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return controller;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var css_248z$1 = ".MintMapCore-module_mint-map-root__SMfwn {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\n.MintMapCore-module_mint-map-container__8MIIr {\n height: 100%;\n}";
|
|
32
|
-
var styles$1 = {"mint-map-root":"MintMapCore-module_mint-map-root__SMfwn","mint-map-container":"MintMapCore-module_mint-map-container__8MIIr"};
|
|
33
|
-
styleInject(css_248z$1);
|
|
34
|
-
|
|
35
|
-
var cn$2 = classNames.bind(styles$1);
|
|
36
|
-
function MintMapCore(_a) {
|
|
37
|
-
var _this = this;
|
|
38
|
-
|
|
39
|
-
var onLoad = _a.onLoad,
|
|
40
|
-
_b = _a.visible,
|
|
41
|
-
visible = _b === void 0 ? true : _b,
|
|
42
|
-
zoomLevel = _a.zoomLevel,
|
|
43
|
-
center = _a.center,
|
|
44
|
-
_c = _a.centerMoveWithPanning,
|
|
45
|
-
centerMoveWithPanning = _c === void 0 ? false : _c,
|
|
46
|
-
children = _a.children;
|
|
47
|
-
var controller = useMintMapController();
|
|
48
|
-
var elementRef = useRef(null);
|
|
49
|
-
|
|
50
|
-
var _d = useState(false),
|
|
51
|
-
mapInitialized = _d[0],
|
|
52
|
-
setMapInitialized = _d[1];
|
|
53
|
-
|
|
54
|
-
useEffect(function () {
|
|
55
|
-
(function () {
|
|
56
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
57
|
-
var map_1;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
if (!(elementRef && elementRef.current)) return [3, 2];
|
|
62
|
-
return [4, controller.initializingMap(elementRef.current)];
|
|
63
|
-
|
|
64
|
-
case 1:
|
|
65
|
-
map_1 = _a.sent();
|
|
66
|
-
setTimeout(function () {
|
|
67
|
-
setMapInitialized(true);
|
|
68
|
-
onLoad && onLoad(map_1, controller);
|
|
69
|
-
}, 100);
|
|
70
|
-
_a.label = 2;
|
|
71
|
-
|
|
72
|
-
case 2:
|
|
73
|
-
return [2];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
})();
|
|
78
|
-
|
|
79
|
-
return function () {
|
|
80
|
-
controller && controller.destroyMap();
|
|
81
|
-
};
|
|
82
|
-
}, [controller, elementRef]);
|
|
83
|
-
useEffect(function () {
|
|
84
|
-
if (zoomLevel && controller && mapInitialized) {
|
|
85
|
-
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
86
|
-
|
|
87
|
-
if (prevZoomLevel !== zoomLevel) {
|
|
88
|
-
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, [zoomLevel]);
|
|
92
|
-
useEffect(function () {
|
|
93
|
-
if (center && controller && mapInitialized) {
|
|
94
|
-
var prevCenter = controller.getCenter();
|
|
95
|
-
|
|
96
|
-
if (!Position.equals(prevCenter, center)) {
|
|
97
|
-
centerMoveWithPanning ? controller === null || controller === void 0 ? void 0 : controller.panningTo(center) : controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, [center]);
|
|
101
|
-
return React.createElement("div", {
|
|
102
|
-
className: cn$2('mint-map-root')
|
|
103
|
-
}, mapInitialized && children, React.createElement("div", {
|
|
104
|
-
className: cn$2('mint-map-container'),
|
|
105
|
-
style: {
|
|
106
|
-
visibility: visible ? 'inherit' : 'hidden'
|
|
107
|
-
},
|
|
108
|
-
ref: elementRef
|
|
109
|
-
}));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
var LinePoints = function () {
|
|
13
|
+
var LinePoints =
|
|
14
|
+
/** @class */
|
|
15
|
+
function () {
|
|
113
16
|
function LinePoints(x1, y1, x2, y2) {
|
|
114
17
|
this.x1 = x1;
|
|
115
18
|
this.y1 = y1;
|
|
@@ -120,10 +23,23 @@ var LinePoints = function () {
|
|
|
120
23
|
return LinePoints;
|
|
121
24
|
}();
|
|
122
25
|
|
|
123
|
-
var
|
|
26
|
+
var PositionMirror =
|
|
27
|
+
/** @class */
|
|
28
|
+
function () {
|
|
29
|
+
function PositionMirror(lat, lng) {
|
|
30
|
+
this.lat = lat;
|
|
31
|
+
this.lng = lng;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return PositionMirror;
|
|
35
|
+
}();
|
|
36
|
+
|
|
37
|
+
var PolygonCalculator =
|
|
38
|
+
/** @class */
|
|
39
|
+
function () {
|
|
124
40
|
function PolygonCalculator() {}
|
|
125
41
|
|
|
126
|
-
PolygonCalculator.
|
|
42
|
+
PolygonCalculator.getRegionInfo = function (positions) {
|
|
127
43
|
var maxX, minX, maxY, minY;
|
|
128
44
|
|
|
129
45
|
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
@@ -146,8 +62,41 @@ var PolygonCalculator = function () {
|
|
|
146
62
|
}
|
|
147
63
|
}
|
|
148
64
|
|
|
149
|
-
|
|
150
|
-
|
|
65
|
+
return {
|
|
66
|
+
maxLat: maxX,
|
|
67
|
+
minLat: minX,
|
|
68
|
+
maxLng: maxY,
|
|
69
|
+
minLng: minY,
|
|
70
|
+
centerLat: minX && maxX ? minX + (maxX - minX) / 2 : undefined,
|
|
71
|
+
centerLng: minY && maxY ? minY + (maxY - minY) / 2 : undefined
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
PolygonCalculator.getRegionStart = function (positions) {
|
|
76
|
+
var info = this.getRegionInfo(positions);
|
|
77
|
+
|
|
78
|
+
if (info.minLat && info.minLng) {
|
|
79
|
+
return new PositionMirror(info.minLat, info.minLng);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
throw new Error('Calculate RegionStart Error!!!');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
PolygonCalculator.getRegionEnd = function (positions) {
|
|
86
|
+
var info = this.getRegionInfo(positions);
|
|
87
|
+
|
|
88
|
+
if (info.maxLat && info.maxLng) {
|
|
89
|
+
return new PositionMirror(info.maxLat, info.maxLng);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
throw new Error('Calculate RegionEnd Error!!!');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
PolygonCalculator.getCenter = function (positions) {
|
|
96
|
+
var info = this.getRegionInfo(positions);
|
|
97
|
+
|
|
98
|
+
if (info.centerLat && info.centerLng) {
|
|
99
|
+
return new PositionMirror(info.centerLat, info.centerLng);
|
|
151
100
|
}
|
|
152
101
|
|
|
153
102
|
throw new Error('Calculate Center Error!!!');
|
|
@@ -180,9 +129,10 @@ var PolygonCalculator = function () {
|
|
|
180
129
|
var lines = this.convertPolygonToLinePoints(polygon);
|
|
181
130
|
|
|
182
131
|
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
|
183
|
-
var target = targets_1[_i];
|
|
184
|
-
|
|
185
|
-
var
|
|
132
|
+
var target = targets_1[_i]; //x 축으로 긴 직선과 폴리곤 path 와의 교차 수 비교
|
|
133
|
+
|
|
134
|
+
var tempLine = this.convertPositionToPoints(target, new PositionMirror(target.lat, maxX));
|
|
135
|
+
var crossPoints = this.getCrossPointAll(lines, tempLine); // console.log('crossPoints',crossPoints);
|
|
186
136
|
|
|
187
137
|
if (crossPoints.length > 0 && crossPoints.length % 2 != 0) {
|
|
188
138
|
result.push(target);
|
|
@@ -204,16 +154,20 @@ var PolygonCalculator = function () {
|
|
|
204
154
|
|
|
205
155
|
PolygonCalculator.convertPositionToPoints = function (pos1, pos2) {
|
|
206
156
|
return new LinePoints(pos1.lng, pos1.lat, pos2.lng, pos2.lat);
|
|
207
|
-
};
|
|
157
|
+
}; //두 직선의 교점 구하기
|
|
158
|
+
|
|
208
159
|
|
|
209
160
|
PolygonCalculator.getCrossPoint = function (sr, tr) {
|
|
210
|
-
var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2);
|
|
161
|
+
var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2); //분모로 사용됨
|
|
162
|
+
// p1 ==0 이면 평행선 또는 일치 이므로 제외(분모)
|
|
211
163
|
|
|
212
164
|
if (p1 != 0) {
|
|
213
165
|
var x = ((sr.x1 * sr.y2 - sr.y1 * sr.x2) * (tr.x1 - tr.x2) - (sr.x1 - sr.x2) * (tr.x1 * tr.y2 - tr.y1 * tr.x2)) / p1;
|
|
214
166
|
var y = ((sr.x1 * sr.y2 - sr.y1 * sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 * tr.y2 - tr.y1 * tr.x2)) / p1;
|
|
215
167
|
|
|
216
|
-
if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0
|
|
168
|
+
if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0 //교점이 1선분 위에 있고
|
|
169
|
+
&& this.toFixedPosition((x - tr.x1) * (x - tr.x2)) <= 0 && this.toFixedPosition((y - tr.y1) * (y - tr.y2)) <= 0 //교점이 2선분 위에 있을경우
|
|
170
|
+
) {
|
|
217
171
|
return {
|
|
218
172
|
x: x,
|
|
219
173
|
y: y
|
|
@@ -243,7 +197,7 @@ var PolygonCalculator = function () {
|
|
|
243
197
|
|
|
244
198
|
PolygonCalculator.findCrossPoint = function (sr, tr) {
|
|
245
199
|
for (var _i = 0, sr_2 = sr; _i < sr_2.length; _i++) {
|
|
246
|
-
var tmp = sr_2[_i];
|
|
200
|
+
var tmp = sr_2[_i]; //교점이 있으면 true
|
|
247
201
|
|
|
248
202
|
if (this.getCrossPoint(tmp, tr)) {
|
|
249
203
|
return true;
|
|
@@ -253,10 +207,96 @@ var PolygonCalculator = function () {
|
|
|
253
207
|
return false;
|
|
254
208
|
};
|
|
255
209
|
|
|
210
|
+
PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
|
|
211
|
+
var target = lastRepeated ? polygon.slice(0, polygon.length - 1) : polygon;
|
|
212
|
+
return this.simplify(target.map(function (position) {
|
|
213
|
+
return [position.lng, position.lat];
|
|
214
|
+
}), tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE).map(function (point) {
|
|
215
|
+
return new PositionMirror(point[1], point[0]);
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
PolygonCalculator.simplify = function (points, tolerance) {
|
|
220
|
+
if (points.length <= 2) {
|
|
221
|
+
return points;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
var dMax = 0;
|
|
225
|
+
var index = 0; // Find the point with the maximum distance from the line segment
|
|
226
|
+
|
|
227
|
+
for (var i = 1; i < points.length - 1; i++) {
|
|
228
|
+
var d = this.perpendicularDistance(points[i], points[0], points[points.length - 1]);
|
|
229
|
+
|
|
230
|
+
if (d > dMax) {
|
|
231
|
+
dMax = d;
|
|
232
|
+
index = i;
|
|
233
|
+
}
|
|
234
|
+
} // If the maximum distance is greater than the tolerance, recursively simplify
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
if (dMax > tolerance) {
|
|
238
|
+
var left = this.simplify(points.slice(0, index + 1), tolerance);
|
|
239
|
+
var right = this.simplify(points.slice(index), tolerance); // Concatenate the simplified left and right segments
|
|
240
|
+
|
|
241
|
+
return left.slice(0, left.length - 1).concat(right);
|
|
242
|
+
} else {
|
|
243
|
+
// If the maximum distance is less than or equal to the tolerance, return the endpoints
|
|
244
|
+
return [points[0], points[points.length - 1]];
|
|
245
|
+
}
|
|
246
|
+
}; // Calculate the perpendicular distance from a point to a line segment
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd) {
|
|
250
|
+
var x = point[0];
|
|
251
|
+
var y = point[1];
|
|
252
|
+
var x1 = lineStart[0];
|
|
253
|
+
var y1 = lineStart[1];
|
|
254
|
+
var x2 = lineEnd[0];
|
|
255
|
+
var y2 = lineEnd[1];
|
|
256
|
+
var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
|
|
257
|
+
var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
|
|
258
|
+
return numerator / denominator;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
PolygonCalculator.calculatePolygonSize = function (polygon, innerPolygons) {
|
|
262
|
+
var _this = this;
|
|
263
|
+
|
|
264
|
+
var outer = this.calculatePolygonSizeMain(polygon);
|
|
265
|
+
var inner = 0;
|
|
266
|
+
innerPolygons && innerPolygons.map(function (innerPolygon) {
|
|
267
|
+
inner += _this.calculatePolygonSizeMain(innerPolygon);
|
|
268
|
+
});
|
|
269
|
+
return outer - inner;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
PolygonCalculator.calculatePolygonSizeMain = function (polygon) {
|
|
273
|
+
var vertices = polygon.map(function (pos) {
|
|
274
|
+
return {
|
|
275
|
+
x: GeoCalulator.convertLongitudeToMeterValue(pos.lat, pos.lng),
|
|
276
|
+
y: GeoCalulator.convertLatitudeToMeterValue(pos.lat)
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
var n = vertices.length;
|
|
280
|
+
var sum = 0;
|
|
281
|
+
|
|
282
|
+
for (var i = 0; i < n; i++) {
|
|
283
|
+
var currentVertex = vertices[i];
|
|
284
|
+
var nextVertex = vertices[(i + 1) % n];
|
|
285
|
+
sum += currentVertex.x * nextVertex.y - currentVertex.y * nextVertex.x;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
var area = Math.abs(sum) / 2;
|
|
289
|
+
return area;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
PolygonCalculator.TOLERANCE_NAVER_STYLE = 0.0001;
|
|
293
|
+
PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 0.00001;
|
|
256
294
|
return PolygonCalculator;
|
|
257
295
|
}();
|
|
258
296
|
|
|
259
|
-
var GeoCalulator =
|
|
297
|
+
var GeoCalulator =
|
|
298
|
+
/** @class */
|
|
299
|
+
function () {
|
|
260
300
|
function GeoCalulator() {}
|
|
261
301
|
|
|
262
302
|
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
@@ -264,7 +304,8 @@ var GeoCalulator = function () {
|
|
|
264
304
|
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
265
305
|
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(pos1.lat)) * Math.cos(this.deg2rad(pos2.lat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
266
306
|
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
267
|
-
var d = this.
|
|
307
|
+
var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
|
|
308
|
+
|
|
268
309
|
return d;
|
|
269
310
|
};
|
|
270
311
|
|
|
@@ -276,127 +317,470 @@ var GeoCalulator = function () {
|
|
|
276
317
|
return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
|
|
277
318
|
};
|
|
278
319
|
|
|
320
|
+
GeoCalulator.convertLatitudeToMeterValue = function (lat) {
|
|
321
|
+
return lat * this.METER_VALUE_PER_LATITUDE;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
|
|
325
|
+
return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
329
|
+
return lat.toFixed(2);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
|
|
333
|
+
return this.CACHE_OF_LNG_PER_METER.get(latUnit);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
|
|
337
|
+
if (this.CACHE_OF_LNG_PER_METER.size > 10) {
|
|
338
|
+
this.CACHE_OF_LNG_PER_METER.clear();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
345
|
+
// const t = Date.now()
|
|
346
|
+
// Cache check
|
|
347
|
+
var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
|
|
348
|
+
var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
|
|
349
|
+
|
|
350
|
+
if (fromCache !== undefined) {
|
|
351
|
+
// console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
|
|
352
|
+
return fromCache;
|
|
353
|
+
} // Convert latitude and longitude to radians
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
|
|
357
|
+
|
|
358
|
+
var radius = this.EARTH_EQUATORIAL_RADIUS * Math.sqrt(1 - Math.pow(this.EARTH_ECCENTRICITY * Math.sin(latRad), 2)); // Calculate the length of one degree of longitude in meters
|
|
359
|
+
|
|
360
|
+
var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
|
|
361
|
+
|
|
362
|
+
this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
|
|
363
|
+
|
|
364
|
+
return distance;
|
|
365
|
+
};
|
|
366
|
+
|
|
279
367
|
GeoCalulator.computeNextPositionAndDistances = function (context) {
|
|
280
368
|
var pos1 = context.pos1,
|
|
281
369
|
pos2 = context.pos2,
|
|
282
370
|
prevPos2 = context.prevPos2,
|
|
283
371
|
velocityKmh = context.velocityKmh,
|
|
284
372
|
prevVelocityKmh = context.prevVelocityKmh,
|
|
285
|
-
elapsedTimeMs = context.elapsedTimeMs;
|
|
373
|
+
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
374
|
+
//총 가야할 거리 (km)
|
|
286
375
|
|
|
287
376
|
if (pos2 !== prevPos2) {
|
|
377
|
+
//목표가 바뀌면 거리 및 비율 재계산
|
|
288
378
|
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
289
379
|
context.currDistance = 0;
|
|
290
380
|
context.prevPos2 = pos2;
|
|
291
381
|
}
|
|
292
382
|
|
|
293
|
-
var totalDistance = context.totalDistance;
|
|
383
|
+
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
384
|
+
//ms 속으로 환산
|
|
294
385
|
|
|
295
386
|
if (velocityKmh !== prevVelocityKmh) {
|
|
387
|
+
//속도가 바뀌면 재계산
|
|
296
388
|
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
297
389
|
context.prevVelocityKmh = velocityKmh;
|
|
298
390
|
}
|
|
299
391
|
|
|
300
|
-
var vPerMs = context.vPerMs;
|
|
301
|
-
|
|
392
|
+
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
393
|
+
//실제 가는 거리 계산
|
|
394
|
+
|
|
395
|
+
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
396
|
+
//목표점까지 이동 후에도 남는 거리
|
|
397
|
+
|
|
302
398
|
context.currDistance = nextDistance;
|
|
303
399
|
|
|
304
400
|
if (totalDistance < context.currDistance) {
|
|
401
|
+
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
305
402
|
context.distanceRemain = context.currDistance - totalDistance;
|
|
306
403
|
context.nextPos = pos2;
|
|
307
404
|
return context;
|
|
308
405
|
} else {
|
|
309
406
|
context.distanceRemain = 0;
|
|
310
|
-
}
|
|
407
|
+
} //각 축으로 나가야할 비율
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
411
|
+
//방향값 체크
|
|
311
412
|
|
|
312
|
-
var ratio = nextDistance / totalDistance;
|
|
313
413
|
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
314
|
-
var lngCalib = pos2.lng > pos1.lng ? 1 : -1;
|
|
315
|
-
|
|
414
|
+
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
415
|
+
|
|
416
|
+
var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
316
417
|
|
|
317
418
|
if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
|
|
318
419
|
newPos = pos2;
|
|
319
|
-
}
|
|
420
|
+
} // console.log('newPos', newPos);
|
|
421
|
+
//console.log('==============================================================\n');
|
|
422
|
+
|
|
320
423
|
|
|
321
424
|
context.nextPos = newPos;
|
|
322
425
|
return context;
|
|
323
426
|
};
|
|
324
427
|
|
|
325
|
-
GeoCalulator.
|
|
326
|
-
|
|
428
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
|
|
429
|
+
|
|
430
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
|
|
431
|
+
GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
|
|
432
|
+
GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
|
|
433
|
+
|
|
434
|
+
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
|
|
435
|
+
GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
|
|
327
436
|
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
328
437
|
return GeoCalulator;
|
|
329
438
|
}();
|
|
330
439
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
440
|
+
/**
|
|
441
|
+
* 좌표값
|
|
442
|
+
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
var Position =
|
|
446
|
+
/** @class */
|
|
447
|
+
function () {
|
|
448
|
+
function Position(lat, lng) {
|
|
449
|
+
/**
|
|
450
|
+
* 위도
|
|
451
|
+
* @description 위도(latitude)
|
|
452
|
+
*/
|
|
453
|
+
this.lat = 0;
|
|
454
|
+
/**
|
|
455
|
+
* 경도
|
|
456
|
+
* @description 경도(longitude)
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
this.lng = 0;
|
|
460
|
+
this.lat = lat;
|
|
461
|
+
this.lng = lng;
|
|
337
462
|
}
|
|
338
463
|
|
|
339
|
-
|
|
340
|
-
return
|
|
464
|
+
Position.equals = function (pos1, pos2) {
|
|
465
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
341
466
|
};
|
|
342
467
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
};
|
|
468
|
+
return Position;
|
|
469
|
+
}();
|
|
346
470
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
var lng = Math.abs(maxLng - minLng);
|
|
355
|
-
var x = w * (position.lng - minLng) / lng;
|
|
356
|
-
var maxLat = bounds.ne.lat;
|
|
357
|
-
var minLat = bounds.sw.lat;
|
|
358
|
-
var lat = Math.abs(maxLat - minLat);
|
|
359
|
-
var y = h * (maxLat - position.lat) / lat;
|
|
360
|
-
return new Offset(x, y);
|
|
361
|
-
};
|
|
471
|
+
var Bounds =
|
|
472
|
+
/** @class */
|
|
473
|
+
function () {
|
|
474
|
+
function Bounds(nw, se, ne, sw) {
|
|
475
|
+
if (!(nw && se || ne && sw)) {
|
|
476
|
+
throw new Error('nw/se or ne/sw needed');
|
|
477
|
+
} //@ts-ignore
|
|
362
478
|
|
|
363
|
-
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
364
|
-
var div = this.mapDivElement;
|
|
365
|
-
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
366
|
-
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
367
|
-
var bounds = this.getCurrBounds();
|
|
368
|
-
var maxLng = bounds.ne.lng;
|
|
369
|
-
var minLng = bounds.sw.lng;
|
|
370
|
-
var lng = Math.abs(maxLng - minLng);
|
|
371
|
-
var lngVal = offset.x * lng / w + minLng;
|
|
372
|
-
var maxLat = bounds.ne.lat;
|
|
373
|
-
var minLat = bounds.sw.lat;
|
|
374
|
-
var lat = Math.abs(maxLat - minLat);
|
|
375
|
-
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
376
|
-
return new Position(latVal, lngVal);
|
|
377
|
-
};
|
|
378
479
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (checkLoaded()) {
|
|
384
|
-
resolve(false);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
480
|
+
this.nw = nw;
|
|
481
|
+
this.se = se;
|
|
482
|
+
this.ne = ne;
|
|
483
|
+
this.sw = sw;
|
|
387
484
|
|
|
388
|
-
|
|
485
|
+
if (nw && se) {
|
|
486
|
+
this.covertNWSEtoNESW(nw, se);
|
|
487
|
+
} else if (ne && sw) {
|
|
488
|
+
this.covertNESWtoNWSE(ne, sw);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
389
491
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
});
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
492
|
+
Bounds.fromNWSE = function (nw, se) {
|
|
493
|
+
return new Bounds(nw, se, undefined, undefined);
|
|
494
|
+
};
|
|
396
495
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
496
|
+
Bounds.fromNESW = function (ne, sw) {
|
|
497
|
+
return new Bounds(undefined, undefined, ne, sw);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
|
|
501
|
+
this.ne = new Position(nw.lat, se.lng);
|
|
502
|
+
this.sw = new Position(se.lat, nw.lng);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
|
|
506
|
+
this.nw = new Position(ne.lat, sw.lng);
|
|
507
|
+
this.se = new Position(sw.lat, ne.lng);
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
Bounds.prototype.getCenter = function () {
|
|
511
|
+
return new Position(this.se.lat + (this.nw.lat - this.se.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
Bounds.prototype.includesPosition = function (pos) {
|
|
515
|
+
return this.nw.lng < pos.lng && this.se.lng > pos.lng && this.se.lat < pos.lat && this.nw.lat > pos.lat;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
Bounds.prototype.getIncludedPositions = function (positions) {
|
|
519
|
+
var result = [];
|
|
520
|
+
|
|
521
|
+
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
522
|
+
var pos = positions_1[_i];
|
|
523
|
+
|
|
524
|
+
if (this.includesPosition(pos)) {
|
|
525
|
+
result.push(pos);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return result;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
Bounds.prototype.includes = function (positions) {
|
|
533
|
+
positions = Array.isArray(positions) ? positions : [positions];
|
|
534
|
+
|
|
535
|
+
for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
|
|
536
|
+
var pos = positions_2[_i];
|
|
537
|
+
|
|
538
|
+
if (!this.includesPosition(pos)) {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return true;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
Bounds.prototype.includesOnlyOnePoint = function (positions) {
|
|
547
|
+
for (var _i = 0, positions_3 = positions; _i < positions_3.length; _i++) {
|
|
548
|
+
var pos = positions_3[_i];
|
|
549
|
+
|
|
550
|
+
if (this.includesPosition(pos)) {
|
|
551
|
+
return true;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return false;
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
Bounds.prototype.intersects = function (positions) {
|
|
559
|
+
return PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
return Bounds;
|
|
563
|
+
}();
|
|
564
|
+
/**
|
|
565
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
566
|
+
*/
|
|
567
|
+
|
|
568
|
+
var Offset =
|
|
569
|
+
/** @class */
|
|
570
|
+
function () {
|
|
571
|
+
/**
|
|
572
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
573
|
+
*/
|
|
574
|
+
function Offset(x, y) {
|
|
575
|
+
this.x = x;
|
|
576
|
+
this.y = y;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
Offset.prototype.equals = function (other) {
|
|
580
|
+
return other && this.x === other.x && this.y === other.y;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
return Offset;
|
|
584
|
+
}();
|
|
585
|
+
|
|
586
|
+
var MintMapControllerContext = createContext(null);
|
|
587
|
+
function MintMapProvider(_a) {
|
|
588
|
+
var controller = _a.controller,
|
|
589
|
+
children = _a.children;
|
|
590
|
+
return React.createElement(MintMapControllerContext.Provider, {
|
|
591
|
+
value: controller
|
|
592
|
+
}, children);
|
|
593
|
+
}
|
|
594
|
+
function useMintMapController() {
|
|
595
|
+
var controller = useContext(MintMapControllerContext);
|
|
596
|
+
|
|
597
|
+
if (controller === null) {
|
|
598
|
+
throw new Error('controller is not initialized');
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return controller;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
var css_248z$1 = ".MintMapCore-module_mint-map-root__SMfwn {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\n.MintMapCore-module_mint-map-container__8MIIr {\n height: 100%;\n}";
|
|
605
|
+
var styles$1 = {"mint-map-root":"MintMapCore-module_mint-map-root__SMfwn","mint-map-container":"MintMapCore-module_mint-map-container__8MIIr"};
|
|
606
|
+
styleInject(css_248z$1);
|
|
607
|
+
|
|
608
|
+
var cn$3 = classNames.bind(styles$1);
|
|
609
|
+
function MintMapCore(_a) {
|
|
610
|
+
var _this = this;
|
|
611
|
+
|
|
612
|
+
var onLoad = _a.onLoad,
|
|
613
|
+
_b = _a.visible,
|
|
614
|
+
visible = _b === void 0 ? true : _b,
|
|
615
|
+
zoomLevel = _a.zoomLevel,
|
|
616
|
+
center = _a.center,
|
|
617
|
+
_c = _a.centerMoveWithPanning,
|
|
618
|
+
centerMoveWithPanning = _c === void 0 ? false : _c,
|
|
619
|
+
children = _a.children; //controller
|
|
620
|
+
|
|
621
|
+
var controller = useMintMapController(); //맵 초기화
|
|
622
|
+
|
|
623
|
+
var elementRef = useRef(null);
|
|
624
|
+
|
|
625
|
+
var _d = useState(false),
|
|
626
|
+
mapInitialized = _d[0],
|
|
627
|
+
setMapInitialized = _d[1];
|
|
628
|
+
|
|
629
|
+
useEffect(function () {
|
|
630
|
+
(function () {
|
|
631
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
632
|
+
var map_1;
|
|
633
|
+
return __generator(this, function (_a) {
|
|
634
|
+
switch (_a.label) {
|
|
635
|
+
case 0:
|
|
636
|
+
if (!(elementRef && elementRef.current)) return [3
|
|
637
|
+
/*break*/
|
|
638
|
+
, 2];
|
|
639
|
+
return [4
|
|
640
|
+
/*yield*/
|
|
641
|
+
, controller.initializingMap(elementRef.current) //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
642
|
+
];
|
|
643
|
+
|
|
644
|
+
case 1:
|
|
645
|
+
map_1 = _a.sent(); //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
646
|
+
|
|
647
|
+
setTimeout(function () {
|
|
648
|
+
setMapInitialized(true);
|
|
649
|
+
onLoad && onLoad(map_1, controller);
|
|
650
|
+
}, 100);
|
|
651
|
+
_a.label = 2;
|
|
652
|
+
|
|
653
|
+
case 2:
|
|
654
|
+
return [2
|
|
655
|
+
/*return*/
|
|
656
|
+
];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
})();
|
|
661
|
+
|
|
662
|
+
return function () {
|
|
663
|
+
controller && controller.destroyMap();
|
|
664
|
+
};
|
|
665
|
+
}, [controller, elementRef]); //줌레벨
|
|
666
|
+
|
|
667
|
+
useEffect(function () {
|
|
668
|
+
if (zoomLevel && controller && mapInitialized) {
|
|
669
|
+
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
670
|
+
|
|
671
|
+
if (prevZoomLevel !== zoomLevel) {
|
|
672
|
+
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}, [zoomLevel]); //센터
|
|
676
|
+
|
|
677
|
+
useEffect(function () {
|
|
678
|
+
if (center && controller && mapInitialized) {
|
|
679
|
+
var prevCenter = controller.getCenter();
|
|
680
|
+
|
|
681
|
+
if (!Position.equals(prevCenter, center)) {
|
|
682
|
+
centerMoveWithPanning ? controller === null || controller === void 0 ? void 0 : controller.panningTo(center) : controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}, [center]);
|
|
686
|
+
return React.createElement("div", {
|
|
687
|
+
className: cn$3('mint-map-root')
|
|
688
|
+
}, mapInitialized && children, React.createElement("div", {
|
|
689
|
+
className: cn$3('mint-map-container'),
|
|
690
|
+
style: {
|
|
691
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
692
|
+
},
|
|
693
|
+
ref: elementRef
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
var MintMapController =
|
|
698
|
+
/** @class */
|
|
699
|
+
function () {
|
|
700
|
+
//constructor
|
|
701
|
+
function MintMapController(props) {
|
|
702
|
+
this.mapApiLoaded = false;
|
|
703
|
+
this.mapInitialized = false;
|
|
704
|
+
this.processedTime = 0; //props
|
|
705
|
+
|
|
706
|
+
this.mapProps = props;
|
|
707
|
+
} //기본 기능
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
MintMapController.prototype.getMap = function () {
|
|
711
|
+
return this.map;
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
MintMapController.prototype.getMapType = function () {
|
|
715
|
+
return this.type;
|
|
716
|
+
}; //기본 기능 - 좌표 변환
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
MintMapController.prototype.positionToOffset = function (position) {
|
|
720
|
+
var div = this.mapDivElement;
|
|
721
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
722
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
723
|
+
var bounds = this.getCurrBounds();
|
|
724
|
+
var maxLng = bounds.ne.lng;
|
|
725
|
+
var minLng = bounds.sw.lng;
|
|
726
|
+
var lng = Math.abs(maxLng - minLng);
|
|
727
|
+
var x = w * (position.lng - minLng) / lng;
|
|
728
|
+
var maxLat = bounds.ne.lat;
|
|
729
|
+
var minLat = bounds.sw.lat;
|
|
730
|
+
var lat = Math.abs(maxLat - minLat);
|
|
731
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
732
|
+
return new Offset(x, y);
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
736
|
+
var div = this.mapDivElement;
|
|
737
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
738
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
739
|
+
var bounds = this.getCurrBounds();
|
|
740
|
+
var maxLng = bounds.ne.lng;
|
|
741
|
+
var minLng = bounds.sw.lng;
|
|
742
|
+
var lng = Math.abs(maxLng - minLng); //const x = w * (position.lng - minLng) / lng
|
|
743
|
+
|
|
744
|
+
var lngVal = offset.x * lng / w + minLng;
|
|
745
|
+
var maxLat = bounds.ne.lat;
|
|
746
|
+
var minLat = bounds.sw.lat;
|
|
747
|
+
var lat = Math.abs(maxLat - minLat); //const y = h * (maxLat - position.lat) / lat
|
|
748
|
+
|
|
749
|
+
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
750
|
+
return new Position(latVal, lngVal);
|
|
751
|
+
}; //스크립트 로드
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
MintMapController.prototype.loadScript = function (url, id, checkLoaded) {
|
|
755
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
756
|
+
return __generator(this, function (_a) {
|
|
757
|
+
//boolean -> script 로드 후 callback 실행 여부
|
|
758
|
+
//** callback 실행이 여기서 안된 경우는 바깥에서 해줘야한다.
|
|
759
|
+
return [2
|
|
760
|
+
/*return*/
|
|
761
|
+
, new Promise(function (resolve) {
|
|
762
|
+
//이미 로드되어 있으면 종료
|
|
763
|
+
if (checkLoaded()) {
|
|
764
|
+
resolve(false);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
var prevElement = id ? document.getElementById(id) : undefined; //기존 스크립트 로드 정보가 있으면
|
|
769
|
+
|
|
770
|
+
if (prevElement) {
|
|
771
|
+
// console.log(`already loaded script => ${id}`)
|
|
772
|
+
//로드 되어 있지 않으면 스크립트 load 이벤트 끼워넣기
|
|
773
|
+
prevElement.addEventListener('load', function () {
|
|
774
|
+
// console.log('script loaded!!!')
|
|
775
|
+
resolve(false);
|
|
776
|
+
});
|
|
777
|
+
return;
|
|
778
|
+
} //스크립트 로드 처리
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
var script = document.createElement('script');
|
|
782
|
+
script.src = url;
|
|
783
|
+
script.async = true;
|
|
400
784
|
script.defer = true;
|
|
401
785
|
id && (script.id = id);
|
|
402
786
|
script.addEventListener('load', function () {
|
|
@@ -411,6 +795,14 @@ var MintMapController = function () {
|
|
|
411
795
|
MintMapController.prototype.getRandomFunctionName = function (prefix) {
|
|
412
796
|
return "".concat(prefix, "_").concat(v4().replace(/-/g, '_'));
|
|
413
797
|
};
|
|
798
|
+
/**
|
|
799
|
+
* URL 빌더 메서드
|
|
800
|
+
*
|
|
801
|
+
* @param {string} baseUrl: 기본 URL
|
|
802
|
+
* @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
|
|
803
|
+
* @returns {string} URL
|
|
804
|
+
*/
|
|
805
|
+
|
|
414
806
|
|
|
415
807
|
MintMapController.prototype.buildUrl = function (baseUrl, param) {
|
|
416
808
|
var params = Object.entries(param).map(function (_a) {
|
|
@@ -421,9 +813,15 @@ var MintMapController = function () {
|
|
|
421
813
|
}).join('&');
|
|
422
814
|
return "".concat(baseUrl, "?").concat(params);
|
|
423
815
|
};
|
|
816
|
+
/**
|
|
817
|
+
* 쓰로틀링 처리
|
|
818
|
+
* @returns
|
|
819
|
+
*/
|
|
820
|
+
|
|
424
821
|
|
|
425
822
|
MintMapController.prototype.checkBoundsChangeThrottleTime = function () {
|
|
426
|
-
if (!this.mapProps.boundsChangeThrottlingTime) return true;
|
|
823
|
+
if (!this.mapProps.boundsChangeThrottlingTime) return true; //boundsChangeThrottlingTime 이내의 연속 요청은 제외시킴
|
|
824
|
+
|
|
427
825
|
var time = new Date().getTime();
|
|
428
826
|
|
|
429
827
|
if (this.processedTime > 0 && time - this.processedTime < this.mapProps.boundsChangeThrottlingTime) {
|
|
@@ -461,7 +859,9 @@ var MintMapController = function () {
|
|
|
461
859
|
return MintMapController;
|
|
462
860
|
}();
|
|
463
861
|
|
|
464
|
-
var MapZoomInfo =
|
|
862
|
+
var MapZoomInfo =
|
|
863
|
+
/** @class */
|
|
864
|
+
function () {
|
|
465
865
|
function MapZoomInfo() {}
|
|
466
866
|
|
|
467
867
|
MapZoomInfo.BASE_TO_MAP = new Map([[1, new Map([['google', {
|
|
@@ -658,16 +1058,20 @@ function waiting(evaluation, timeoutSeconds) {
|
|
|
658
1058
|
var max;
|
|
659
1059
|
return __generator(this, function (_a) {
|
|
660
1060
|
max = (timeoutSeconds || 5) * 1000;
|
|
661
|
-
return [2
|
|
1061
|
+
return [2
|
|
1062
|
+
/*return*/
|
|
1063
|
+
, new Promise(function (resolve) {
|
|
662
1064
|
var start = new Date().getTime();
|
|
663
1065
|
var inter = setInterval(function () {
|
|
1066
|
+
//타임아웃 체크
|
|
664
1067
|
var time = new Date().getTime();
|
|
665
1068
|
|
|
666
1069
|
if (time - start > max) {
|
|
667
1070
|
clearInterval(inter);
|
|
668
1071
|
resolve(false);
|
|
669
1072
|
return;
|
|
670
|
-
}
|
|
1073
|
+
} //평가식 체크
|
|
1074
|
+
|
|
671
1075
|
|
|
672
1076
|
if (evaluation()) {
|
|
673
1077
|
clearInterval(inter);
|
|
@@ -679,36 +1083,104 @@ function waiting(evaluation, timeoutSeconds) {
|
|
|
679
1083
|
});
|
|
680
1084
|
}
|
|
681
1085
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
1086
|
+
// export type MapEvent = 'bounds_changed'|'center_changed'|'idle'|'zoom_changed'|'zoomstart'
|
|
1087
|
+
// export type MapUIEvent = 'click'|'dblclick'|''
|
|
1088
|
+
var MapEvent =
|
|
1089
|
+
/** @class */
|
|
1090
|
+
function () {
|
|
1091
|
+
function MapEvent() {
|
|
1092
|
+
this.BOUNDS_CHANGED = 'bounds_changed';
|
|
1093
|
+
this.CENTER_CHANGED = 'center_changed';
|
|
1094
|
+
this.IDLE = 'idle';
|
|
1095
|
+
this.ZOOM_CHANGED = 'zoom_changed';
|
|
1096
|
+
this.ZOOMSTART = 'zoomstart';
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
MapEvent.prototype.get = function (eventName) {
|
|
1100
|
+
var value = this[eventName];
|
|
1101
|
+
|
|
1102
|
+
if (typeof value === 'string') {
|
|
1103
|
+
return value;
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
return MapEvent;
|
|
1108
|
+
}();
|
|
1109
|
+
|
|
1110
|
+
var MapUIEvent =
|
|
1111
|
+
/** @class */
|
|
1112
|
+
function () {
|
|
1113
|
+
function MapUIEvent() {
|
|
1114
|
+
this.CLICK = 'click';
|
|
1115
|
+
this.DBLCLICK = 'dblclick';
|
|
1116
|
+
this.MOUSEDOWN = 'mousedown';
|
|
1117
|
+
this.MOUSEUP = 'mouseup';
|
|
1118
|
+
this.MOUSEOUT = 'mouseout';
|
|
1119
|
+
this.MOUSEMOVE = 'mousemove';
|
|
1120
|
+
this.MOUSEOVER = 'mouseover';
|
|
1121
|
+
this.DRAG = 'drag';
|
|
1122
|
+
this.DRAGSTART = 'dragstart';
|
|
1123
|
+
this.DRAGEND = 'dragend';
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
MapUIEvent.prototype.get = function (eventName) {
|
|
1127
|
+
var value = this[eventName];
|
|
1128
|
+
|
|
1129
|
+
if (typeof value === 'string') {
|
|
1130
|
+
return value;
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
return MapUIEvent;
|
|
1135
|
+
}();
|
|
1136
|
+
|
|
1137
|
+
var NaverMintMapController =
|
|
1138
|
+
/** @class */
|
|
1139
|
+
function (_super) {
|
|
1140
|
+
__extends(NaverMintMapController, _super);
|
|
1141
|
+
|
|
1142
|
+
function NaverMintMapController(props) {
|
|
1143
|
+
var _this = _super.call(this, props) || this;
|
|
1144
|
+
|
|
1145
|
+
_this.type = 'naver';
|
|
1146
|
+
_this.map = null;
|
|
1147
|
+
_this.scriptUrl = 'https://openapi.map.naver.com/openapi/v3/maps.js';
|
|
1148
|
+
_this.scriptModules = ['drawing']; // , 'geocoder' , 'panorama' , 'visualization']
|
|
1149
|
+
|
|
1150
|
+
_this.mapEvent = new MapEvent();
|
|
1151
|
+
_this.mapUIEvent = new MapUIEvent();
|
|
1152
|
+
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
1153
|
+
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
1154
|
+
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
1155
|
+
_this.dragStartPoint = [0, 0];
|
|
1156
|
+
_this.dragged = false;
|
|
1157
|
+
_this.eventMap = new Map();
|
|
1158
|
+
Object.freeze(_this.mapEvent);
|
|
1159
|
+
Object.freeze(_this.mapUIEvent);
|
|
1160
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
698
1161
|
}
|
|
699
1162
|
|
|
700
1163
|
NaverMintMapController.prototype.initMarkerPool = function () {
|
|
701
1164
|
var _this = this;
|
|
702
1165
|
|
|
703
|
-
if (!this.mapProps.markerCache) return;
|
|
704
|
-
|
|
1166
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
1167
|
+
|
|
1168
|
+
this.markerPool = new ObjectPool() //logging on
|
|
1169
|
+
//.setLog(true)
|
|
1170
|
+
//factory 셋팅
|
|
1171
|
+
.setFactory(function () {
|
|
1172
|
+
//console.log('pool item created');
|
|
705
1173
|
return new naver.maps.Marker({
|
|
706
1174
|
position: new Position(0, 0),
|
|
707
1175
|
map: _this.map || undefined
|
|
708
1176
|
});
|
|
709
|
-
})
|
|
1177
|
+
}) //clear function 셋팅
|
|
1178
|
+
.setClear(function (item) {
|
|
1179
|
+
//console.log('pool item cleared');
|
|
710
1180
|
item.setMap(null);
|
|
711
|
-
})
|
|
1181
|
+
}) //초기 pool 사이즈
|
|
1182
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
1183
|
+
.setCheckLiveTimeInterval(1000);
|
|
712
1184
|
};
|
|
713
1185
|
|
|
714
1186
|
NaverMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -726,7 +1198,7 @@ var NaverMintMapController = function (_super) {
|
|
|
726
1198
|
visible = _e === void 0 ? true : _e,
|
|
727
1199
|
_f = _a.editable,
|
|
728
1200
|
editable = _f === void 0 ? false : _f,
|
|
729
|
-
event = _a.event;
|
|
1201
|
+
event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
730
1202
|
|
|
731
1203
|
if (this.map && Array.isArray(position)) {
|
|
732
1204
|
var path = position.map(function (elem) {
|
|
@@ -740,8 +1212,13 @@ var NaverMintMapController = function (_super) {
|
|
|
740
1212
|
strokeOpacity: lineOpacity,
|
|
741
1213
|
clickable: true,
|
|
742
1214
|
visible: visible
|
|
743
|
-
});
|
|
744
|
-
|
|
1215
|
+
}); //@ts-ignore
|
|
1216
|
+
|
|
1217
|
+
editable && pol_1.setEditable(editable); // if(editable){
|
|
1218
|
+
// //@ts-ignore
|
|
1219
|
+
// this.drawingManager.addDrawing(pol, naver.maps.drawing.DrawingMode.POLYLINE)
|
|
1220
|
+
// }
|
|
1221
|
+
|
|
745
1222
|
polyline.native = pol_1;
|
|
746
1223
|
event && event.forEach(function (handler, key) {
|
|
747
1224
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -752,7 +1229,9 @@ var NaverMintMapController = function (_super) {
|
|
|
752
1229
|
};
|
|
753
1230
|
|
|
754
1231
|
NaverMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
1232
|
+
//console.log('controller updatePolyline', options);
|
|
755
1233
|
if (polyline && polyline.native && polyline.native instanceof naver.maps.Polyline) {
|
|
1234
|
+
//console.log('controller updatePolyline start');
|
|
756
1235
|
var path = void 0;
|
|
757
1236
|
|
|
758
1237
|
if (Array.isArray(options.position)) {
|
|
@@ -767,7 +1246,8 @@ var NaverMintMapController = function (_super) {
|
|
|
767
1246
|
strokeColor: options.lineColor,
|
|
768
1247
|
strokeWeight: options.lineSize,
|
|
769
1248
|
strokeOpacity: options.lineOpacity
|
|
770
|
-
});
|
|
1249
|
+
}); //@ts-ignore
|
|
1250
|
+
|
|
771
1251
|
options.editable !== undefined && polyline.native.setEditable(options.editable);
|
|
772
1252
|
}
|
|
773
1253
|
};
|
|
@@ -791,7 +1271,7 @@ var NaverMintMapController = function (_super) {
|
|
|
791
1271
|
_g = _a.visible,
|
|
792
1272
|
visible = _g === void 0 ? true : _g;
|
|
793
1273
|
_a.editable;
|
|
794
|
-
var event = _a.event;
|
|
1274
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
795
1275
|
|
|
796
1276
|
if (this.map && Array.isArray(position)) {
|
|
797
1277
|
var outLine = position.map(function (elem) {
|
|
@@ -809,7 +1289,9 @@ var NaverMintMapController = function (_super) {
|
|
|
809
1289
|
fillOpacity: fillOpacity,
|
|
810
1290
|
clickable: true,
|
|
811
1291
|
visible: visible
|
|
812
|
-
});
|
|
1292
|
+
}); //@ts-ignore
|
|
1293
|
+
//pol.setEditable(editable)
|
|
1294
|
+
|
|
813
1295
|
polygon.native = pol_2;
|
|
814
1296
|
event && event.forEach(function (handler, key) {
|
|
815
1297
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -820,7 +1302,9 @@ var NaverMintMapController = function (_super) {
|
|
|
820
1302
|
};
|
|
821
1303
|
|
|
822
1304
|
NaverMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
1305
|
+
//console.log('controller updatePolygon', options);
|
|
823
1306
|
if (polygon && polygon.native && polygon.native instanceof naver.maps.Polygon) {
|
|
1307
|
+
//console.log('controller updatePolygon start');
|
|
824
1308
|
var paths = void 0;
|
|
825
1309
|
|
|
826
1310
|
if (Array.isArray(options.position)) {
|
|
@@ -839,7 +1323,8 @@ var NaverMintMapController = function (_super) {
|
|
|
839
1323
|
strokeOpacity: options.lineOpacity,
|
|
840
1324
|
fillColor: options.fillColor,
|
|
841
1325
|
fillOpacity: options.fillOpacity
|
|
842
|
-
});
|
|
1326
|
+
}); //@ts-ignore
|
|
1327
|
+
|
|
843
1328
|
options.editable !== undefined && polygon.native.setEditable(options.editable);
|
|
844
1329
|
}
|
|
845
1330
|
};
|
|
@@ -854,7 +1339,8 @@ var NaverMintMapController = function (_super) {
|
|
|
854
1339
|
map: this.map,
|
|
855
1340
|
position: marker.options.position,
|
|
856
1341
|
visible: marker.options.visible === undefined || marker.options.visible
|
|
857
|
-
};
|
|
1342
|
+
}; //console.log('controller createMarker', marker.options);
|
|
1343
|
+
|
|
858
1344
|
marker.element && (options.icon = {
|
|
859
1345
|
content: marker.element,
|
|
860
1346
|
anchor: marker.options.anchor
|
|
@@ -881,10 +1367,18 @@ var NaverMintMapController = function (_super) {
|
|
|
881
1367
|
};
|
|
882
1368
|
|
|
883
1369
|
NaverMintMapController.prototype.updateMarker = function (marker, options) {
|
|
1370
|
+
//console.log('controller updateMarker', options);
|
|
884
1371
|
if (marker && marker.native && marker.native instanceof naver.maps.Marker) {
|
|
885
1372
|
var map = marker.native.getMap();
|
|
886
1373
|
|
|
887
1374
|
if (map) {
|
|
1375
|
+
/** 중요!!!!
|
|
1376
|
+
* naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
|
|
1377
|
+
* setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
|
|
1378
|
+
* (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
|
|
1379
|
+
* 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
|
|
1380
|
+
*/
|
|
1381
|
+
//Position
|
|
888
1382
|
if (options.position && options.position instanceof Position) {
|
|
889
1383
|
marker.native.setPosition(options.position);
|
|
890
1384
|
}
|
|
@@ -897,7 +1391,21 @@ var NaverMintMapController = function (_super) {
|
|
|
897
1391
|
marker.native.setIcon(__assign(__assign({}, marker.native.getIcon()), {
|
|
898
1392
|
anchor: options.anchor
|
|
899
1393
|
}));
|
|
900
|
-
}
|
|
1394
|
+
} // const newOption = {
|
|
1395
|
+
// map:map,
|
|
1396
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1397
|
+
// visible:options.visible === undefined || options.visible,
|
|
1398
|
+
// } as naver.maps.MarkerOptions
|
|
1399
|
+
// if(options.anchor){
|
|
1400
|
+
// newOption.icon = {...marker.native.getIcon(), anchor:options.anchor}
|
|
1401
|
+
// }
|
|
1402
|
+
// marker.native.setOptions({
|
|
1403
|
+
// map:map,
|
|
1404
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1405
|
+
// visible:options.visible === undefined || options.visible,
|
|
1406
|
+
// icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
1407
|
+
// })
|
|
1408
|
+
|
|
901
1409
|
}
|
|
902
1410
|
}
|
|
903
1411
|
};
|
|
@@ -977,7 +1485,7 @@ var NaverMintMapController = function (_super) {
|
|
|
977
1485
|
NaverMintMapController.prototype.checkLoaded = function () {
|
|
978
1486
|
var _a, _b;
|
|
979
1487
|
|
|
980
|
-
return (_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
1488
|
+
return ((_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
981
1489
|
};
|
|
982
1490
|
|
|
983
1491
|
NaverMintMapController.prototype.loadMapApi = function () {
|
|
@@ -985,17 +1493,21 @@ var NaverMintMapController = function (_super) {
|
|
|
985
1493
|
var _this = this;
|
|
986
1494
|
|
|
987
1495
|
return __generator(this, function (_a) {
|
|
988
|
-
return [2
|
|
1496
|
+
return [2
|
|
1497
|
+
/*return*/
|
|
1498
|
+
, new Promise(function (resolve, error) {
|
|
989
1499
|
return __awaiter(_this, void 0, void 0, function () {
|
|
990
1500
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
991
1501
|
return __generator(this, function (_a) {
|
|
992
1502
|
switch (_a.label) {
|
|
993
1503
|
case 0:
|
|
994
1504
|
callbackName = this.getRandomFunctionName('load_naver');
|
|
995
|
-
loaded = false;
|
|
1505
|
+
loaded = false; //@ts-ignore
|
|
996
1506
|
|
|
997
1507
|
window[callbackName] = function () {
|
|
998
|
-
|
|
1508
|
+
// console.log('naver api loaded');
|
|
1509
|
+
loaded = true; //@ts-ignore
|
|
1510
|
+
|
|
999
1511
|
delete window[callbackName];
|
|
1000
1512
|
};
|
|
1001
1513
|
|
|
@@ -1004,17 +1516,22 @@ var NaverMintMapController = function (_super) {
|
|
|
1004
1516
|
submodules: this.scriptModules.join(','),
|
|
1005
1517
|
callback: callbackName
|
|
1006
1518
|
};
|
|
1007
|
-
return [4
|
|
1519
|
+
return [4
|
|
1520
|
+
/*yield*/
|
|
1521
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
|
|
1008
1522
|
|
|
1009
1523
|
case 1:
|
|
1010
1524
|
callbackExecFlag = _a.sent();
|
|
1011
1525
|
|
|
1012
1526
|
if (!callbackExecFlag) {
|
|
1013
|
-
loaded = true;
|
|
1527
|
+
loaded = true; //@ts-ignore
|
|
1528
|
+
|
|
1014
1529
|
delete window[callbackName];
|
|
1015
1530
|
}
|
|
1016
1531
|
|
|
1017
|
-
return [4
|
|
1532
|
+
return [4
|
|
1533
|
+
/*yield*/
|
|
1534
|
+
, waiting(function () {
|
|
1018
1535
|
return loaded;
|
|
1019
1536
|
})];
|
|
1020
1537
|
|
|
@@ -1027,7 +1544,9 @@ var NaverMintMapController = function (_super) {
|
|
|
1027
1544
|
|
|
1028
1545
|
this.mapApiLoaded = true;
|
|
1029
1546
|
resolve(true);
|
|
1030
|
-
return [2
|
|
1547
|
+
return [2
|
|
1548
|
+
/*return*/
|
|
1549
|
+
];
|
|
1031
1550
|
}
|
|
1032
1551
|
});
|
|
1033
1552
|
});
|
|
@@ -1041,8 +1560,11 @@ var NaverMintMapController = function (_super) {
|
|
|
1041
1560
|
var _this = this;
|
|
1042
1561
|
|
|
1043
1562
|
return __generator(this, function (_a) {
|
|
1563
|
+
//div element
|
|
1044
1564
|
this.mapDivElement = divElement;
|
|
1045
|
-
return [2
|
|
1565
|
+
return [2
|
|
1566
|
+
/*return*/
|
|
1567
|
+
, new Promise(function (resolve) {
|
|
1046
1568
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1047
1569
|
var options, maxZoom, minZoom, map;
|
|
1048
1570
|
|
|
@@ -1053,17 +1575,26 @@ var NaverMintMapController = function (_super) {
|
|
|
1053
1575
|
return __generator(this, function (_e) {
|
|
1054
1576
|
switch (_e.label) {
|
|
1055
1577
|
case 0:
|
|
1578
|
+
//이미 생성했으면
|
|
1579
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
1580
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
1056
1581
|
if (this.mapInitialized && this.map) {
|
|
1057
1582
|
if (this.map.getElement() === divElement) {
|
|
1058
1583
|
resolve(this.map);
|
|
1059
|
-
return [2
|
|
1584
|
+
return [2
|
|
1585
|
+
/*return*/
|
|
1586
|
+
];
|
|
1060
1587
|
} else {
|
|
1061
1588
|
this.map.destroy();
|
|
1062
1589
|
}
|
|
1063
1590
|
}
|
|
1064
1591
|
|
|
1065
|
-
if (!!this.mapApiLoaded) return [3
|
|
1066
|
-
|
|
1592
|
+
if (!!this.mapApiLoaded) return [3
|
|
1593
|
+
/*break*/
|
|
1594
|
+
, 2];
|
|
1595
|
+
return [4
|
|
1596
|
+
/*yield*/
|
|
1597
|
+
, this.loadMapApi()];
|
|
1067
1598
|
|
|
1068
1599
|
case 1:
|
|
1069
1600
|
_e.sent();
|
|
@@ -1100,43 +1631,59 @@ var NaverMintMapController = function (_super) {
|
|
|
1100
1631
|
options.minZoom = minZoom;
|
|
1101
1632
|
options.maxZoom = maxZoom;
|
|
1102
1633
|
map = new naver.maps.Map(divElement, options);
|
|
1103
|
-
this.map = map;
|
|
1634
|
+
this.map = map; //@ts-ignore
|
|
1635
|
+
|
|
1104
1636
|
map.addListener('dragstart', function (e) {
|
|
1637
|
+
//console.log('map dragstart', e);
|
|
1105
1638
|
_this.dragStartPoint[0] = e.domEvent.clientX;
|
|
1106
1639
|
_this.dragStartPoint[1] = e.domEvent.clientY;
|
|
1107
|
-
});
|
|
1640
|
+
}); //@ts-ignore
|
|
1641
|
+
|
|
1108
1642
|
map.addListener('dragend', function (e) {
|
|
1643
|
+
//console.log('map dragend', e);
|
|
1109
1644
|
if (_this.dragStartPoint[0] === e.domEvent.clientX && _this.dragStartPoint[1] === e.domEvent.clientY) {
|
|
1110
1645
|
_this.dragged = false;
|
|
1111
1646
|
} else {
|
|
1112
1647
|
_this.dragged = true;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1648
|
+
} //console.log('map dragend', this.dragged)
|
|
1649
|
+
|
|
1650
|
+
}); //@ts-ignore
|
|
1651
|
+
|
|
1115
1652
|
map.addListener('idle', function (e) {
|
|
1653
|
+
//onBoundsChanged event
|
|
1116
1654
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
1117
1655
|
});
|
|
1118
1656
|
map.addListener('zoom_changed', function () {
|
|
1657
|
+
//onZoomChanged event
|
|
1658
|
+
//console.log('zoom_changed');
|
|
1119
1659
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom());
|
|
1120
|
-
});
|
|
1660
|
+
}); //@ts-ignore
|
|
1661
|
+
|
|
1121
1662
|
map.addListener('click', function (e) {
|
|
1663
|
+
// console.log('map click', e);
|
|
1122
1664
|
if (!_this.mapProps.onClick) return;
|
|
1123
1665
|
var pos = new Position(e.coord.y, e.coord.x);
|
|
1124
1666
|
pos.offset = new Offset(e.offset.x, e.offset.y);
|
|
1125
1667
|
|
|
1126
1668
|
_this.mapProps.onClick(pos);
|
|
1127
|
-
});
|
|
1669
|
+
}); //@ts-ignore
|
|
1670
|
+
|
|
1128
1671
|
map.addListener('mousemove', function (e) {
|
|
1129
1672
|
if (!_this.mapProps.onMouseMove) return;
|
|
1130
1673
|
var pos = new Position(e.coord.y, e.coord.x);
|
|
1131
|
-
pos.offset = new Offset(e.offset.x, e.offset.y);
|
|
1674
|
+
pos.offset = new Offset(e.offset.x, e.offset.y); // console.log('mousemove', pos)
|
|
1132
1675
|
|
|
1133
1676
|
_this.mapProps.onMouseMove(pos);
|
|
1134
1677
|
});
|
|
1135
1678
|
this.mapInitialized = true;
|
|
1136
|
-
this.initMarkerPool();
|
|
1137
|
-
|
|
1679
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
1680
|
+
|
|
1681
|
+
resolve(map); //네이버는 로드 후에 idle 이 발생 안해서 직접 일으켜준다
|
|
1682
|
+
|
|
1138
1683
|
map.trigger('idle');
|
|
1139
|
-
return [2
|
|
1684
|
+
return [2
|
|
1685
|
+
/*return*/
|
|
1686
|
+
];
|
|
1140
1687
|
}
|
|
1141
1688
|
});
|
|
1142
1689
|
});
|
|
@@ -1159,11 +1706,13 @@ var NaverMintMapController = function (_super) {
|
|
|
1159
1706
|
var _a;
|
|
1160
1707
|
|
|
1161
1708
|
try {
|
|
1709
|
+
this.removeAllEventListener();
|
|
1162
1710
|
this.map && this.map.destroy();
|
|
1163
1711
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1164
1712
|
} catch (e) {
|
|
1165
1713
|
console.log('naver map destroy error', e);
|
|
1166
|
-
}
|
|
1714
|
+
} // console.log(`${this.type} map destroyed`);
|
|
1715
|
+
|
|
1167
1716
|
};
|
|
1168
1717
|
|
|
1169
1718
|
NaverMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -1205,10 +1754,104 @@ var NaverMintMapController = function (_super) {
|
|
|
1205
1754
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
1206
1755
|
};
|
|
1207
1756
|
|
|
1757
|
+
NaverMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
1758
|
+
var _this = this;
|
|
1759
|
+
|
|
1760
|
+
var naverEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
1761
|
+
|
|
1762
|
+
if (!naverEventName) {
|
|
1763
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
1764
|
+
return;
|
|
1765
|
+
} // console.log(`${eventName} add`);
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
var map = this.eventMap.get(eventName);
|
|
1769
|
+
|
|
1770
|
+
if (!map) {
|
|
1771
|
+
map = new Map();
|
|
1772
|
+
this.eventMap.set(eventName, map);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
var wrappingCallback = function (e) {
|
|
1776
|
+
if (eventName in _this.mapEvent) {
|
|
1777
|
+
var bounds = _this.getCurrBounds();
|
|
1778
|
+
|
|
1779
|
+
var param = {
|
|
1780
|
+
name: eventName,
|
|
1781
|
+
mapType: 'naver',
|
|
1782
|
+
vendorEventName: naverEventName,
|
|
1783
|
+
param: {
|
|
1784
|
+
bounds: bounds,
|
|
1785
|
+
center: bounds.getCenter(),
|
|
1786
|
+
zoomLevel: _this.getZoomLevel()
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
callback(param);
|
|
1790
|
+
} else if (eventName in _this.mapUIEvent) {
|
|
1791
|
+
var position = new Position(e.coord.y, e.coord.x);
|
|
1792
|
+
position.offset = new Offset(e.offset.x, e.offset.y);
|
|
1793
|
+
var param = {
|
|
1794
|
+
name: eventName,
|
|
1795
|
+
mapType: 'naver',
|
|
1796
|
+
vendorEventName: naverEventName,
|
|
1797
|
+
param: {
|
|
1798
|
+
position: position,
|
|
1799
|
+
offset: position.offset
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
callback(param);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
var naverEventListener = naver.maps.Event.addListener(this.map, naverEventName, wrappingCallback);
|
|
1807
|
+
map.set(callback, naverEventListener);
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
NaverMintMapController.prototype.removeEventListener = function (eventName, callback) {
|
|
1811
|
+
var map = this.eventMap.get(eventName);
|
|
1812
|
+
|
|
1813
|
+
if (map) {
|
|
1814
|
+
var naverEventListener = map.get(callback);
|
|
1815
|
+
|
|
1816
|
+
if (naverEventListener) {
|
|
1817
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
1818
|
+
naver.maps.Event.removeListener(naverEventListener);
|
|
1819
|
+
map.delete(callback);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
NaverMintMapController.prototype.removeAllEventListener = function (eventName) {
|
|
1825
|
+
var _this = this;
|
|
1826
|
+
|
|
1827
|
+
if (eventName) {
|
|
1828
|
+
this.clearEventListener(eventName);
|
|
1829
|
+
} else {
|
|
1830
|
+
this.eventMap.forEach(function (_map, eventName) {
|
|
1831
|
+
_this.clearEventListener(eventName);
|
|
1832
|
+
});
|
|
1833
|
+
this.eventMap.clear();
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1837
|
+
NaverMintMapController.prototype.clearEventListener = function (eventName) {
|
|
1838
|
+
var map = this.eventMap.get(eventName);
|
|
1839
|
+
|
|
1840
|
+
if (map) {
|
|
1841
|
+
map.forEach(function (naverEventListener) {
|
|
1842
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
1843
|
+
naver.maps.Event.removeListener(naverEventListener);
|
|
1844
|
+
});
|
|
1845
|
+
this.eventMap.delete(eventName);
|
|
1846
|
+
}
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1208
1849
|
return NaverMintMapController;
|
|
1209
1850
|
}(MintMapController);
|
|
1210
1851
|
|
|
1211
|
-
var GoogleMintMapController =
|
|
1852
|
+
var GoogleMintMapController =
|
|
1853
|
+
/** @class */
|
|
1854
|
+
function (_super) {
|
|
1212
1855
|
__extends(GoogleMintMapController, _super);
|
|
1213
1856
|
|
|
1214
1857
|
function GoogleMintMapController(props) {
|
|
@@ -1217,21 +1860,34 @@ var GoogleMintMapController = function (_super) {
|
|
|
1217
1860
|
_this.type = 'google';
|
|
1218
1861
|
_this.map = null;
|
|
1219
1862
|
_this.scriptUrl = 'https://maps.googleapis.com/maps/api/js';
|
|
1220
|
-
_this.scriptModules = ['marker'];
|
|
1863
|
+
_this.scriptModules = ['marker']; //'drawing' , 'geometry' , 'journeySharing' , 'localContext' , 'places' , 'visualization']
|
|
1864
|
+
|
|
1865
|
+
_this.mapEvent = new MapEvent();
|
|
1866
|
+
_this.mapUIEvent = new MapUIEvent();
|
|
1221
1867
|
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
1222
1868
|
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
1223
1869
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
1224
1870
|
_this.dragged = false;
|
|
1871
|
+
_this.lastMousePosition = null;
|
|
1225
1872
|
|
|
1226
1873
|
_this.destroyMap = function () {
|
|
1227
1874
|
try {
|
|
1875
|
+
_this.removeAllEventListener();
|
|
1876
|
+
|
|
1228
1877
|
_this.map && google.maps.event.clearInstanceListeners(_this.map);
|
|
1229
1878
|
} catch (e) {
|
|
1230
1879
|
console.log('google map destroy error', e);
|
|
1231
|
-
}
|
|
1880
|
+
} // console.log(`${this.type} map destroyed`);
|
|
1881
|
+
|
|
1232
1882
|
};
|
|
1233
1883
|
|
|
1234
|
-
|
|
1884
|
+
_this.eventMap = new Map(); //google 은 zoomstart 가 없으므로 zoom_changed 로 대체 (하지만 zooming 되는 내내 여러번 호출됨)
|
|
1885
|
+
//나중에 naver 와 마찬가지로 zoomstart 1번 zoom_changed 1번 호출되도록 바꾸는것 고려중
|
|
1886
|
+
|
|
1887
|
+
_this.mapEvent.ZOOMSTART = 'zoom_changed';
|
|
1888
|
+
Object.freeze(_this.mapEvent);
|
|
1889
|
+
Object.freeze(_this.mapUIEvent);
|
|
1890
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
1235
1891
|
}
|
|
1236
1892
|
|
|
1237
1893
|
GoogleMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -1249,12 +1905,13 @@ var GoogleMintMapController = function (_super) {
|
|
|
1249
1905
|
visible = _e === void 0 ? true : _e,
|
|
1250
1906
|
_f = _a.editable,
|
|
1251
1907
|
editable = _f === void 0 ? false : _f,
|
|
1252
|
-
event = _a.event;
|
|
1908
|
+
event = _a.event; //console.log('polyline', polyline);
|
|
1253
1909
|
|
|
1254
1910
|
if (this.map && Array.isArray(position)) {
|
|
1255
1911
|
var path = position.map(function (elem) {
|
|
1256
1912
|
return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
|
|
1257
|
-
});
|
|
1913
|
+
}); //console.log('polyline path',path);
|
|
1914
|
+
|
|
1258
1915
|
var pol_1 = new google.maps.Polyline({
|
|
1259
1916
|
map: this.map,
|
|
1260
1917
|
path: path,
|
|
@@ -1264,7 +1921,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
1264
1921
|
clickable: true,
|
|
1265
1922
|
visible: visible,
|
|
1266
1923
|
editable: editable
|
|
1267
|
-
});
|
|
1924
|
+
}); //console.log('google polyline created', polyline);
|
|
1925
|
+
|
|
1268
1926
|
polyline.native = pol_1;
|
|
1269
1927
|
event && event.forEach(function (handler, key) {
|
|
1270
1928
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -1275,8 +1933,9 @@ var GoogleMintMapController = function (_super) {
|
|
|
1275
1933
|
};
|
|
1276
1934
|
|
|
1277
1935
|
GoogleMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
1936
|
+
//console.log('controller updatePolyline', options);
|
|
1278
1937
|
if (polyline && polyline.native && polyline.native instanceof google.maps.Polyline) {
|
|
1279
|
-
var polylineOption = this.getValidOptions(options);
|
|
1938
|
+
var polylineOption = this.getValidOptions(options); //console.log('controller updatePolyline start', polylineOption);
|
|
1280
1939
|
|
|
1281
1940
|
if (this.map && Array.isArray(options.position)) {
|
|
1282
1941
|
var path = options.position.map(function (elem) {
|
|
@@ -1309,7 +1968,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1309
1968
|
visible = _g === void 0 ? true : _g,
|
|
1310
1969
|
_h = _a.editable,
|
|
1311
1970
|
editable = _h === void 0 ? false : _h,
|
|
1312
|
-
event = _a.event;
|
|
1971
|
+
event = _a.event; //console.log('polygon', polygon);
|
|
1313
1972
|
|
|
1314
1973
|
if (this.map && Array.isArray(position)) {
|
|
1315
1974
|
var outLine = position.map(function (elem) {
|
|
@@ -1328,7 +1987,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
1328
1987
|
clickable: true,
|
|
1329
1988
|
visible: visible,
|
|
1330
1989
|
editable: editable
|
|
1331
|
-
});
|
|
1990
|
+
}); //console.log('google polygon created', polygon);
|
|
1991
|
+
|
|
1332
1992
|
polygon.native = pol_2;
|
|
1333
1993
|
event && event.forEach(function (handler, key) {
|
|
1334
1994
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -1339,8 +1999,9 @@ var GoogleMintMapController = function (_super) {
|
|
|
1339
1999
|
};
|
|
1340
2000
|
|
|
1341
2001
|
GoogleMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
2002
|
+
//console.log('controller updatePolygon', options);
|
|
1342
2003
|
if (polygon && polygon.native && polygon.native instanceof google.maps.Polygon) {
|
|
1343
|
-
var polygonOption = this.getValidOptions(options);
|
|
2004
|
+
var polygonOption = this.getValidOptions(options); //console.log('controller updatePolygon start', polygonOption);
|
|
1344
2005
|
|
|
1345
2006
|
if (this.map && Array.isArray(options.position)) {
|
|
1346
2007
|
var outLine = options.position.map(function (elem) {
|
|
@@ -1356,12 +2017,14 @@ var GoogleMintMapController = function (_super) {
|
|
|
1356
2017
|
};
|
|
1357
2018
|
|
|
1358
2019
|
GoogleMintMapController.prototype.getValidOptions = function (options) {
|
|
2020
|
+
//console.log('getValidOptions DrawableOptions',options)
|
|
1359
2021
|
var target = {};
|
|
1360
2022
|
|
|
1361
2023
|
for (var _i = 0, _a = Object.getOwnPropertyNames(options); _i < _a.length; _i++) {
|
|
1362
|
-
var name_1 = _a[_i];
|
|
2024
|
+
var name_1 = _a[_i]; //@ts-ignore
|
|
1363
2025
|
|
|
1364
2026
|
if (options[name_1] !== undefined) {
|
|
2027
|
+
//@ts-ignore
|
|
1365
2028
|
target[name_1] = options[name_1];
|
|
1366
2029
|
}
|
|
1367
2030
|
}
|
|
@@ -1377,7 +2040,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1377
2040
|
if (this.map) {
|
|
1378
2041
|
var googleMarker_1;
|
|
1379
2042
|
|
|
1380
|
-
if (marker.element) {
|
|
2043
|
+
if (marker.element && marker.element instanceof Element) {
|
|
1381
2044
|
var options = {
|
|
1382
2045
|
map: this.map,
|
|
1383
2046
|
position: marker.options.position
|
|
@@ -1408,6 +2071,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1408
2071
|
};
|
|
1409
2072
|
|
|
1410
2073
|
GoogleMintMapController.prototype.updateMarker = function (marker, options) {
|
|
2074
|
+
//console.log('controller updateMarker', options);
|
|
1411
2075
|
var _a, _b;
|
|
1412
2076
|
|
|
1413
2077
|
if (marker && marker.native) {
|
|
@@ -1418,7 +2082,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
1418
2082
|
marker.native.setOptions({
|
|
1419
2083
|
map: map,
|
|
1420
2084
|
position: options.position instanceof Position ? options.position : marker.native.getPosition(),
|
|
1421
|
-
visible: options.visible === undefined || options.visible
|
|
2085
|
+
visible: options.visible === undefined || options.visible // icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
2086
|
+
|
|
1422
2087
|
});
|
|
1423
2088
|
}
|
|
1424
2089
|
} else if (marker.native instanceof google.maps.marker.AdvancedMarkerView) {
|
|
@@ -1514,7 +2179,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1514
2179
|
GoogleMintMapController.prototype.checkLoaded = function () {
|
|
1515
2180
|
var _a, _b, _c;
|
|
1516
2181
|
|
|
1517
|
-
return (_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.marker) === null || _c === void 0 ? void 0 : _c.AdvancedMarkerView;
|
|
2182
|
+
return ((_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.marker) === null || _c === void 0 ? void 0 : _c.AdvancedMarkerView) ? true : false;
|
|
1518
2183
|
};
|
|
1519
2184
|
|
|
1520
2185
|
GoogleMintMapController.prototype.loadMapApi = function () {
|
|
@@ -1522,17 +2187,21 @@ var GoogleMintMapController = function (_super) {
|
|
|
1522
2187
|
var _this = this;
|
|
1523
2188
|
|
|
1524
2189
|
return __generator(this, function (_a) {
|
|
1525
|
-
return [2
|
|
2190
|
+
return [2
|
|
2191
|
+
/*return*/
|
|
2192
|
+
, new Promise(function (resolve) {
|
|
1526
2193
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1527
2194
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
1528
2195
|
return __generator(this, function (_a) {
|
|
1529
2196
|
switch (_a.label) {
|
|
1530
2197
|
case 0:
|
|
1531
2198
|
callbackName = this.getRandomFunctionName('load_google');
|
|
1532
|
-
loaded = false;
|
|
2199
|
+
loaded = false; //@ts-ignore
|
|
1533
2200
|
|
|
1534
2201
|
window[callbackName] = function () {
|
|
1535
|
-
|
|
2202
|
+
// console.log('google api loaded');
|
|
2203
|
+
loaded = true; //@ts-ignore
|
|
2204
|
+
|
|
1536
2205
|
delete window[callbackName];
|
|
1537
2206
|
};
|
|
1538
2207
|
|
|
@@ -1542,17 +2211,23 @@ var GoogleMintMapController = function (_super) {
|
|
|
1542
2211
|
v: 'beta',
|
|
1543
2212
|
callback: callbackName
|
|
1544
2213
|
};
|
|
1545
|
-
return [4
|
|
2214
|
+
return [4
|
|
2215
|
+
/*yield*/
|
|
2216
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
|
|
1546
2217
|
|
|
1547
2218
|
case 1:
|
|
1548
2219
|
callbackExecFlag = _a.sent();
|
|
1549
2220
|
|
|
1550
2221
|
if (!callbackExecFlag) {
|
|
1551
|
-
loaded
|
|
2222
|
+
// console.log('google api loaded 222222');
|
|
2223
|
+
loaded = true; //@ts-ignore
|
|
2224
|
+
|
|
1552
2225
|
delete window[callbackName];
|
|
1553
2226
|
}
|
|
1554
2227
|
|
|
1555
|
-
return [4
|
|
2228
|
+
return [4
|
|
2229
|
+
/*yield*/
|
|
2230
|
+
, waiting(function () {
|
|
1556
2231
|
return loaded;
|
|
1557
2232
|
})];
|
|
1558
2233
|
|
|
@@ -1565,7 +2240,9 @@ var GoogleMintMapController = function (_super) {
|
|
|
1565
2240
|
|
|
1566
2241
|
this.mapApiLoaded = true;
|
|
1567
2242
|
resolve(true);
|
|
1568
|
-
return [2
|
|
2243
|
+
return [2
|
|
2244
|
+
/*return*/
|
|
2245
|
+
];
|
|
1569
2246
|
}
|
|
1570
2247
|
});
|
|
1571
2248
|
});
|
|
@@ -1579,8 +2256,11 @@ var GoogleMintMapController = function (_super) {
|
|
|
1579
2256
|
var _this = this;
|
|
1580
2257
|
|
|
1581
2258
|
return __generator(this, function (_a) {
|
|
2259
|
+
//div element
|
|
1582
2260
|
this.mapDivElement = divElement;
|
|
1583
|
-
return [2
|
|
2261
|
+
return [2
|
|
2262
|
+
/*return*/
|
|
2263
|
+
, new Promise(function (resolve) {
|
|
1584
2264
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1585
2265
|
var map;
|
|
1586
2266
|
|
|
@@ -1591,15 +2271,24 @@ var GoogleMintMapController = function (_super) {
|
|
|
1591
2271
|
return __generator(this, function (_e) {
|
|
1592
2272
|
switch (_e.label) {
|
|
1593
2273
|
case 0:
|
|
2274
|
+
//이미 생성했으면
|
|
2275
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
2276
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
1594
2277
|
if (this.mapInitialized && this.map) {
|
|
1595
2278
|
if (this.map.getDiv() === divElement) {
|
|
1596
2279
|
resolve(this.map);
|
|
1597
|
-
return [2
|
|
2280
|
+
return [2
|
|
2281
|
+
/*return*/
|
|
2282
|
+
];
|
|
1598
2283
|
}
|
|
1599
2284
|
}
|
|
1600
2285
|
|
|
1601
|
-
if (!!this.mapApiLoaded) return [3
|
|
1602
|
-
|
|
2286
|
+
if (!!this.mapApiLoaded) return [3
|
|
2287
|
+
/*break*/
|
|
2288
|
+
, 2];
|
|
2289
|
+
return [4
|
|
2290
|
+
/*yield*/
|
|
2291
|
+
, this.loadMapApi()];
|
|
1603
2292
|
|
|
1604
2293
|
case 1:
|
|
1605
2294
|
_e.sent();
|
|
@@ -1618,30 +2307,53 @@ var GoogleMintMapController = function (_super) {
|
|
|
1618
2307
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
1619
2308
|
clickableIcons: false
|
|
1620
2309
|
});
|
|
1621
|
-
this.map = map;
|
|
2310
|
+
this.map = map; //@ts-ignore
|
|
2311
|
+
|
|
1622
2312
|
map.addListener('idle', function () {
|
|
2313
|
+
//onBoundsChanged event
|
|
1623
2314
|
_this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
1624
2315
|
});
|
|
1625
2316
|
map.addListener('zoom_changed', function () {
|
|
1626
|
-
|
|
1627
|
-
|
|
2317
|
+
//onZoomChanged event
|
|
2318
|
+
// console.log('zoom_changed');
|
|
2319
|
+
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom() || 10);
|
|
2320
|
+
}); //@ts-ignore
|
|
2321
|
+
|
|
1628
2322
|
map.addListener('click', function (e) {
|
|
2323
|
+
// console.log('map click', e)
|
|
1629
2324
|
if (!_this.mapProps.onClick) return;
|
|
1630
2325
|
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
1631
2326
|
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
1632
2327
|
|
|
1633
2328
|
_this.mapProps.onClick(pos);
|
|
2329
|
+
}); //@ts-ignore
|
|
2330
|
+
|
|
2331
|
+
map.addListener('mousedown', function (e) {
|
|
2332
|
+
// console.log('map click', e)
|
|
2333
|
+
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
2334
|
+
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
2335
|
+
_this.lastMousePosition = pos;
|
|
2336
|
+
}); //@ts-ignore
|
|
2337
|
+
|
|
2338
|
+
map.addListener('mouseup', function (e) {
|
|
2339
|
+
// console.log('map click', e)
|
|
2340
|
+
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
2341
|
+
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
2342
|
+
_this.lastMousePosition = pos;
|
|
1634
2343
|
});
|
|
1635
2344
|
map.addListener('mousemove', function (e) {
|
|
1636
2345
|
if (!_this.mapProps.onMouseMove) return;
|
|
1637
2346
|
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
1638
|
-
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
2347
|
+
pos.offset = new Offset(e.pixel.x, e.pixel.y); // console.log('mousemove', pos)
|
|
1639
2348
|
|
|
1640
2349
|
_this.mapProps.onMouseMove(pos);
|
|
1641
2350
|
});
|
|
1642
|
-
this.mapInitialized = true;
|
|
2351
|
+
this.mapInitialized = true; // console.log(`${this.type} map script initialized`, divElement);
|
|
2352
|
+
|
|
1643
2353
|
resolve(map);
|
|
1644
|
-
return [2
|
|
2354
|
+
return [2
|
|
2355
|
+
/*return*/
|
|
2356
|
+
];
|
|
1645
2357
|
}
|
|
1646
2358
|
});
|
|
1647
2359
|
});
|
|
@@ -1664,7 +2376,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1664
2376
|
if (bounds) {
|
|
1665
2377
|
return this.fromGoogleBounds(bounds);
|
|
1666
2378
|
} else {
|
|
1667
|
-
throw new Error('bounds is not found!!!');
|
|
2379
|
+
throw new Error('bounds is not found!!!'); //return new Bounds(new Position(0,0), new Position(0,0))
|
|
1668
2380
|
}
|
|
1669
2381
|
};
|
|
1670
2382
|
|
|
@@ -1696,10 +2408,120 @@ var GoogleMintMapController = function (_super) {
|
|
|
1696
2408
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
1697
2409
|
};
|
|
1698
2410
|
|
|
2411
|
+
GoogleMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
2412
|
+
var _this = this;
|
|
2413
|
+
|
|
2414
|
+
if (!this.map) {
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
var googleEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
2419
|
+
|
|
2420
|
+
if (!googleEventName) {
|
|
2421
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
2422
|
+
return;
|
|
2423
|
+
} // console.log(`${eventName} add`);
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
var map = this.eventMap.get(eventName);
|
|
2427
|
+
|
|
2428
|
+
if (!map) {
|
|
2429
|
+
map = new Map();
|
|
2430
|
+
this.eventMap.set(eventName, map);
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
var wrappingCallback = function (e) {
|
|
2434
|
+
if (eventName in _this.mapEvent) {
|
|
2435
|
+
var bounds = _this.getCurrBounds();
|
|
2436
|
+
|
|
2437
|
+
var param = {
|
|
2438
|
+
name: eventName,
|
|
2439
|
+
mapType: 'google',
|
|
2440
|
+
vendorEventName: googleEventName,
|
|
2441
|
+
param: {
|
|
2442
|
+
bounds: bounds,
|
|
2443
|
+
center: bounds.getCenter(),
|
|
2444
|
+
zoomLevel: _this.getZoomLevel()
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
callback(param);
|
|
2448
|
+
} else if (eventName in _this.mapUIEvent) {
|
|
2449
|
+
if (eventName.startsWith('DRAG')) console.log(eventName, e);
|
|
2450
|
+
var position = null;
|
|
2451
|
+
|
|
2452
|
+
if (e) {
|
|
2453
|
+
position = new Position(e.latLng.lat(), e.latLng.lng());
|
|
2454
|
+
position.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
2455
|
+
} else {
|
|
2456
|
+
position = _this.lastMousePosition;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
var param = {
|
|
2460
|
+
name: eventName,
|
|
2461
|
+
mapType: 'google',
|
|
2462
|
+
vendorEventName: googleEventName,
|
|
2463
|
+
param: {
|
|
2464
|
+
position: position,
|
|
2465
|
+
offset: position === null || position === void 0 ? void 0 : position.offset
|
|
2466
|
+
}
|
|
2467
|
+
};
|
|
2468
|
+
callback(param);
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2472
|
+
var googleEventListener = this.map.addListener(googleEventName, wrappingCallback);
|
|
2473
|
+
map.set(callback, googleEventListener);
|
|
2474
|
+
};
|
|
2475
|
+
|
|
2476
|
+
GoogleMintMapController.prototype.removeEventListener = function (eventName, callback) {
|
|
2477
|
+
var map = this.eventMap.get(eventName);
|
|
2478
|
+
|
|
2479
|
+
if (map) {
|
|
2480
|
+
var listenerMap = this.eventMap.get(eventName);
|
|
2481
|
+
|
|
2482
|
+
if (listenerMap) {
|
|
2483
|
+
var googleEventListener = listenerMap.get(callback);
|
|
2484
|
+
|
|
2485
|
+
if (googleEventListener) {
|
|
2486
|
+
// console.log(`${eventName} remove`);
|
|
2487
|
+
google.maps.event.removeListener(googleEventListener);
|
|
2488
|
+
listenerMap.delete(callback);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
|
|
2494
|
+
GoogleMintMapController.prototype.removeAllEventListener = function (eventName) {
|
|
2495
|
+
var _this = this;
|
|
2496
|
+
|
|
2497
|
+
if (eventName) {
|
|
2498
|
+
this.clearEventListener(eventName);
|
|
2499
|
+
} else {
|
|
2500
|
+
this.eventMap.forEach(function (_map, eventName) {
|
|
2501
|
+
_this.clearEventListener(eventName);
|
|
2502
|
+
});
|
|
2503
|
+
this.eventMap.clear();
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2507
|
+
GoogleMintMapController.prototype.clearEventListener = function (eventName) {
|
|
2508
|
+
var map = this.eventMap.get(eventName);
|
|
2509
|
+
|
|
2510
|
+
if (map) {
|
|
2511
|
+
map.forEach(function (googleEventListener) {
|
|
2512
|
+
// console.log(`${eventName} remove`);
|
|
2513
|
+
google.maps.event.removeListener(googleEventListener);
|
|
2514
|
+
});
|
|
2515
|
+
this.eventMap.delete(eventName);
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
|
|
1699
2519
|
return GoogleMintMapController;
|
|
1700
2520
|
}(MintMapController);
|
|
1701
2521
|
|
|
1702
|
-
var KakaoMintMapController =
|
|
2522
|
+
var KakaoMintMapController =
|
|
2523
|
+
/** @class */
|
|
2524
|
+
function (_super) {
|
|
1703
2525
|
__extends(KakaoMintMapController, _super);
|
|
1704
2526
|
|
|
1705
2527
|
function KakaoMintMapController(props) {
|
|
@@ -1708,27 +2530,44 @@ var KakaoMintMapController = function (_super) {
|
|
|
1708
2530
|
_this.type = 'kakao';
|
|
1709
2531
|
_this.map = null;
|
|
1710
2532
|
_this.scriptUrl = 'https://dapi.kakao.com/v2/maps/sdk.js';
|
|
1711
|
-
_this.scriptModules = ['services', 'clusterer'];
|
|
2533
|
+
_this.scriptModules = ['services', 'clusterer']; // , 'geocoder' , 'panorama' , 'visualization']
|
|
2534
|
+
|
|
2535
|
+
_this.mapEvent = new MapEvent();
|
|
2536
|
+
_this.mapUIEvent = new MapUIEvent();
|
|
1712
2537
|
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
1713
2538
|
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
1714
2539
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
1715
2540
|
_this.dragStartPoint = [0, 0];
|
|
1716
2541
|
_this.dragged = false;
|
|
1717
|
-
|
|
2542
|
+
_this.eventMap = new Map(); //kakao only 이벤트이름 재정의 zoom_start
|
|
2543
|
+
|
|
2544
|
+
_this.mapEvent.ZOOMSTART = 'zoom_start';
|
|
2545
|
+
Object.freeze(_this.mapEvent);
|
|
2546
|
+
Object.freeze(_this.mapUIEvent);
|
|
2547
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
1718
2548
|
}
|
|
1719
2549
|
|
|
1720
2550
|
KakaoMintMapController.prototype.initMarkerPool = function () {
|
|
1721
2551
|
var _this = this;
|
|
1722
2552
|
|
|
1723
|
-
if (!this.mapProps.markerCache) return;
|
|
1724
|
-
|
|
2553
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
2554
|
+
|
|
2555
|
+
this.markerPool = new ObjectPool() //logging on
|
|
2556
|
+
//.setLog(true)
|
|
2557
|
+
//factory 셋팅
|
|
2558
|
+
.setFactory(function () {
|
|
2559
|
+
//console.log('pool item created');
|
|
1725
2560
|
return new kakao.maps.CustomOverlay({
|
|
1726
2561
|
position: _this.positionToLatLng(new Position(0, 0)),
|
|
1727
2562
|
map: _this.map || undefined
|
|
1728
2563
|
});
|
|
1729
|
-
})
|
|
2564
|
+
}) //clear function 셋팅
|
|
2565
|
+
.setClear(function (item) {
|
|
2566
|
+
//console.log('pool item cleared');
|
|
1730
2567
|
item.setMap(null);
|
|
1731
|
-
})
|
|
2568
|
+
}) //초기 pool 사이즈
|
|
2569
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
2570
|
+
.setCheckLiveTimeInterval(1000);
|
|
1732
2571
|
};
|
|
1733
2572
|
|
|
1734
2573
|
KakaoMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -1744,7 +2583,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1744
2583
|
lineOpacity = _d === void 0 ? 1 : _d;
|
|
1745
2584
|
_a.visible;
|
|
1746
2585
|
_a.editable;
|
|
1747
|
-
var event = _a.event;
|
|
2586
|
+
var event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
1748
2587
|
|
|
1749
2588
|
if (this.map && Array.isArray(position)) {
|
|
1750
2589
|
var path = position.map(function (elem) {
|
|
@@ -1756,7 +2595,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
1756
2595
|
strokeColor: lineColor,
|
|
1757
2596
|
strokeWeight: lineSize,
|
|
1758
2597
|
strokeOpacity: lineOpacity
|
|
1759
|
-
});
|
|
2598
|
+
}); // if(editable){
|
|
2599
|
+
// //@ts-ignore
|
|
2600
|
+
// this.drawingManager.addDrawing(pol, kakao.maps.drawing.DrawingMode.POLYLINE)
|
|
2601
|
+
// }
|
|
2602
|
+
|
|
1760
2603
|
polyline.native = pol_1;
|
|
1761
2604
|
event && event.forEach(function (handler, key) {
|
|
1762
2605
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -1767,9 +2610,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
1767
2610
|
};
|
|
1768
2611
|
|
|
1769
2612
|
KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
2613
|
+
//console.log('controller updatePolyline', options);
|
|
1770
2614
|
var _this = this;
|
|
1771
2615
|
|
|
1772
2616
|
if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
|
|
2617
|
+
//console.log('controller updatePolyline start');
|
|
1773
2618
|
var path = void 0;
|
|
1774
2619
|
|
|
1775
2620
|
if (Array.isArray(options.position)) {
|
|
@@ -1780,6 +2625,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1780
2625
|
|
|
1781
2626
|
polyline.native.setOptions({
|
|
1782
2627
|
path: path || polyline.native.getPath(),
|
|
2628
|
+
//visible:options.visible === undefined || options.visible,
|
|
1783
2629
|
strokeColor: options.lineColor,
|
|
1784
2630
|
strokeWeight: options.lineSize,
|
|
1785
2631
|
strokeOpacity: options.lineOpacity
|
|
@@ -1805,15 +2651,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
1805
2651
|
fillOpacity = _f === void 0 ? 0.5 : _f;
|
|
1806
2652
|
_a.visible;
|
|
1807
2653
|
_a.editable;
|
|
1808
|
-
var event = _a.event;
|
|
2654
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
1809
2655
|
|
|
1810
2656
|
if (this.map && Array.isArray(position)) {
|
|
1811
2657
|
var outLine = position.map(function (elem) {
|
|
1812
2658
|
return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
|
|
1813
2659
|
});
|
|
1814
2660
|
var path = [outLine];
|
|
1815
|
-
innerPositions && path.push(innerPositions.map(function (inner) {
|
|
1816
|
-
return
|
|
2661
|
+
innerPositions && path.push.apply(path, innerPositions.map(function (inner) {
|
|
2662
|
+
return inner.map(function (innerItem) {
|
|
2663
|
+
return _this.positionToLatLng(innerItem);
|
|
2664
|
+
});
|
|
1817
2665
|
}));
|
|
1818
2666
|
var pol_2 = new kakao.maps.Polygon({
|
|
1819
2667
|
map: this.map,
|
|
@@ -1822,8 +2670,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
1822
2670
|
strokeWeight: lineSize,
|
|
1823
2671
|
strokeOpacity: lineOpacity,
|
|
1824
2672
|
fillColor: fillColor,
|
|
1825
|
-
fillOpacity: fillOpacity
|
|
1826
|
-
|
|
2673
|
+
fillOpacity: fillOpacity // clickable:true,
|
|
2674
|
+
// visible:visible,
|
|
2675
|
+
|
|
2676
|
+
}); //@ts-ignore
|
|
2677
|
+
//pol.setEditable(editable)
|
|
2678
|
+
|
|
1827
2679
|
polygon.native = pol_2;
|
|
1828
2680
|
event && event.forEach(function (handler, key) {
|
|
1829
2681
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -1834,9 +2686,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
1834
2686
|
};
|
|
1835
2687
|
|
|
1836
2688
|
KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
2689
|
+
//console.log('controller updatePolygon', options);
|
|
1837
2690
|
var _this = this;
|
|
1838
2691
|
|
|
1839
2692
|
if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
|
|
2693
|
+
//console.log('controller updatePolygon start');
|
|
1840
2694
|
var paths = void 0;
|
|
1841
2695
|
|
|
1842
2696
|
if (Array.isArray(options.position)) {
|
|
@@ -1845,18 +2699,22 @@ var KakaoMintMapController = function (_super) {
|
|
|
1845
2699
|
});
|
|
1846
2700
|
paths = [outLine];
|
|
1847
2701
|
options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
|
|
1848
|
-
return
|
|
2702
|
+
return inner.map(function (innerItem) {
|
|
2703
|
+
return _this.positionToLatLng(innerItem);
|
|
2704
|
+
});
|
|
1849
2705
|
}));
|
|
1850
2706
|
}
|
|
1851
2707
|
|
|
1852
2708
|
polygon.native.setOptions({
|
|
1853
2709
|
path: paths || polygon.native.getPath(),
|
|
2710
|
+
// visible:options.visible === undefined || options.visible,
|
|
1854
2711
|
strokeColor: options.lineColor,
|
|
1855
2712
|
strokeWeight: options.lineSize,
|
|
1856
2713
|
strokeOpacity: options.lineOpacity,
|
|
1857
2714
|
fillColor: options.fillColor,
|
|
1858
2715
|
fillOpacity: options.fillOpacity
|
|
1859
|
-
});
|
|
2716
|
+
}); //@ts-ignore
|
|
2717
|
+
// options.editable !== undefined && polygon.native.setEditable(options.editable)
|
|
1860
2718
|
}
|
|
1861
2719
|
};
|
|
1862
2720
|
|
|
@@ -1868,8 +2726,10 @@ var KakaoMintMapController = function (_super) {
|
|
|
1868
2726
|
if (this.map) {
|
|
1869
2727
|
var options = {
|
|
1870
2728
|
map: this.map,
|
|
1871
|
-
position: this.positionToLatLng(marker.options.position)
|
|
1872
|
-
|
|
2729
|
+
position: this.positionToLatLng(marker.options.position) // visible:marker.options.visible === undefined || marker.options.visible,
|
|
2730
|
+
|
|
2731
|
+
}; //console.log('controller createMarker', marker.options);
|
|
2732
|
+
|
|
1873
2733
|
marker.element && (options.content = marker.element);
|
|
1874
2734
|
var kakaoMarker_1;
|
|
1875
2735
|
|
|
@@ -1882,7 +2742,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1882
2742
|
} else {
|
|
1883
2743
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
1884
2744
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
1885
|
-
marker
|
|
2745
|
+
this.removeParentElementsMargin(marker);
|
|
1886
2746
|
marker.native = kakaoMarker_1;
|
|
1887
2747
|
}
|
|
1888
2748
|
|
|
@@ -1895,10 +2755,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
1895
2755
|
};
|
|
1896
2756
|
|
|
1897
2757
|
KakaoMintMapController.prototype.updateMarker = function (marker, options) {
|
|
2758
|
+
//console.log('controller updateMarker', options);
|
|
1898
2759
|
if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
|
|
1899
2760
|
var map = marker.native.getMap();
|
|
1900
2761
|
|
|
1901
2762
|
if (map) {
|
|
2763
|
+
//Position
|
|
1902
2764
|
if (options.position && options.position instanceof Position) {
|
|
1903
2765
|
marker.native.setPosition(this.positionToLatLng(options.position));
|
|
1904
2766
|
}
|
|
@@ -1907,11 +2769,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
1907
2769
|
marker.native.setVisible(options.visible);
|
|
1908
2770
|
}
|
|
1909
2771
|
|
|
1910
|
-
marker
|
|
2772
|
+
this.removeParentElementsMargin(marker);
|
|
1911
2773
|
}
|
|
1912
2774
|
}
|
|
1913
2775
|
};
|
|
1914
2776
|
|
|
2777
|
+
KakaoMintMapController.prototype.removeParentElementsMargin = function (marker) {
|
|
2778
|
+
//맵 별로 offset 통일을 위해서 margin 제거
|
|
2779
|
+
marker.element && marker.element instanceof HTMLElement && marker.element.parentElement && (marker.element.parentElement.style.margin = '0');
|
|
2780
|
+
};
|
|
2781
|
+
|
|
1915
2782
|
KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
|
|
1916
2783
|
if (increment === void 0) {
|
|
1917
2784
|
increment = 0;
|
|
@@ -1921,14 +2788,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
1921
2788
|
var targetPane = parent.parentElement;
|
|
1922
2789
|
var max = 0;
|
|
1923
2790
|
|
|
1924
|
-
|
|
1925
|
-
var
|
|
2791
|
+
if (targetPane) {
|
|
2792
|
+
for (var i = 0; i < targetPane.childElementCount; i++) {
|
|
2793
|
+
var elem = targetPane.children[i];
|
|
1926
2794
|
|
|
1927
|
-
|
|
1928
|
-
|
|
2795
|
+
if (elem instanceof HTMLElement) {
|
|
2796
|
+
var index = Number(elem.style.zIndex);
|
|
1929
2797
|
|
|
1930
|
-
|
|
1931
|
-
|
|
2798
|
+
if (!isNaN(index) && index > max) {
|
|
2799
|
+
max = index;
|
|
2800
|
+
}
|
|
1932
2801
|
}
|
|
1933
2802
|
}
|
|
1934
2803
|
}
|
|
@@ -1999,7 +2868,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1999
2868
|
KakaoMintMapController.prototype.checkLoaded = function () {
|
|
2000
2869
|
var _a, _b;
|
|
2001
2870
|
|
|
2002
|
-
return (_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
2871
|
+
return ((_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
2003
2872
|
};
|
|
2004
2873
|
|
|
2005
2874
|
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
@@ -2007,7 +2876,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
2007
2876
|
var _this = this;
|
|
2008
2877
|
|
|
2009
2878
|
return __generator(this, function (_a) {
|
|
2010
|
-
return [2
|
|
2879
|
+
return [2
|
|
2880
|
+
/*return*/
|
|
2881
|
+
, new Promise(function (resolve) {
|
|
2011
2882
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2012
2883
|
var params, ok;
|
|
2013
2884
|
|
|
@@ -2021,13 +2892,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
2021
2892
|
libraries: this.scriptModules.join(','),
|
|
2022
2893
|
autoload: false
|
|
2023
2894
|
};
|
|
2024
|
-
return [4
|
|
2895
|
+
return [4
|
|
2896
|
+
/*yield*/
|
|
2897
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
|
|
2025
2898
|
|
|
2026
2899
|
case 1:
|
|
2027
2900
|
_a.sent();
|
|
2028
2901
|
|
|
2029
|
-
window.kakao.maps.load();
|
|
2030
|
-
return [4
|
|
2902
|
+
window.kakao.maps.load(function () {});
|
|
2903
|
+
return [4
|
|
2904
|
+
/*yield*/
|
|
2905
|
+
, waiting(function () {
|
|
2031
2906
|
return _this.checkLoaded() ? true : false;
|
|
2032
2907
|
})];
|
|
2033
2908
|
|
|
@@ -2040,7 +2915,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
2040
2915
|
|
|
2041
2916
|
this.mapApiLoaded = true;
|
|
2042
2917
|
resolve(true);
|
|
2043
|
-
return [2
|
|
2918
|
+
return [2
|
|
2919
|
+
/*return*/
|
|
2920
|
+
];
|
|
2044
2921
|
}
|
|
2045
2922
|
});
|
|
2046
2923
|
});
|
|
@@ -2055,7 +2932,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
2055
2932
|
|
|
2056
2933
|
return __generator(this, function (_a) {
|
|
2057
2934
|
this.mapDivElement = divElement;
|
|
2058
|
-
return [2
|
|
2935
|
+
return [2
|
|
2936
|
+
/*return*/
|
|
2937
|
+
, new Promise(function (resolve) {
|
|
2059
2938
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2060
2939
|
var options, maxZoom, minZoom, map;
|
|
2061
2940
|
|
|
@@ -2066,17 +2945,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
2066
2945
|
return __generator(this, function (_e) {
|
|
2067
2946
|
switch (_e.label) {
|
|
2068
2947
|
case 0:
|
|
2069
|
-
if (this.
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
if (!!this.mapApiLoaded) return [3, 2];
|
|
2079
|
-
return [4, this.loadMapApi()];
|
|
2948
|
+
if (!!this.mapApiLoaded) return [3
|
|
2949
|
+
/*break*/
|
|
2950
|
+
, 2];
|
|
2951
|
+
return [4
|
|
2952
|
+
/*yield*/
|
|
2953
|
+
, this.loadMapApi()];
|
|
2080
2954
|
|
|
2081
2955
|
case 1:
|
|
2082
2956
|
_e.sent();
|
|
@@ -2086,7 +2960,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
2086
2960
|
case 2:
|
|
2087
2961
|
options = {
|
|
2088
2962
|
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
2089
|
-
level: this.getBaseToMapZoom((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel),
|
|
2963
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
|
|
2090
2964
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
2091
2965
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
2092
2966
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -2109,31 +2983,58 @@ var KakaoMintMapController = function (_super) {
|
|
|
2109
2983
|
map = new kakao.maps.Map(divElement, options);
|
|
2110
2984
|
map.setMaxLevel(minZoom);
|
|
2111
2985
|
map.setMinLevel(maxZoom);
|
|
2112
|
-
this.map = map;
|
|
2986
|
+
this.map = map; //@ts-ignore
|
|
2987
|
+
// map.addListener('dragstart', (e)=>{
|
|
2988
|
+
// //console.log('map dragstart', e);
|
|
2989
|
+
// this.dragStartPoint[0] = e.domEvent.clientX
|
|
2990
|
+
// this.dragStartPoint[1] = e.domEvent.clientY
|
|
2991
|
+
// })
|
|
2992
|
+
//@ts-ignore
|
|
2993
|
+
// map.addListener('dragend', (e)=>{
|
|
2994
|
+
// //console.log('map dragend', e);
|
|
2995
|
+
// if(this.dragStartPoint[0] === e.domEvent.clientX && this.dragStartPoint[1] === e.domEvent.clientY){
|
|
2996
|
+
// this.dragged = false
|
|
2997
|
+
// }else{
|
|
2998
|
+
// this.dragged = true
|
|
2999
|
+
// }
|
|
3000
|
+
// //console.log('map dragend', this.dragged)
|
|
3001
|
+
// })
|
|
3002
|
+
//@ts-ignore
|
|
3003
|
+
|
|
2113
3004
|
map.addListener('idle', function (e) {
|
|
3005
|
+
//onBoundsChanged event
|
|
2114
3006
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
2115
|
-
});
|
|
3007
|
+
}); //@ts-ignore
|
|
3008
|
+
|
|
2116
3009
|
map.addListener('zoom_changed', function () {
|
|
3010
|
+
//onZoomChanged event
|
|
3011
|
+
//console.log('zoom_changed');
|
|
2117
3012
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
|
|
2118
|
-
});
|
|
3013
|
+
}); //@ts-ignore
|
|
3014
|
+
|
|
2119
3015
|
map.addListener('click', function (e) {
|
|
3016
|
+
// console.log('map click', e);
|
|
2120
3017
|
if (!_this.mapProps.onClick) return;
|
|
2121
3018
|
var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
|
|
2122
3019
|
pos.offset = new Offset(e.point.x, e.point.y);
|
|
2123
3020
|
|
|
2124
3021
|
_this.mapProps.onClick(pos);
|
|
2125
|
-
});
|
|
3022
|
+
}); //@ts-ignore
|
|
3023
|
+
|
|
2126
3024
|
map.addListener('mousemove', function (e) {
|
|
2127
3025
|
if (!_this.mapProps.onMouseMove) return;
|
|
2128
3026
|
var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
|
|
2129
|
-
pos.offset = new Offset(e.point.x, e.point.y);
|
|
3027
|
+
pos.offset = new Offset(e.point.x, e.point.y); // console.log('mousemove', pos)
|
|
2130
3028
|
|
|
2131
3029
|
_this.mapProps.onMouseMove(pos);
|
|
2132
3030
|
});
|
|
2133
3031
|
this.mapInitialized = true;
|
|
2134
|
-
this.initMarkerPool();
|
|
3032
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
3033
|
+
|
|
2135
3034
|
resolve(map);
|
|
2136
|
-
return [2
|
|
3035
|
+
return [2
|
|
3036
|
+
/*return*/
|
|
3037
|
+
];
|
|
2137
3038
|
}
|
|
2138
3039
|
});
|
|
2139
3040
|
});
|
|
@@ -2143,6 +3044,14 @@ var KakaoMintMapController = function (_super) {
|
|
|
2143
3044
|
};
|
|
2144
3045
|
|
|
2145
3046
|
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
3047
|
+
/**
|
|
3048
|
+
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
3049
|
+
* - 가장 확대된 값 : 1
|
|
3050
|
+
* - 가장 축소된 값 : 14
|
|
3051
|
+
*
|
|
3052
|
+
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
3053
|
+
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
3054
|
+
*/
|
|
2146
3055
|
var mapValue = this.getBaseToMapZoom(value);
|
|
2147
3056
|
|
|
2148
3057
|
if (mapValue > 14) {
|
|
@@ -2161,7 +3070,8 @@ var KakaoMintMapController = function (_super) {
|
|
|
2161
3070
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
2162
3071
|
} catch (e) {
|
|
2163
3072
|
console.log('kakao map destroy error', e);
|
|
2164
|
-
}
|
|
3073
|
+
} // console.log(`${this.type} map destroyed`);
|
|
3074
|
+
|
|
2165
3075
|
};
|
|
2166
3076
|
|
|
2167
3077
|
KakaoMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -2200,191 +3110,138 @@ var KakaoMintMapController = function (_super) {
|
|
|
2200
3110
|
};
|
|
2201
3111
|
|
|
2202
3112
|
KakaoMintMapController.prototype.positionToLatLng = function (pos) {
|
|
2203
|
-
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) :
|
|
3113
|
+
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : new kakao.maps.LatLng(0, 0);
|
|
2204
3114
|
};
|
|
2205
3115
|
|
|
2206
3116
|
KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
|
|
2207
|
-
return latLng ? new Position(latLng.getLat(), latLng.getLng()) :
|
|
3117
|
+
return latLng ? new Position(latLng.getLat(), latLng.getLng()) : new Position(0, 0);
|
|
2208
3118
|
};
|
|
2209
3119
|
|
|
2210
|
-
|
|
2211
|
-
|
|
3120
|
+
KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
3121
|
+
var _this = this;
|
|
2212
3122
|
|
|
2213
|
-
var
|
|
2214
|
-
function Position(lat, lng) {
|
|
2215
|
-
this.lat = 0;
|
|
2216
|
-
this.lng = 0;
|
|
2217
|
-
this.lat = lat;
|
|
2218
|
-
this.lng = lng;
|
|
2219
|
-
}
|
|
3123
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
2220
3124
|
|
|
2221
|
-
|
|
2222
|
-
|
|
3125
|
+
if (!kakaoEventName) {
|
|
3126
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
3127
|
+
return;
|
|
3128
|
+
} // console.log(`${eventName} add`);
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
var map = this.eventMap.get(eventName);
|
|
3132
|
+
|
|
3133
|
+
if (!map) {
|
|
3134
|
+
map = new Map();
|
|
3135
|
+
this.eventMap.set(eventName, map);
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
var wrappingCallback = function (e) {
|
|
3139
|
+
if (eventName in _this.mapEvent) {
|
|
3140
|
+
var bounds = _this.getCurrBounds();
|
|
3141
|
+
|
|
3142
|
+
var param = {
|
|
3143
|
+
name: eventName,
|
|
3144
|
+
mapType: 'kakao',
|
|
3145
|
+
vendorEventName: kakaoEventName,
|
|
3146
|
+
param: {
|
|
3147
|
+
bounds: bounds,
|
|
3148
|
+
center: bounds.getCenter(),
|
|
3149
|
+
zoomLevel: _this.getZoomLevel()
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
callback(param);
|
|
3153
|
+
} else if (eventName in _this.mapUIEvent) {
|
|
3154
|
+
var position = new Position(e.latLng.getLat(), e.latLng.getLng());
|
|
3155
|
+
position.offset = new Offset(e.point.x, e.point.y);
|
|
3156
|
+
var param = {
|
|
3157
|
+
name: eventName,
|
|
3158
|
+
mapType: 'kakao',
|
|
3159
|
+
vendorEventName: kakaoEventName,
|
|
3160
|
+
param: {
|
|
3161
|
+
position: position,
|
|
3162
|
+
offset: position.offset
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
callback(param);
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
|
|
3169
|
+
kakao.maps.event.addListener(this.map, kakaoEventName, wrappingCallback);
|
|
3170
|
+
map.set(callback, wrappingCallback);
|
|
2223
3171
|
};
|
|
2224
3172
|
|
|
2225
|
-
|
|
2226
|
-
|
|
3173
|
+
KakaoMintMapController.prototype.removeEventListener = function (eventName, callback) {
|
|
3174
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
2227
3175
|
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
throw new Error('nw/se or ne/sw needed');
|
|
3176
|
+
if (!kakaoEventName) {
|
|
3177
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
3178
|
+
return;
|
|
2232
3179
|
}
|
|
2233
3180
|
|
|
2234
|
-
|
|
2235
|
-
this.se = se;
|
|
2236
|
-
this.ne = ne;
|
|
2237
|
-
this.sw = sw;
|
|
3181
|
+
var map = this.eventMap.get(eventName);
|
|
2238
3182
|
|
|
2239
|
-
if (
|
|
2240
|
-
|
|
2241
|
-
} else if (ne && sw) {
|
|
2242
|
-
this.covertNESWtoNWSE(ne, sw);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
Bounds.fromNWSE = function (nw, se) {
|
|
2247
|
-
return new Bounds(nw, se, undefined, undefined);
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
Bounds.fromNESW = function (ne, sw) {
|
|
2251
|
-
return new Bounds(undefined, undefined, ne, sw);
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
|
-
Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
|
|
2255
|
-
this.ne = new Position(nw.lat, se.lng);
|
|
2256
|
-
this.sw = new Position(se.lat, nw.lng);
|
|
2257
|
-
};
|
|
3183
|
+
if (map) {
|
|
3184
|
+
var wrappingCallback = map.get(callback);
|
|
2258
3185
|
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
Bounds.prototype.getCenter = function () {
|
|
2265
|
-
return new Position(this.se.lat + (this.nw.lat - this.se.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
|
|
2266
|
-
};
|
|
2267
|
-
|
|
2268
|
-
Bounds.prototype.includesPosition = function (pos) {
|
|
2269
|
-
return this.nw.lng < pos.lng && this.se.lng > pos.lng && this.se.lat < pos.lat && this.nw.lat > pos.lat;
|
|
2270
|
-
};
|
|
2271
|
-
|
|
2272
|
-
Bounds.prototype.getIncludedPositions = function (positions) {
|
|
2273
|
-
var result = [];
|
|
2274
|
-
|
|
2275
|
-
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
2276
|
-
var pos = positions_1[_i];
|
|
2277
|
-
|
|
2278
|
-
if (this.includesPosition(pos)) {
|
|
2279
|
-
result.push(pos);
|
|
3186
|
+
if (wrappingCallback) {
|
|
3187
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
3188
|
+
kakao.maps.event.removeListener(this.map, kakaoEventName, wrappingCallback);
|
|
3189
|
+
map.delete(callback);
|
|
2280
3190
|
}
|
|
2281
3191
|
}
|
|
2282
|
-
|
|
2283
|
-
return result;
|
|
2284
3192
|
};
|
|
2285
3193
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
|
|
2290
|
-
var pos = positions_2[_i];
|
|
2291
|
-
|
|
2292
|
-
if (!this.includesPosition(pos)) {
|
|
2293
|
-
return false;
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
return true;
|
|
2298
|
-
};
|
|
2299
|
-
|
|
2300
|
-
Bounds.prototype.includesOnlyOnePoint = function (positions) {
|
|
2301
|
-
for (var _i = 0, positions_3 = positions; _i < positions_3.length; _i++) {
|
|
2302
|
-
var pos = positions_3[_i];
|
|
3194
|
+
KakaoMintMapController.prototype.removeAllEventListener = function (eventName) {
|
|
3195
|
+
var _this = this;
|
|
2303
3196
|
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
3197
|
+
if (eventName) {
|
|
3198
|
+
this.clearEventListener(eventName);
|
|
3199
|
+
} else {
|
|
3200
|
+
this.eventMap.forEach(function (_map, eventName) {
|
|
3201
|
+
_this.clearEventListener(eventName);
|
|
3202
|
+
});
|
|
3203
|
+
this.eventMap.clear();
|
|
2307
3204
|
}
|
|
2308
|
-
|
|
2309
|
-
return false;
|
|
2310
3205
|
};
|
|
2311
3206
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
return Bounds;
|
|
2317
|
-
}();
|
|
2318
|
-
|
|
2319
|
-
var Offset = function () {
|
|
2320
|
-
function Offset(x, y) {
|
|
2321
|
-
this.x = x;
|
|
2322
|
-
this.y = y;
|
|
2323
|
-
}
|
|
2324
|
-
|
|
2325
|
-
return Offset;
|
|
2326
|
-
}();
|
|
2327
|
-
|
|
2328
|
-
var Drawable = function () {
|
|
2329
|
-
function Drawable() {}
|
|
2330
|
-
|
|
2331
|
-
return Drawable;
|
|
2332
|
-
}();
|
|
2333
|
-
|
|
2334
|
-
var Marker = function (_super) {
|
|
2335
|
-
__extends(Marker, _super);
|
|
2336
|
-
|
|
2337
|
-
function Marker(options) {
|
|
2338
|
-
var _this = _super.call(this) || this;
|
|
2339
|
-
|
|
2340
|
-
_this.options = options;
|
|
2341
|
-
return _this;
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
return Marker;
|
|
2345
|
-
}(Drawable);
|
|
2346
|
-
|
|
2347
|
-
var Polyline = function (_super) {
|
|
2348
|
-
__extends(Polyline, _super);
|
|
2349
|
-
|
|
2350
|
-
function Polyline(options) {
|
|
2351
|
-
var _this = _super.call(this) || this;
|
|
2352
|
-
|
|
2353
|
-
_this.options = options;
|
|
2354
|
-
return _this;
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
return Polyline;
|
|
2358
|
-
}(Drawable);
|
|
3207
|
+
KakaoMintMapController.prototype.clearEventListener = function (eventName) {
|
|
3208
|
+
var _this = this;
|
|
2359
3209
|
|
|
2360
|
-
var
|
|
2361
|
-
__extends(Polygon, _super);
|
|
3210
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
2362
3211
|
|
|
2363
|
-
|
|
2364
|
-
|
|
3212
|
+
if (!kakaoEventName) {
|
|
3213
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
2365
3216
|
|
|
2366
|
-
|
|
2367
|
-
return _this;
|
|
2368
|
-
}
|
|
3217
|
+
var map = this.eventMap.get(eventName);
|
|
2369
3218
|
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
3219
|
+
if (map) {
|
|
3220
|
+
map.forEach(function (wrappingCallback) {
|
|
3221
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
3222
|
+
kakao.maps.event.removeListener(_this.map, kakaoEventName, wrappingCallback);
|
|
2374
3223
|
});
|
|
2375
|
-
|
|
3224
|
+
this.eventMap.delete(eventName);
|
|
2376
3225
|
}
|
|
2377
|
-
|
|
2378
|
-
throw new Error('center 를 찾을 수 없습니다.');
|
|
2379
3226
|
};
|
|
2380
3227
|
|
|
2381
|
-
return
|
|
2382
|
-
}(
|
|
2383
|
-
|
|
3228
|
+
return KakaoMintMapController;
|
|
3229
|
+
}(MintMapController);
|
|
3230
|
+
|
|
3231
|
+
var cn$2 = classNames.bind(styles$2); //지도 기본 센터
|
|
3232
|
+
|
|
2384
3233
|
var DEFAULT_CENTER = {
|
|
2385
3234
|
lat: 37.5036845,
|
|
2386
3235
|
lng: 127.0448698
|
|
2387
3236
|
};
|
|
3237
|
+
/**
|
|
3238
|
+
* Mint Map 컴포넌트
|
|
3239
|
+
*
|
|
3240
|
+
* @param {MintMapProps} MintMapProps
|
|
3241
|
+
*
|
|
3242
|
+
* @returns {JSX.Element} JSX
|
|
3243
|
+
*/
|
|
3244
|
+
|
|
2388
3245
|
function MintMap(_a) {
|
|
2389
3246
|
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
2390
3247
|
_b = _a.dissolveEffectWhenLoaded,
|
|
@@ -2426,7 +3283,21 @@ function MintMap(_a) {
|
|
|
2426
3283
|
|
|
2427
3284
|
if (newController_1) {
|
|
2428
3285
|
newController_1.loadMapApi().then(function () {
|
|
2429
|
-
setController(newController_1);
|
|
3286
|
+
setController(newController_1); // fade in 로직은 일단 스킵
|
|
3287
|
+
// if(dissolveEffectWhenLoaded && loadingRef.current){
|
|
3288
|
+
// const elemStyle = loadingRef.current.style
|
|
3289
|
+
// elemStyle.background = 'white'
|
|
3290
|
+
// elemStyle.opacity = '0'
|
|
3291
|
+
// elemStyle.animationDuration = '0.1s'
|
|
3292
|
+
// loadingRef.current.addEventListener('animationend', ()=>{
|
|
3293
|
+
// setController(newController as MintMapController)
|
|
3294
|
+
// }, {
|
|
3295
|
+
// once:true
|
|
3296
|
+
// })
|
|
3297
|
+
// loadingRef.current.classList.add(cn('ani-fade-in'))
|
|
3298
|
+
// }else{
|
|
3299
|
+
// setController(newController as MintMapController)
|
|
3300
|
+
// }
|
|
2430
3301
|
});
|
|
2431
3302
|
} else {
|
|
2432
3303
|
throw new Error("Not Supported Map type ".concat(mapType));
|
|
@@ -2438,7 +3309,7 @@ function MintMap(_a) {
|
|
|
2438
3309
|
return React.createElement(React.Fragment, null, controller ? React.createElement(MintMapProvider, {
|
|
2439
3310
|
controller: controller
|
|
2440
3311
|
}, dissolveEffectWhenLoaded && React.createElement("div", {
|
|
2441
|
-
className: cn$
|
|
3312
|
+
className: cn$2('ani-fade-out'),
|
|
2442
3313
|
style: {
|
|
2443
3314
|
position: 'absolute',
|
|
2444
3315
|
top: '0px',
|
|
@@ -2471,256 +3342,250 @@ function MintMap(_a) {
|
|
|
2471
3342
|
}
|
|
2472
3343
|
}), loading));
|
|
2473
3344
|
}
|
|
2474
|
-
function PointLoading(_a) {
|
|
2475
|
-
var _b = _a.text,
|
|
2476
|
-
text = _b === void 0 ? 'Loading' : _b,
|
|
2477
|
-
_c = _a.pointCount,
|
|
2478
|
-
pointCount = _c === void 0 ? 4 : _c,
|
|
2479
|
-
_d = _a.speedMs,
|
|
2480
|
-
speedMs = _d === void 0 ? 200 : _d;
|
|
2481
|
-
var pointStringPool = useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
2482
|
-
return Array.from(Array(idx + 1)).map(function () {
|
|
2483
|
-
return '.';
|
|
2484
|
-
}).join('');
|
|
2485
|
-
}))[0];
|
|
2486
3345
|
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
3346
|
+
var MintMapCanvasRenderer =
|
|
3347
|
+
/** @class */
|
|
3348
|
+
function () {
|
|
3349
|
+
function MintMapCanvasRenderer(context) {
|
|
3350
|
+
this.context = context;
|
|
3351
|
+
}
|
|
2490
3352
|
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
var interval = setInterval(function () {
|
|
2494
|
-
pointStringIndex += 1;
|
|
3353
|
+
return MintMapCanvasRenderer;
|
|
3354
|
+
}();
|
|
2495
3355
|
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
3356
|
+
function SVGCircle(_a) {
|
|
3357
|
+
var _b = _a.radius,
|
|
3358
|
+
radius = _b === void 0 ? 100 : _b,
|
|
3359
|
+
_c = _a.background,
|
|
3360
|
+
background = _c === void 0 ? 'lightgreen' : _c,
|
|
3361
|
+
children = _a.children,
|
|
3362
|
+
_d = _a.svgProperties,
|
|
3363
|
+
svgProperties = _d === void 0 ? {} : _d,
|
|
3364
|
+
_e = _a.shapeProperties,
|
|
3365
|
+
shapeProperties = _e === void 0 ? {} : _e;
|
|
2499
3366
|
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
3367
|
+
var _f = useState(radius * 2),
|
|
3368
|
+
boxSize = _f[0],
|
|
3369
|
+
setBoxSize = _f[1];
|
|
3370
|
+
|
|
3371
|
+
useEffect(function () {
|
|
3372
|
+
// console.log('SVGCircle radius', radius);
|
|
3373
|
+
setBoxSize(radius * 2);
|
|
3374
|
+
}, [radius]);
|
|
3375
|
+
return React.createElement(React.Fragment, null, React.createElement("svg", __assign({
|
|
3376
|
+
pointerEvents: "none",
|
|
3377
|
+
width: boxSize,
|
|
3378
|
+
height: boxSize,
|
|
3379
|
+
viewBox: "0 0 100 100"
|
|
3380
|
+
}, svgProperties), React.createElement("circle", __assign({
|
|
3381
|
+
pointerEvents: "visiblepainted",
|
|
3382
|
+
cx: '50',
|
|
3383
|
+
cy: '50',
|
|
3384
|
+
r: '50',
|
|
3385
|
+
fill: background
|
|
3386
|
+
}, shapeProperties))), React.createElement("div", {
|
|
2509
3387
|
style: {
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
3388
|
+
pointerEvents: 'none',
|
|
3389
|
+
position: 'absolute',
|
|
3390
|
+
left: '0px',
|
|
3391
|
+
top: '0px',
|
|
3392
|
+
width: "".concat(boxSize, "px"),
|
|
3393
|
+
height: "".concat(boxSize, "px")
|
|
2515
3394
|
}
|
|
2516
|
-
},
|
|
3395
|
+
}, children));
|
|
2517
3396
|
}
|
|
2518
|
-
function MapLoadingWithImage(_a) {
|
|
2519
|
-
var _b = _a.size,
|
|
2520
|
-
size = _b === void 0 ? 256 : _b;
|
|
2521
3397
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
3398
|
+
function SVGPolygon(_a) {
|
|
3399
|
+
var path = _a.path,
|
|
3400
|
+
_b = _a.innerPath,
|
|
3401
|
+
innerPath = _b === void 0 ? [] : _b,
|
|
3402
|
+
_c = _a.background,
|
|
3403
|
+
background = _c === void 0 ? 'lightblue' : _c,
|
|
3404
|
+
_d = _a.svgProperties,
|
|
3405
|
+
svgProperties = _d === void 0 ? {} : _d,
|
|
3406
|
+
_e = _a.shapeProperties,
|
|
3407
|
+
shapeProperties = _e === void 0 ? {} : _e,
|
|
3408
|
+
_f = _a.mode,
|
|
3409
|
+
mode = _f === void 0 ? 'POLYGON' : _f,
|
|
3410
|
+
children = _a.children;
|
|
3411
|
+
var getPolygonInfo = useCallback(function (path) {
|
|
3412
|
+
var maxX, minX, maxY, minY;
|
|
2525
3413
|
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
setHeight = _d[1];
|
|
3414
|
+
for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
|
|
3415
|
+
var offset = path_1[_i];
|
|
2529
3416
|
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
3417
|
+
if (maxX === undefined || offset.x > maxX) {
|
|
3418
|
+
maxX = offset.x;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
if (minX === undefined || offset.x < minX) {
|
|
3422
|
+
minX = offset.x;
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3425
|
+
if (maxY === undefined || offset.y > maxY) {
|
|
3426
|
+
maxY = offset.y;
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
if (minY === undefined || offset.y < minY) {
|
|
3430
|
+
minY = offset.y;
|
|
3431
|
+
}
|
|
2533
3432
|
}
|
|
2534
3433
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
3434
|
+
if (!maxX || !minX || !maxY || !minY) {
|
|
3435
|
+
return {
|
|
3436
|
+
containerLeft: 0,
|
|
3437
|
+
containerTop: 0,
|
|
3438
|
+
containerWidth: 0,
|
|
3439
|
+
containerHeight: 0
|
|
3440
|
+
};
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
var width = maxX - minX;
|
|
3444
|
+
var height = maxY - minY;
|
|
3445
|
+
return {
|
|
3446
|
+
containerLeft: Math.floor(minX),
|
|
3447
|
+
containerTop: Math.floor(minY),
|
|
3448
|
+
containerWidth: Math.floor(width),
|
|
3449
|
+
containerHeight: Math.floor(height)
|
|
3450
|
+
};
|
|
3451
|
+
}, []);
|
|
3452
|
+
var getD = useCallback(function (_a) {
|
|
3453
|
+
var path = _a.path,
|
|
3454
|
+
containerLeft = _a.containerLeft,
|
|
3455
|
+
containerTop = _a.containerTop,
|
|
3456
|
+
mode = _a.mode;
|
|
3457
|
+
var left = containerLeft;
|
|
3458
|
+
var top = containerTop;
|
|
3459
|
+
var isPolygon = mode === 'POLYGON';
|
|
3460
|
+
var out = ''; //path
|
|
3461
|
+
|
|
3462
|
+
out += getLine(path, left, top, isPolygon); //inner path
|
|
3463
|
+
|
|
3464
|
+
for (var _i = 0, innerPath_1 = innerPath; _i < innerPath_1.length; _i++) {
|
|
3465
|
+
var inner = innerPath_1[_i];
|
|
3466
|
+
out += ' ' + getLine(inner, left, top, isPolygon);
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
return out;
|
|
3470
|
+
}, []);
|
|
3471
|
+
var getLine = useCallback(function (path, offsetLeft, offsetTop, closePath) {
|
|
3472
|
+
return path.map(function (offset, idx) {
|
|
3473
|
+
if (idx === 0) {
|
|
3474
|
+
return "M ".concat(offset.x - offsetLeft, ",").concat(offset.y - offsetTop);
|
|
3475
|
+
} else if (idx === 1) {
|
|
3476
|
+
return "L ".concat(offset.x - offsetLeft, ",").concat(offset.y - offsetTop);
|
|
3477
|
+
} else {
|
|
3478
|
+
if (offset.equals(path[idx - 1])) {
|
|
3479
|
+
return '';
|
|
3480
|
+
} else {
|
|
3481
|
+
return "".concat(offset.x - offsetLeft, ",").concat(offset.y - offsetTop);
|
|
2542
3482
|
}
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
3483
|
+
}
|
|
3484
|
+
}).join(' ') + " ".concat(closePath ? 'Z' : '');
|
|
3485
|
+
}, []);
|
|
3486
|
+
|
|
3487
|
+
var _g = useState(0),
|
|
3488
|
+
width = _g[0],
|
|
3489
|
+
setWidth = _g[1];
|
|
3490
|
+
|
|
3491
|
+
var _h = useState(0),
|
|
3492
|
+
height = _h[0],
|
|
3493
|
+
setHeight = _h[1];
|
|
3494
|
+
|
|
3495
|
+
var _j = useState('M0 0'),
|
|
3496
|
+
d = _j[0],
|
|
3497
|
+
setD = _j[1];
|
|
3498
|
+
|
|
3499
|
+
useEffect(function () {
|
|
3500
|
+
var info = getPolygonInfo(path);
|
|
3501
|
+
setWidth(info.containerWidth);
|
|
3502
|
+
setHeight(info.containerHeight);
|
|
3503
|
+
setD(getD(__assign(__assign({}, info), {
|
|
3504
|
+
path: path,
|
|
3505
|
+
innerPath: innerPath,
|
|
3506
|
+
mode: mode
|
|
3507
|
+
})));
|
|
3508
|
+
}, [path, innerPath]);
|
|
3509
|
+
return React.createElement(React.Fragment, null, React.createElement("svg", __assign({
|
|
3510
|
+
pointerEvents: "none",
|
|
3511
|
+
width: width,
|
|
3512
|
+
height: height,
|
|
3513
|
+
viewBox: "0 0 ".concat(width, " ").concat(height)
|
|
3514
|
+
}, svgProperties), React.createElement("path", __assign({
|
|
3515
|
+
fillRule: "evenodd",
|
|
3516
|
+
pointerEvents: "visiblepainted",
|
|
3517
|
+
x: "0",
|
|
3518
|
+
y: "0",
|
|
3519
|
+
width: width,
|
|
3520
|
+
height: height,
|
|
3521
|
+
fill: mode === 'POLYLINE' ? 'none' : background,
|
|
3522
|
+
stroke: mode === 'POLYLINE' ? 'black' : 'green',
|
|
3523
|
+
strokeLinejoin: "round",
|
|
3524
|
+
strokeLinecap: "butt",
|
|
3525
|
+
d: d
|
|
3526
|
+
}, shapeProperties))), React.createElement("div", {
|
|
2559
3527
|
style: {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
3528
|
+
pointerEvents: 'none',
|
|
3529
|
+
position: 'absolute',
|
|
3530
|
+
left: '0px',
|
|
3531
|
+
top: '0px',
|
|
3532
|
+
width: "".concat(width, "px"),
|
|
3533
|
+
height: "".concat(height, "px")
|
|
2563
3534
|
}
|
|
2564
|
-
},
|
|
3535
|
+
}, children));
|
|
2565
3536
|
}
|
|
2566
3537
|
|
|
2567
|
-
function
|
|
2568
|
-
var _b = _a.
|
|
2569
|
-
|
|
2570
|
-
_c = _a.
|
|
2571
|
-
|
|
2572
|
-
_d = _a.
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
},
|
|
2584
|
-
width: size,
|
|
2585
|
-
height: size,
|
|
2586
|
-
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
2587
|
-
fill: "none",
|
|
2588
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2589
|
-
}, React.createElement("g", {
|
|
2590
|
-
transform: "scale(".concat(scale, ")"),
|
|
2591
|
-
"clip-path": "url(#clip0_5_701)"
|
|
2592
|
-
}, React.createElement("rect", {
|
|
2593
|
-
width: "4000",
|
|
2594
|
-
height: "4000",
|
|
2595
|
-
transform: "translate(0 4000) rotate(-90)",
|
|
2596
|
-
fill: "#F8F8F8"
|
|
2597
|
-
}), React.createElement("path", {
|
|
2598
|
-
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
2599
|
-
fill: "#E6E6E6"
|
|
2600
|
-
}), React.createElement("path", {
|
|
2601
|
-
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
2602
|
-
fill: "#F6E4DD"
|
|
2603
|
-
}), React.createElement("path", {
|
|
2604
|
-
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
2605
|
-
fill: "#DCEACA"
|
|
2606
|
-
}), React.createElement("path", {
|
|
2607
|
-
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
2608
|
-
fill: "#E6E6E6"
|
|
2609
|
-
}), React.createElement("path", {
|
|
2610
|
-
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
2611
|
-
fill: "#DCEACA"
|
|
2612
|
-
}), React.createElement("path", {
|
|
2613
|
-
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",
|
|
2614
|
-
fill: "#A2CAEE"
|
|
2615
|
-
}), React.createElement("circle", {
|
|
2616
|
-
cx: "958",
|
|
2617
|
-
cy: "3092",
|
|
2618
|
-
r: "95",
|
|
2619
|
-
fill: "#A2CAEE"
|
|
2620
|
-
}), React.createElement("circle", {
|
|
2621
|
-
cx: "1127",
|
|
2622
|
-
cy: "3176",
|
|
2623
|
-
r: "56",
|
|
2624
|
-
fill: "#A2CAEE"
|
|
2625
|
-
}), React.createElement("path", {
|
|
2626
|
-
"fill-rule": "evenodd",
|
|
2627
|
-
"clip-rule": "evenodd",
|
|
2628
|
-
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
2629
|
-
fill: "white"
|
|
2630
|
-
}), React.createElement("path", {
|
|
2631
|
-
"fill-rule": "evenodd",
|
|
2632
|
-
"clip-rule": "evenodd",
|
|
2633
|
-
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",
|
|
2634
|
-
fill: "white"
|
|
2635
|
-
}), React.createElement("path", {
|
|
2636
|
-
"fill-rule": "evenodd",
|
|
2637
|
-
"clip-rule": "evenodd",
|
|
2638
|
-
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
2639
|
-
fill: "#FBEDB1"
|
|
2640
|
-
}), React.createElement("path", {
|
|
2641
|
-
"fill-rule": "evenodd",
|
|
2642
|
-
"clip-rule": "evenodd",
|
|
2643
|
-
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
2644
|
-
fill: "white"
|
|
2645
|
-
}), React.createElement("path", {
|
|
2646
|
-
"fill-rule": "evenodd",
|
|
2647
|
-
"clip-rule": "evenodd",
|
|
2648
|
-
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
2649
|
-
fill: "white"
|
|
2650
|
-
}), React.createElement("path", {
|
|
2651
|
-
"fill-rule": "evenodd",
|
|
2652
|
-
"clip-rule": "evenodd",
|
|
2653
|
-
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
2654
|
-
fill: "white"
|
|
2655
|
-
}), React.createElement("path", {
|
|
2656
|
-
"fill-rule": "evenodd",
|
|
2657
|
-
"clip-rule": "evenodd",
|
|
2658
|
-
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
2659
|
-
fill: "white"
|
|
2660
|
-
}), React.createElement("path", {
|
|
2661
|
-
"fill-rule": "evenodd",
|
|
2662
|
-
"clip-rule": "evenodd",
|
|
2663
|
-
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
2664
|
-
fill: "white"
|
|
2665
|
-
}), React.createElement("path", {
|
|
2666
|
-
"fill-rule": "evenodd",
|
|
2667
|
-
"clip-rule": "evenodd",
|
|
2668
|
-
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
2669
|
-
fill: "white"
|
|
2670
|
-
}), React.createElement("path", {
|
|
2671
|
-
"fill-rule": "evenodd",
|
|
2672
|
-
"clip-rule": "evenodd",
|
|
2673
|
-
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
2674
|
-
fill: "white"
|
|
2675
|
-
}), React.createElement("path", {
|
|
2676
|
-
"fill-rule": "evenodd",
|
|
2677
|
-
"clip-rule": "evenodd",
|
|
2678
|
-
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
2679
|
-
fill: "white"
|
|
2680
|
-
}), React.createElement("path", {
|
|
2681
|
-
"fill-rule": "evenodd",
|
|
2682
|
-
"clip-rule": "evenodd",
|
|
2683
|
-
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",
|
|
2684
|
-
fill: "white"
|
|
2685
|
-
}), React.createElement("path", {
|
|
2686
|
-
"fill-rule": "evenodd",
|
|
2687
|
-
"clip-rule": "evenodd",
|
|
2688
|
-
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
2689
|
-
fill: "white"
|
|
2690
|
-
}), React.createElement("path", {
|
|
2691
|
-
"fill-rule": "evenodd",
|
|
2692
|
-
"clip-rule": "evenodd",
|
|
2693
|
-
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
2694
|
-
fill: "white"
|
|
2695
|
-
}), React.createElement("path", {
|
|
2696
|
-
"fill-rule": "evenodd",
|
|
2697
|
-
"clip-rule": "evenodd",
|
|
2698
|
-
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
2699
|
-
fill: "white"
|
|
2700
|
-
}), React.createElement("path", {
|
|
2701
|
-
"fill-rule": "evenodd",
|
|
2702
|
-
"clip-rule": "evenodd",
|
|
2703
|
-
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",
|
|
2704
|
-
fill: "#FBEDB1"
|
|
2705
|
-
})), React.createElement("defs", null, React.createElement("clipPath", {
|
|
2706
|
-
id: "clip0_5_701"
|
|
2707
|
-
}, React.createElement("rect", {
|
|
2708
|
-
width: "4000",
|
|
2709
|
-
height: "4000",
|
|
2710
|
-
fill: "white",
|
|
2711
|
-
transform: "translate(0 4000) rotate(-90)"
|
|
2712
|
-
}))));
|
|
2713
|
-
}
|
|
3538
|
+
function SVGRect(_a) {
|
|
3539
|
+
var _b = _a.width,
|
|
3540
|
+
width = _b === void 0 ? 100 : _b,
|
|
3541
|
+
_c = _a.height,
|
|
3542
|
+
height = _c === void 0 ? 100 : _c,
|
|
3543
|
+
_d = _a.background,
|
|
3544
|
+
background = _d === void 0 ? 'lightblue' : _d,
|
|
3545
|
+
_e = _a.svgProperties,
|
|
3546
|
+
svgProperties = _e === void 0 ? {} : _e,
|
|
3547
|
+
_f = _a.shapeProperties,
|
|
3548
|
+
shapeProperties = _f === void 0 ? {} : _f,
|
|
3549
|
+
children = _a.children;
|
|
3550
|
+
var getViewHeight = useCallback(function (width, height) {
|
|
3551
|
+
return Number((100 * height / width).toFixed(0));
|
|
3552
|
+
}, []);
|
|
3553
|
+
var viewWidth = useRef(100);
|
|
2714
3554
|
|
|
2715
|
-
var
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
}
|
|
3555
|
+
var _g = useState(getViewHeight(width, height)),
|
|
3556
|
+
viewHeight = _g[0],
|
|
3557
|
+
setViewHeight = _g[1];
|
|
2719
3558
|
|
|
2720
|
-
|
|
2721
|
-
|
|
3559
|
+
useEffect(function () {
|
|
3560
|
+
setViewHeight(getViewHeight(width, height));
|
|
3561
|
+
}, [width, height]);
|
|
3562
|
+
return React.createElement(React.Fragment, null, React.createElement("svg", __assign({
|
|
3563
|
+
pointerEvents: "none",
|
|
3564
|
+
width: width,
|
|
3565
|
+
height: height,
|
|
3566
|
+
viewBox: "0 0 ".concat(viewWidth.current, " ").concat(viewHeight)
|
|
3567
|
+
}, svgProperties), React.createElement("rect", __assign({
|
|
3568
|
+
pointerEvents: "visiblepainted",
|
|
3569
|
+
x: "0",
|
|
3570
|
+
y: "0",
|
|
3571
|
+
width: viewWidth.current,
|
|
3572
|
+
height: viewHeight,
|
|
3573
|
+
fill: background
|
|
3574
|
+
}, shapeProperties))), React.createElement("div", {
|
|
3575
|
+
style: {
|
|
3576
|
+
pointerEvents: 'none',
|
|
3577
|
+
position: 'absolute',
|
|
3578
|
+
left: '0px',
|
|
3579
|
+
top: '0px',
|
|
3580
|
+
width: "".concat(width, "px"),
|
|
3581
|
+
height: "".concat(height, "px")
|
|
3582
|
+
}
|
|
3583
|
+
}, children));
|
|
3584
|
+
}
|
|
2722
3585
|
|
|
2723
|
-
var AnimationPlayer =
|
|
3586
|
+
var AnimationPlayer =
|
|
3587
|
+
/** @class */
|
|
3588
|
+
function () {
|
|
2724
3589
|
function AnimationPlayer(drawFunction, fps) {
|
|
2725
3590
|
this.prevtime = 0;
|
|
2726
3591
|
this.elapsedTime = 0;
|
|
@@ -2755,21 +3620,27 @@ var AnimationPlayer = function () {
|
|
|
2755
3620
|
};
|
|
2756
3621
|
|
|
2757
3622
|
AnimationPlayer.prototype.resume = function () {
|
|
2758
|
-
this.playing = true;
|
|
3623
|
+
this.playing = true; //@ts-ignore
|
|
3624
|
+
|
|
2759
3625
|
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
2760
3626
|
};
|
|
2761
3627
|
|
|
2762
3628
|
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
3629
|
+
//frame 간 시간 변화
|
|
2763
3630
|
if (this.prevtime === 0) {
|
|
2764
3631
|
this.prevtime = timestamp;
|
|
2765
3632
|
}
|
|
2766
3633
|
|
|
2767
|
-
this.deltaTime += timestamp - this.prevtime;
|
|
3634
|
+
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
3635
|
+
|
|
2768
3636
|
this.prevtime = timestamp;
|
|
2769
3637
|
|
|
2770
3638
|
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
2771
|
-
|
|
2772
|
-
|
|
3639
|
+
//다음 루프 준비
|
|
3640
|
+
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
3641
|
+
|
|
3642
|
+
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
3643
|
+
|
|
2773
3644
|
this.deltaTime = 0;
|
|
2774
3645
|
|
|
2775
3646
|
if (stopFlag) {
|
|
@@ -2778,12 +3649,93 @@ var AnimationPlayer = function () {
|
|
|
2778
3649
|
}
|
|
2779
3650
|
|
|
2780
3651
|
if (this.playing) {
|
|
3652
|
+
//@ts-ignore
|
|
2781
3653
|
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
2782
3654
|
}
|
|
2783
3655
|
};
|
|
2784
3656
|
|
|
2785
|
-
return AnimationPlayer;
|
|
2786
|
-
}();
|
|
3657
|
+
return AnimationPlayer;
|
|
3658
|
+
}();
|
|
3659
|
+
|
|
3660
|
+
var Drawable =
|
|
3661
|
+
/** @class */
|
|
3662
|
+
function () {
|
|
3663
|
+
function Drawable() {}
|
|
3664
|
+
|
|
3665
|
+
return Drawable;
|
|
3666
|
+
}();
|
|
3667
|
+
|
|
3668
|
+
var Marker =
|
|
3669
|
+
/** @class */
|
|
3670
|
+
function (_super) {
|
|
3671
|
+
__extends(Marker, _super);
|
|
3672
|
+
/**
|
|
3673
|
+
* 지도에 표시할 마커정보
|
|
3674
|
+
*/
|
|
3675
|
+
|
|
3676
|
+
|
|
3677
|
+
function Marker(options) {
|
|
3678
|
+
var _this = _super.call(this) || this;
|
|
3679
|
+
|
|
3680
|
+
_this.options = options;
|
|
3681
|
+
return _this;
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
return Marker;
|
|
3685
|
+
}(Drawable);
|
|
3686
|
+
|
|
3687
|
+
var Polyline =
|
|
3688
|
+
/** @class */
|
|
3689
|
+
function (_super) {
|
|
3690
|
+
__extends(Polyline, _super);
|
|
3691
|
+
/**
|
|
3692
|
+
* 지도에 표시할 폴리곤정보
|
|
3693
|
+
*/
|
|
3694
|
+
|
|
3695
|
+
|
|
3696
|
+
function Polyline(options) {
|
|
3697
|
+
var _this = _super.call(this) || this;
|
|
3698
|
+
|
|
3699
|
+
_this.options = options;
|
|
3700
|
+
return _this;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
return Polyline;
|
|
3704
|
+
}(Drawable);
|
|
3705
|
+
|
|
3706
|
+
var Polygon =
|
|
3707
|
+
/** @class */
|
|
3708
|
+
function (_super) {
|
|
3709
|
+
__extends(Polygon, _super);
|
|
3710
|
+
/**
|
|
3711
|
+
* 지도에 표시할 폴리곤정보
|
|
3712
|
+
*/
|
|
3713
|
+
|
|
3714
|
+
|
|
3715
|
+
function Polygon(options) {
|
|
3716
|
+
var _this = _super.call(this) || this;
|
|
3717
|
+
|
|
3718
|
+
_this.options = options;
|
|
3719
|
+
return _this;
|
|
3720
|
+
}
|
|
3721
|
+
/**
|
|
3722
|
+
* 폴리곤의 중점을 구한다.
|
|
3723
|
+
*/
|
|
3724
|
+
|
|
3725
|
+
|
|
3726
|
+
Polygon.prototype.getCenter = function () {
|
|
3727
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
3728
|
+
var paths = this.options.position.map(function (elem) {
|
|
3729
|
+
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
3730
|
+
});
|
|
3731
|
+
return PolygonCalculator.getCenter(paths);
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3737
|
+
return Polygon;
|
|
3738
|
+
}(Drawable);
|
|
2787
3739
|
|
|
2788
3740
|
function nextIndex(array, currIdx) {
|
|
2789
3741
|
var next = currIdx + 1;
|
|
@@ -2811,13 +3763,16 @@ function useMarkerMoving(_a) {
|
|
|
2811
3763
|
_h = _a.velocity,
|
|
2812
3764
|
velocity = _h === void 0 ? 10 : _h,
|
|
2813
3765
|
onMovingStart = _a.onMovingStart,
|
|
2814
|
-
onMovingEnd = _a.onMovingEnd;
|
|
3766
|
+
onMovingEnd = _a.onMovingEnd; //controller
|
|
3767
|
+
|
|
2815
3768
|
var controller = useMintMapController();
|
|
2816
3769
|
useEffect(function () {
|
|
3770
|
+
//console.log('velocity changed!!!!', velocity);
|
|
2817
3771
|
contextRef.current && (contextRef.current.velocityKmh = velocity);
|
|
2818
3772
|
}, [velocity]);
|
|
2819
3773
|
var contextRef = useRef();
|
|
2820
3774
|
useEffect(function () {
|
|
3775
|
+
//console.log('ani marker', marker);
|
|
2821
3776
|
if (marker) {
|
|
2822
3777
|
var currTargetIndex_1 = nextIndex(positions, startPositionIndex);
|
|
2823
3778
|
var stopNext_1 = false;
|
|
@@ -2835,15 +3790,19 @@ function useMarkerMoving(_a) {
|
|
|
2835
3790
|
var draw = function (frameGapTime, _elapsedTime) {
|
|
2836
3791
|
if (!marker) {
|
|
2837
3792
|
console.log('myMarker is not exist!!!');
|
|
2838
|
-
return true;
|
|
2839
|
-
}
|
|
3793
|
+
return true; //종료
|
|
3794
|
+
} //지난 시간
|
|
3795
|
+
|
|
2840
3796
|
|
|
2841
|
-
context_1.elapsedTimeMs = frameGapTime;
|
|
3797
|
+
context_1.elapsedTimeMs = frameGapTime; //next position 계산
|
|
2842
3798
|
|
|
2843
3799
|
while (true) {
|
|
2844
|
-
|
|
3800
|
+
//계산
|
|
3801
|
+
GeoCalulator.computeNextPositionAndDistances(context_1); //타겟에 도착했으면, 원래 얼마나 더 갈수 있었는지 체크해서
|
|
3802
|
+
//그 만큼 더 가도록 계속 처리하기위해 다시 계산
|
|
2845
3803
|
|
|
2846
3804
|
if (context_1.nextPos === context_1.pos2) {
|
|
3805
|
+
//다음 목표가 시작점과 같으면 loop 카운트 +1
|
|
2847
3806
|
if (currTargetIndex_1 === startPositionIndex) {
|
|
2848
3807
|
loopCount_1 += 1;
|
|
2849
3808
|
}
|
|
@@ -2851,9 +3810,11 @@ function useMarkerMoving(_a) {
|
|
|
2851
3810
|
if (!loop && loopCount_1 > 0) {
|
|
2852
3811
|
stopNext_1 = true;
|
|
2853
3812
|
break;
|
|
2854
|
-
}
|
|
3813
|
+
} //현재 출발점
|
|
3814
|
+
|
|
3815
|
+
|
|
3816
|
+
context_1.pos1 = positions[currTargetIndex_1]; //현재 목표점
|
|
2855
3817
|
|
|
2856
|
-
context_1.pos1 = positions[currTargetIndex_1];
|
|
2857
3818
|
currTargetIndex_1 = nextIndex(positions, currTargetIndex_1);
|
|
2858
3819
|
|
|
2859
3820
|
if (currTargetIndex_1 === 0 && !positionClosed) {
|
|
@@ -2867,13 +3828,13 @@ function useMarkerMoving(_a) {
|
|
|
2867
3828
|
}
|
|
2868
3829
|
}
|
|
2869
3830
|
|
|
2870
|
-
nextOption_1.position = context_1.nextPos;
|
|
3831
|
+
nextOption_1.position = new Position(context_1.nextPos.lat, context_1.nextPos.lng);
|
|
2871
3832
|
marker.options.position = nextOption_1.position;
|
|
2872
3833
|
controller.updateMarker(marker, nextOption_1);
|
|
2873
3834
|
|
|
2874
3835
|
if (stopNext_1) {
|
|
2875
3836
|
onMovingEnd && onMovingEnd();
|
|
2876
|
-
return true;
|
|
3837
|
+
return true; //종료
|
|
2877
3838
|
}
|
|
2878
3839
|
|
|
2879
3840
|
return false;
|
|
@@ -2921,12 +3882,21 @@ function useMarkerMoving(_a) {
|
|
|
2921
3882
|
}
|
|
2922
3883
|
|
|
2923
3884
|
var offsetCalibration = function (mapType, divElement, options) {
|
|
3885
|
+
//google 맵의 anchor 보정 (네이버와 같이 왼쪽/위 기준으로 처리)
|
|
2924
3886
|
if (mapType === 'google') {
|
|
2925
3887
|
divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2926
3888
|
} else if (mapType === 'kakao') {
|
|
2927
3889
|
divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2928
3890
|
}
|
|
2929
3891
|
};
|
|
3892
|
+
/**
|
|
3893
|
+
* Mint Map 컴포넌트
|
|
3894
|
+
*
|
|
3895
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3896
|
+
*
|
|
3897
|
+
* @returns {JSX.Element} JSX
|
|
3898
|
+
*/
|
|
3899
|
+
|
|
2930
3900
|
|
|
2931
3901
|
function MapMarkerWrapper(_a) {
|
|
2932
3902
|
var startAnimationClassName = _a.startAnimationClassName,
|
|
@@ -2936,20 +3906,27 @@ function MapMarkerWrapper(_a) {
|
|
|
2936
3906
|
_c = _a.topOnHover,
|
|
2937
3907
|
topOnHover = _c === void 0 ? false : _c,
|
|
2938
3908
|
movingAnimation = _a.movingAnimation,
|
|
3909
|
+
_d = _a.disablePointerEvent,
|
|
3910
|
+
disablePointerEvent = _d === void 0 ? false : _d,
|
|
2939
3911
|
children = _a.children,
|
|
2940
|
-
options = __rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "children"]);
|
|
3912
|
+
options = __rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
3913
|
+
|
|
3914
|
+
|
|
3915
|
+
var controller = useMintMapController(); //element
|
|
2941
3916
|
|
|
2942
|
-
var controller = useMintMapController();
|
|
2943
3917
|
var divRef = useRef(document.createElement('div'));
|
|
2944
|
-
var divElement = divRef.current;
|
|
2945
|
-
|
|
2946
|
-
var
|
|
3918
|
+
var divElement = divRef.current; //element clone for animation
|
|
3919
|
+
|
|
3920
|
+
var divCloneRef = useRef(); //marker
|
|
2947
3921
|
|
|
2948
|
-
var
|
|
2949
|
-
|
|
2950
|
-
|
|
3922
|
+
var markerRef = useRef(); //moving animation
|
|
3923
|
+
|
|
3924
|
+
var _e = useState({}),
|
|
3925
|
+
movingState = _e[0],
|
|
3926
|
+
setMovingState = _e[1];
|
|
2951
3927
|
|
|
2952
3928
|
useEffect(function () {
|
|
3929
|
+
// console.log('movingState', movingState);
|
|
2953
3930
|
if (movingState.autoStart) {
|
|
2954
3931
|
setTimeout(function () {
|
|
2955
3932
|
start();
|
|
@@ -2957,18 +3934,20 @@ function MapMarkerWrapper(_a) {
|
|
|
2957
3934
|
}
|
|
2958
3935
|
}, [movingState]);
|
|
2959
3936
|
useEffect(function () {
|
|
3937
|
+
// console.log('movingAnimation changed', movingAnimation);
|
|
2960
3938
|
if (movingAnimation) {
|
|
2961
3939
|
setMovingState(__assign(__assign({}, movingAnimation), {
|
|
2962
3940
|
marker: markerRef.current
|
|
2963
3941
|
}));
|
|
2964
3942
|
}
|
|
2965
|
-
}, [movingAnimation]);
|
|
2966
|
-
|
|
3943
|
+
}, [movingAnimation]); //marker moving hook
|
|
3944
|
+
|
|
3945
|
+
var start = useMarkerMoving(movingState)[0]; //event handlers
|
|
2967
3946
|
|
|
2968
3947
|
var onClickHandler = function (e) {
|
|
2969
3948
|
var _a;
|
|
2970
3949
|
|
|
2971
|
-
var marker = markerRef.current;
|
|
3950
|
+
var marker = markerRef.current; //console.log('onClickHandler', marker);
|
|
2972
3951
|
|
|
2973
3952
|
if (marker) {
|
|
2974
3953
|
controller.setMapDragged(false);
|
|
@@ -2984,127 +3963,592 @@ function MapMarkerWrapper(_a) {
|
|
|
2984
3963
|
}
|
|
2985
3964
|
};
|
|
2986
3965
|
|
|
2987
|
-
var onMouseOverHandler = function (e) {
|
|
2988
|
-
var _a;
|
|
3966
|
+
var onMouseOverHandler = function (e) {
|
|
3967
|
+
var _a;
|
|
3968
|
+
|
|
3969
|
+
var marker = markerRef.current; //console.log('onMouseOverHandler', marker);
|
|
3970
|
+
|
|
3971
|
+
if (marker) {
|
|
3972
|
+
var mouseOverHandler = (_a = options === null || options === void 0 ? void 0 : options.event) === null || _a === void 0 ? void 0 : _a.get('mouseover');
|
|
3973
|
+
var next = true;
|
|
3974
|
+
|
|
3975
|
+
if (mouseOverHandler) {
|
|
3976
|
+
var hasNext = mouseOverHandler(e);
|
|
3977
|
+
hasNext !== undefined && (next = hasNext);
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
next && topOnHover && controller.markerToTheTop(marker);
|
|
3981
|
+
}
|
|
3982
|
+
}; //create object
|
|
3983
|
+
|
|
3984
|
+
|
|
3985
|
+
useEffect(function () {
|
|
3986
|
+
// console.log('drawable created')
|
|
3987
|
+
divElement.style.display = 'flex';
|
|
3988
|
+
divElement.style.justifyContent = 'flex-start';
|
|
3989
|
+
divElement.style.alignItems = 'flex-start';
|
|
3990
|
+
divElement.style.flexDirection = 'column';
|
|
3991
|
+
divElement.style.pointerEvents = disablePointerEvent ? 'none' : '';
|
|
3992
|
+
divElement.addEventListener('click', onClickHandler);
|
|
3993
|
+
divElement.addEventListener('mouseover', onMouseOverHandler);
|
|
3994
|
+
return function () {
|
|
3995
|
+
//** kakao 는 viewport 안에 있는 마커만 렌더링하므로,
|
|
3996
|
+
//마커 해제가 되더라도 애니메이션 이벤트가 일어나지 않아서 해지된 마커가 잠시 보이는 현상이 있음
|
|
3997
|
+
//그래서 kakao 일때는 endAnimationClassName 영향을 받지 않도록 처리함
|
|
3998
|
+
if (divCloneRef.current && endAnimationClassName && controller.getMapType() !== 'kakao') {
|
|
3999
|
+
divCloneRef.current.classList.add(endAnimationClassName);
|
|
4000
|
+
|
|
4001
|
+
var aniListener_1 = function () {
|
|
4002
|
+
//console.log('animationend!!!', divCloneRef.current);
|
|
4003
|
+
divCloneRef.current && divCloneRef.current.removeEventListener('animationend', aniListener_1);
|
|
4004
|
+
|
|
4005
|
+
if (markerRef.current) {
|
|
4006
|
+
controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
divCloneRef.current = undefined;
|
|
4010
|
+
};
|
|
4011
|
+
|
|
4012
|
+
divCloneRef.current.addEventListener('animationend', aniListener_1);
|
|
4013
|
+
divElement.append(divCloneRef.current);
|
|
4014
|
+
} else {
|
|
4015
|
+
divElement.removeEventListener('click', onClickHandler);
|
|
4016
|
+
divElement.removeEventListener('mouseover', onMouseOverHandler);
|
|
4017
|
+
|
|
4018
|
+
if (markerRef.current) {
|
|
4019
|
+
controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
};
|
|
4023
|
+
}, []); //create / update object
|
|
4024
|
+
|
|
4025
|
+
useEffect(function () {
|
|
4026
|
+
if (options) {
|
|
4027
|
+
if (markerRef.current) {
|
|
4028
|
+
//console.log('update Marker')
|
|
4029
|
+
controller.updateMarker(markerRef.current, options); //disablePointerEvent 처리
|
|
4030
|
+
|
|
4031
|
+
if (divElement.parentElement) {
|
|
4032
|
+
divElement.style.pointerEvents = disablePointerEvent ? 'none' : '';
|
|
4033
|
+
divElement.parentElement.style.pointerEvents = disablePointerEvent ? 'none' : '';
|
|
4034
|
+
} //marker offset 보정
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4038
|
+
|
|
4039
|
+
if (options.zIndex !== undefined) {
|
|
4040
|
+
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
4041
|
+
}
|
|
4042
|
+
} else {
|
|
4043
|
+
//console.log('create Marker')
|
|
4044
|
+
markerRef.current = new Marker(options);
|
|
4045
|
+
markerRef.current.element = divElement;
|
|
4046
|
+
controller.createMarker(markerRef.current); //disablePointerEvent 처리
|
|
4047
|
+
|
|
4048
|
+
if (divElement.parentElement) {
|
|
4049
|
+
divElement.style.pointerEvents = disablePointerEvent ? 'none' : '';
|
|
4050
|
+
divElement.parentElement.style.pointerEvents = disablePointerEvent ? 'none' : '';
|
|
4051
|
+
} //marker offset 보정
|
|
4052
|
+
|
|
4053
|
+
|
|
4054
|
+
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4055
|
+
|
|
4056
|
+
if (options.zIndex !== undefined) {
|
|
4057
|
+
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
4058
|
+
} //moving 애니메이션 시작
|
|
4059
|
+
|
|
4060
|
+
|
|
4061
|
+
if (movingAnimation) {
|
|
4062
|
+
setMovingState(__assign(__assign({}, movingAnimation), {
|
|
4063
|
+
marker: markerRef.current
|
|
4064
|
+
}));
|
|
4065
|
+
} //start animation
|
|
4066
|
+
|
|
4067
|
+
|
|
4068
|
+
if (startAnimationClassName) {
|
|
4069
|
+
divElement.style.visibility = 'hidden';
|
|
4070
|
+
setTimeout(function () {
|
|
4071
|
+
var _a, _b;
|
|
4072
|
+
|
|
4073
|
+
divCloneRef.current = divElement.firstElementChild;
|
|
4074
|
+
divElement.style.visibility = 'visible';
|
|
4075
|
+
(_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.add(startAnimationClassName);
|
|
4076
|
+
|
|
4077
|
+
var aniListener = function () {
|
|
4078
|
+
var _a, _b;
|
|
4079
|
+
|
|
4080
|
+
(_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.remove(startAnimationClassName);
|
|
4081
|
+
(_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.removeEventListener('animationend', aniListener);
|
|
4082
|
+
};
|
|
4083
|
+
|
|
4084
|
+
(_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.addEventListener('animationend', aniListener);
|
|
4085
|
+
});
|
|
4086
|
+
} else {
|
|
4087
|
+
setTimeout(function () {
|
|
4088
|
+
divCloneRef.current = divElement.firstElementChild;
|
|
4089
|
+
});
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
}, [options]);
|
|
4094
|
+
return createPortal(children, divElement);
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
4098
|
+
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
4099
|
+
|
|
4100
|
+
|
|
4101
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
4102
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
4103
|
+
|
|
4104
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
4105
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
4106
|
+
var boundsPos = [];
|
|
4107
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
4108
|
+
|
|
4109
|
+
for (var i = 0; i < rowCount; i++) {
|
|
4110
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
4111
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
4112
|
+
var rows = [];
|
|
4113
|
+
boundsPos.push(rows);
|
|
4114
|
+
|
|
4115
|
+
for (var k = 0; k < colCount; k++) {
|
|
4116
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
4117
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
4118
|
+
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
4119
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
4120
|
+
rows.push({
|
|
4121
|
+
bounds: thisBounds,
|
|
4122
|
+
checked: false,
|
|
4123
|
+
center: false,
|
|
4124
|
+
centerPosition: thisBounds.getCenter(),
|
|
4125
|
+
incList: [],
|
|
4126
|
+
itemList: includedList,
|
|
4127
|
+
size: basePixelSize
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
} //좌표마다 검사해서 인접셀 병합 처리
|
|
4131
|
+
|
|
4132
|
+
|
|
4133
|
+
var centerList = [];
|
|
4134
|
+
var totalItemCount = 0;
|
|
4135
|
+
var min;
|
|
4136
|
+
var max;
|
|
4137
|
+
|
|
4138
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
4139
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
4140
|
+
var curr = boundsPos[i][k];
|
|
4141
|
+
if (curr.checked) continue;
|
|
4142
|
+
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
4143
|
+
|
|
4144
|
+
var incList = [];
|
|
4145
|
+
|
|
4146
|
+
if (boundsPos[i]) {
|
|
4147
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
4148
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
if (boundsPos[i - 1]) {
|
|
4152
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
4153
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
4154
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
if (boundsPos[i + 1]) {
|
|
4158
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
4159
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
4160
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
4164
|
+
var inc = incList_1[_i];
|
|
4165
|
+
if (inc.checked) continue;
|
|
4166
|
+
inc.checked = true;
|
|
4167
|
+
|
|
4168
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
4169
|
+
curr.incList.push(inc);
|
|
4170
|
+
|
|
4171
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
4172
|
+
|
|
4173
|
+
curr.center = true;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
if (curr.center) {
|
|
4178
|
+
centerList.push(curr);
|
|
4179
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
4180
|
+
return item.lat;
|
|
4181
|
+
}));
|
|
4182
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
4183
|
+
return item.lng;
|
|
4184
|
+
}));
|
|
4185
|
+
curr.centerPosition = new Position(avrLat, avrLng);
|
|
4186
|
+
totalItemCount += curr.itemList.length;
|
|
4187
|
+
|
|
4188
|
+
if (!min || curr.itemList.length < min) {
|
|
4189
|
+
min = curr.itemList.length;
|
|
4190
|
+
}
|
|
4191
|
+
|
|
4192
|
+
if (!max || curr.itemList.length > max) {
|
|
4193
|
+
max = curr.itemList.length;
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
|
|
4199
|
+
var status = {
|
|
4200
|
+
total: totalItemCount,
|
|
4201
|
+
average: totalItemCount / centerList.length,
|
|
4202
|
+
min: min,
|
|
4203
|
+
max: max
|
|
4204
|
+
};
|
|
4205
|
+
|
|
4206
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
4207
|
+
var minSize = basePixelSize / 4;
|
|
4208
|
+
var maxSize = basePixelSize;
|
|
4209
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
4210
|
+
};
|
|
4211
|
+
|
|
4212
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
4213
|
+
var center = centerList_1[_b];
|
|
4214
|
+
center.size = sizeFunction(center, status);
|
|
4215
|
+
} // console.log('centerList', centerList, status);
|
|
4216
|
+
|
|
4217
|
+
|
|
4218
|
+
return centerList;
|
|
4219
|
+
};
|
|
4220
|
+
|
|
4221
|
+
var calculateAverage = function (nums) {
|
|
4222
|
+
var sum = 0;
|
|
4223
|
+
|
|
4224
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
4225
|
+
var num = nums_1[_i];
|
|
4226
|
+
sum += num;
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
return Number((sum / nums.length).toFixed(7));
|
|
4230
|
+
};
|
|
4231
|
+
|
|
4232
|
+
/**
|
|
4233
|
+
* CircleMarker
|
|
4234
|
+
*
|
|
4235
|
+
* @param {CircleMarkerProps} CircleMarkerProps
|
|
4236
|
+
*
|
|
4237
|
+
* @returns {JSX.Element} JSX
|
|
4238
|
+
*/
|
|
4239
|
+
|
|
4240
|
+
function CircleMarker(_a) {
|
|
4241
|
+
var children = _a.children,
|
|
4242
|
+
center = _a.center,
|
|
4243
|
+
radius = _a.radius,
|
|
4244
|
+
_b = _a.radiusUnit,
|
|
4245
|
+
radiusUnit = _b === void 0 ? 'PIXEL' : _b,
|
|
4246
|
+
_c = _a.background,
|
|
4247
|
+
background = _c === void 0 ? 'lightgreen' : _c,
|
|
4248
|
+
_d = _a.svgProperties,
|
|
4249
|
+
svgProperties = _d === void 0 ? {} : _d,
|
|
4250
|
+
_e = _a.shapeProperties,
|
|
4251
|
+
shapeProperties = _e === void 0 ? {} : _e,
|
|
4252
|
+
_f = _a.visible,
|
|
4253
|
+
visible = _f === void 0 ? true : _f,
|
|
4254
|
+
zIndex = _a.zIndex; //controller
|
|
4255
|
+
|
|
4256
|
+
var controller = useMintMapController(); //zoom start event
|
|
4257
|
+
|
|
4258
|
+
var onZoomStart = useCallback(function () {
|
|
4259
|
+
setMapVisible(false);
|
|
4260
|
+
}, []); //idle event
|
|
4261
|
+
|
|
4262
|
+
var onIdle = useCallback(function () {
|
|
4263
|
+
var newZoomLevel = controller.getZoomLevel();
|
|
4264
|
+
|
|
4265
|
+
if (zoomLevel.current !== newZoomLevel) {
|
|
4266
|
+
zoomLevel.current = newZoomLevel;
|
|
4267
|
+
renderCircleBase();
|
|
4268
|
+
setTimeout(function () {
|
|
4269
|
+
setMapVisible(true);
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
}, []);
|
|
4273
|
+
var zoomLevel = useRef(controller.getZoomLevel());
|
|
4274
|
+
useEffect(function () {
|
|
4275
|
+
controller.addEventListener("ZOOMSTART", onZoomStart);
|
|
4276
|
+
controller.addEventListener("IDLE", onIdle);
|
|
4277
|
+
return function () {
|
|
4278
|
+
controller.removeEventListener("ZOOMSTART", onZoomStart);
|
|
4279
|
+
controller.removeEventListener("IDLE", onIdle);
|
|
4280
|
+
};
|
|
4281
|
+
}, []); //offsets
|
|
4282
|
+
|
|
4283
|
+
var _g = useState(),
|
|
4284
|
+
computedRadius = _g[0],
|
|
4285
|
+
setComputedRadius = _g[1];
|
|
2989
4286
|
|
|
2990
|
-
|
|
4287
|
+
var _h = useState(new Offset(0, 0)),
|
|
4288
|
+
anchor = _h[0],
|
|
4289
|
+
setAnchor = _h[1]; //circle props ref
|
|
2991
4290
|
|
|
2992
|
-
if (marker) {
|
|
2993
|
-
var mouseOverHandler = (_a = options === null || options === void 0 ? void 0 : options.event) === null || _a === void 0 ? void 0 : _a.get('mouseover');
|
|
2994
|
-
var next = true;
|
|
2995
4291
|
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
4292
|
+
var circlePropsRef = useRef({
|
|
4293
|
+
center: center,
|
|
4294
|
+
radius: radius,
|
|
4295
|
+
radiusUnit: radiusUnit
|
|
4296
|
+
}); //circle 생성 effect
|
|
3000
4297
|
|
|
3001
|
-
|
|
4298
|
+
useEffect(function () {
|
|
4299
|
+
circlePropsRef.current = {
|
|
4300
|
+
center: center,
|
|
4301
|
+
radius: radius,
|
|
4302
|
+
radiusUnit: radiusUnit
|
|
4303
|
+
};
|
|
4304
|
+
renderCircleBase();
|
|
4305
|
+
}, [center, radius, radiusUnit]); //render
|
|
4306
|
+
|
|
4307
|
+
var _j = useState(true),
|
|
4308
|
+
mapVisible = _j[0],
|
|
4309
|
+
setMapVisible = _j[1];
|
|
4310
|
+
|
|
4311
|
+
var renderCircleBase = useCallback(function () {
|
|
4312
|
+
var _a = circlePropsRef.current,
|
|
4313
|
+
center = _a.center,
|
|
4314
|
+
radius = _a.radius,
|
|
4315
|
+
radiusUnit = _a.radiusUnit;
|
|
4316
|
+
|
|
4317
|
+
if (radiusUnit === 'METER') {
|
|
4318
|
+
var latMargin = GeoCalulator.convertMeterToLatitudeValue(radius);
|
|
4319
|
+
var targetPos = new Position(center.lat + latMargin, center.lng);
|
|
4320
|
+
var tempComputedRadius = calcRadius(center, targetPos);
|
|
4321
|
+
setComputedRadius(tempComputedRadius);
|
|
4322
|
+
setAnchor(new Offset(tempComputedRadius, tempComputedRadius)); // console.log(`${radius} meter => `, tempComputedRadius);
|
|
4323
|
+
} else {
|
|
4324
|
+
setComputedRadius(radius);
|
|
4325
|
+
setAnchor(new Offset(radius, radius)); // console.log(`${radius} pixel => `, radius);
|
|
3002
4326
|
}
|
|
3003
|
-
};
|
|
4327
|
+
}, []);
|
|
4328
|
+
var calcRadius = useCallback(function (center, targetPos) {
|
|
4329
|
+
var c = controller.positionToOffset(center);
|
|
4330
|
+
var t = controller.positionToOffset(targetPos);
|
|
4331
|
+
return Math.round(Math.sqrt(Math.pow(Math.abs(c.x - t.x), 2) + Math.pow(Math.abs(c.y - t.y), 2)));
|
|
4332
|
+
}, []);
|
|
4333
|
+
return React.createElement(React.Fragment, null, computedRadius && React.createElement(MapMarkerWrapper, {
|
|
4334
|
+
position: center,
|
|
4335
|
+
anchor: anchor,
|
|
4336
|
+
visible: visible,
|
|
4337
|
+
disablePointerEvent: true,
|
|
4338
|
+
zIndex: zIndex
|
|
4339
|
+
}, mapVisible && React.createElement(SVGCircle, {
|
|
4340
|
+
radius: computedRadius,
|
|
4341
|
+
background: background,
|
|
4342
|
+
shapeProperties: __assign({
|
|
4343
|
+
pointerEvents: 'none'
|
|
4344
|
+
}, shapeProperties),
|
|
4345
|
+
svgProperties: svgProperties
|
|
4346
|
+
}, children)));
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4349
|
+
/**
|
|
4350
|
+
*PolygonMarker
|
|
4351
|
+
*
|
|
4352
|
+
* @param {PolygonMarkerProps} PolygonMarkerProps
|
|
4353
|
+
*
|
|
4354
|
+
* @returns {JSX.Element} JSX
|
|
4355
|
+
*/
|
|
3004
4356
|
|
|
4357
|
+
function PolygonMarker(_a) {
|
|
4358
|
+
var children = _a.children,
|
|
4359
|
+
position = _a.position,
|
|
4360
|
+
_b = _a.background,
|
|
4361
|
+
background = _b === void 0 ? 'lightgreen' : _b,
|
|
4362
|
+
innerPositions = _a.innerPositions,
|
|
4363
|
+
_c = _a.simplifyPath,
|
|
4364
|
+
simplifyPath = _c === void 0 ? true : _c,
|
|
4365
|
+
simplifyTolerance = _a.simplifyTolerance,
|
|
4366
|
+
_d = _a.lastReapeated,
|
|
4367
|
+
lastReapeated = _d === void 0 ? false : _d,
|
|
4368
|
+
_e = _a.svgProperties,
|
|
4369
|
+
svgProperties = _e === void 0 ? {} : _e,
|
|
4370
|
+
_f = _a.shapeProperties,
|
|
4371
|
+
shapeProperties = _f === void 0 ? {} : _f,
|
|
4372
|
+
_g = _a.visible,
|
|
4373
|
+
visible = _g === void 0 ? true : _g,
|
|
4374
|
+
zIndex = _a.zIndex,
|
|
4375
|
+
_h = _a.mode,
|
|
4376
|
+
mode = _h === void 0 ? 'POLYGON' : _h; //controller
|
|
4377
|
+
|
|
4378
|
+
var controller = useMintMapController(); //zoom start event
|
|
4379
|
+
|
|
4380
|
+
var onZoomStart = useCallback(function () {
|
|
4381
|
+
setMapVisible(false);
|
|
4382
|
+
}, []); //idle event
|
|
4383
|
+
|
|
4384
|
+
var onIdle = useCallback(function () {
|
|
4385
|
+
var newZoomLevel = controller.getZoomLevel();
|
|
4386
|
+
|
|
4387
|
+
if (zoomLevel.current !== newZoomLevel) {
|
|
4388
|
+
zoomLevel.current = newZoomLevel;
|
|
4389
|
+
renderPolygonBase();
|
|
4390
|
+
setTimeout(function () {
|
|
4391
|
+
setMapVisible(true);
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
}, []);
|
|
4395
|
+
var zoomLevel = useRef(controller.getZoomLevel());
|
|
3005
4396
|
useEffect(function () {
|
|
3006
|
-
|
|
3007
|
-
|
|
4397
|
+
controller.addEventListener("ZOOMSTART", onZoomStart);
|
|
4398
|
+
controller.addEventListener("IDLE", onIdle);
|
|
3008
4399
|
return function () {
|
|
3009
|
-
|
|
3010
|
-
|
|
4400
|
+
controller.removeEventListener("ZOOMSTART", onZoomStart);
|
|
4401
|
+
controller.removeEventListener("IDLE", onIdle);
|
|
4402
|
+
};
|
|
4403
|
+
}, []); //center
|
|
3011
4404
|
|
|
3012
|
-
|
|
3013
|
-
|
|
4405
|
+
var _j = useState(),
|
|
4406
|
+
polygonStart = _j[0],
|
|
4407
|
+
setPolygonStart = _j[1]; //offsets
|
|
3014
4408
|
|
|
3015
|
-
if (markerRef.current) {
|
|
3016
|
-
controller.clearDrawable(markerRef.current);
|
|
3017
|
-
}
|
|
3018
4409
|
|
|
3019
|
-
|
|
3020
|
-
|
|
4410
|
+
var _k = useState([]),
|
|
4411
|
+
offsets = _k[0],
|
|
4412
|
+
setOffsets = _k[1]; //inner offsets
|
|
3021
4413
|
|
|
3022
|
-
divCloneRef.current.addEventListener('animationend', aniListener_1);
|
|
3023
|
-
divElement.append(divCloneRef.current);
|
|
3024
|
-
} else {
|
|
3025
|
-
divElement.removeEventListener('click', onClickHandler);
|
|
3026
|
-
divElement.removeEventListener('mouseover', onMouseOverHandler);
|
|
3027
4414
|
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
}
|
|
3032
|
-
};
|
|
3033
|
-
}, []);
|
|
3034
|
-
useEffect(function () {
|
|
3035
|
-
if (options) {
|
|
3036
|
-
if (markerRef.current) {
|
|
3037
|
-
controller.updateMarker(markerRef.current, options);
|
|
3038
|
-
offsetCalibration(controller.getMapType(), divElement, options);
|
|
4415
|
+
var _l = useState([]),
|
|
4416
|
+
innerOffsets = _l[0],
|
|
4417
|
+
setInnerOffsets = _l[1]; //offset cache
|
|
3039
4418
|
|
|
3040
|
-
if (markerRef.current.options.zIndex !== undefined) {
|
|
3041
|
-
controller.setMarkerZIndex(markerRef.current, markerRef.current.options.zIndex);
|
|
3042
|
-
}
|
|
3043
|
-
} else {
|
|
3044
|
-
markerRef.current = new Marker(options);
|
|
3045
|
-
markerRef.current.element = divElement;
|
|
3046
|
-
controller.createMarker(markerRef.current);
|
|
3047
|
-
offsetCalibration(controller.getMapType(), divElement, options);
|
|
3048
4419
|
|
|
3049
|
-
|
|
3050
|
-
controller.setMarkerZIndex(markerRef.current, markerRef.current.options.zIndex);
|
|
3051
|
-
}
|
|
4420
|
+
var offsetCache = useRef(new Map()); //polygon props ref
|
|
3052
4421
|
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
4422
|
+
var polygonPropsRef = useRef({
|
|
4423
|
+
position: position,
|
|
4424
|
+
innerPositions: innerPositions,
|
|
4425
|
+
simplifyPath: simplifyPath,
|
|
4426
|
+
simplifyTolerance: simplifyTolerance,
|
|
4427
|
+
lastReapeated: lastReapeated
|
|
4428
|
+
}); //polygon 생성 effect
|
|
3058
4429
|
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
4430
|
+
useEffect(function () {
|
|
4431
|
+
// console.log('polygon changed');
|
|
4432
|
+
offsetCache.current.clear();
|
|
4433
|
+
polygonPropsRef.current = {
|
|
4434
|
+
position: position,
|
|
4435
|
+
innerPositions: innerPositions,
|
|
4436
|
+
simplifyPath: simplifyPath,
|
|
4437
|
+
simplifyTolerance: simplifyTolerance,
|
|
4438
|
+
lastReapeated: lastReapeated
|
|
4439
|
+
};
|
|
4440
|
+
renderPolygonBase();
|
|
4441
|
+
}, [position, innerPositions, simplifyPath, simplifyTolerance, lastReapeated]); //render
|
|
3063
4442
|
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
4443
|
+
var _m = useState(true),
|
|
4444
|
+
mapVisible = _m[0],
|
|
4445
|
+
setMapVisible = _m[1];
|
|
3067
4446
|
|
|
3068
|
-
|
|
3069
|
-
|
|
4447
|
+
var renderPolygonBase = useCallback(function () {
|
|
4448
|
+
// console.log('renderPolygonBase');
|
|
4449
|
+
var _a = polygonPropsRef.current,
|
|
4450
|
+
position = _a.position,
|
|
4451
|
+
innerPositions = _a.innerPositions,
|
|
4452
|
+
simplifyPath = _a.simplifyPath,
|
|
4453
|
+
simplifyTolerance = _a.simplifyTolerance,
|
|
4454
|
+
lastReapeated = _a.lastReapeated;
|
|
4455
|
+
var prevCache = offsetCache.current.get(zoomLevel.current);
|
|
4456
|
+
|
|
4457
|
+
if (prevCache) {
|
|
4458
|
+
var offsets_1 = [];
|
|
4459
|
+
offsets_1.push.apply(offsets_1, prevCache.offsets);
|
|
4460
|
+
setOffsets(offsets_1);
|
|
4461
|
+
var innerOffsets_1 = [];
|
|
4462
|
+
innerOffsets_1.push.apply(innerOffsets_1, prevCache.innerOffsets);
|
|
4463
|
+
setInnerOffsets(innerOffsets_1);
|
|
4464
|
+
setPolygonStart(prevCache.start);
|
|
4465
|
+
} else {
|
|
4466
|
+
// path
|
|
4467
|
+
var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(position, simplifyTolerance, lastReapeated) : position;
|
|
4468
|
+
var offsets_2 = simplified.map(function (pos) {
|
|
4469
|
+
var off = controller.positionToOffset(pos);
|
|
4470
|
+
return new Offset(Math.floor(off.x), Math.floor(off.y));
|
|
4471
|
+
});
|
|
4472
|
+
setOffsets(offsets_2); //inner path
|
|
3070
4473
|
|
|
3071
|
-
|
|
3072
|
-
(_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.removeEventListener('animationend', aniListener);
|
|
3073
|
-
};
|
|
4474
|
+
var innerPath = [];
|
|
3074
4475
|
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
4476
|
+
if (innerPositions) {
|
|
4477
|
+
for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
|
|
4478
|
+
var innerPosition = innerPositions_1[_i];
|
|
4479
|
+
var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(innerPosition, simplifyTolerance, lastReapeated) : innerPosition;
|
|
4480
|
+
var offsets_3 = simplified_1.map(function (pos) {
|
|
4481
|
+
var off = controller.positionToOffset(pos);
|
|
4482
|
+
return new Offset(Math.floor(off.x), Math.floor(off.y));
|
|
3080
4483
|
});
|
|
4484
|
+
innerPath.push(offsets_3);
|
|
3081
4485
|
}
|
|
3082
|
-
|
|
4486
|
+
|
|
4487
|
+
setInnerOffsets(innerPath);
|
|
4488
|
+
} //start point
|
|
4489
|
+
|
|
4490
|
+
|
|
4491
|
+
var regionInfo = PolygonCalculator.getRegionInfo(simplified);
|
|
4492
|
+
var startPosition = regionInfo.maxLat && regionInfo.minLng ? new Position(regionInfo.maxLat, regionInfo.minLng) : undefined;
|
|
4493
|
+
setPolygonStart(startPosition); //cache set
|
|
4494
|
+
|
|
4495
|
+
offsetCache.current.set(zoomLevel.current, {
|
|
4496
|
+
start: startPosition,
|
|
4497
|
+
offsets: offsets_2,
|
|
4498
|
+
innerOffsets: innerPath
|
|
4499
|
+
});
|
|
3083
4500
|
}
|
|
3084
|
-
}, [
|
|
3085
|
-
return
|
|
4501
|
+
}, []);
|
|
4502
|
+
return React.createElement(React.Fragment, null, polygonStart && React.createElement(MapMarkerWrapper, {
|
|
4503
|
+
position: polygonStart,
|
|
4504
|
+
visible: visible,
|
|
4505
|
+
disablePointerEvent: true,
|
|
4506
|
+
zIndex: zIndex
|
|
4507
|
+
}, mapVisible && React.createElement(SVGPolygon, {
|
|
4508
|
+
path: offsets,
|
|
4509
|
+
innerPath: innerOffsets,
|
|
4510
|
+
mode: mode,
|
|
4511
|
+
background: background,
|
|
4512
|
+
shapeProperties: shapeProperties,
|
|
4513
|
+
svgProperties: svgProperties
|
|
4514
|
+
}, children)));
|
|
3086
4515
|
}
|
|
3087
4516
|
|
|
4517
|
+
/**
|
|
4518
|
+
* Mint Map 컴포넌트
|
|
4519
|
+
*
|
|
4520
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
4521
|
+
*
|
|
4522
|
+
* @returns {JSX.Element} JSX
|
|
4523
|
+
*/
|
|
4524
|
+
|
|
3088
4525
|
function MapPolygonWrapper(_a) {
|
|
3089
4526
|
var children = _a.children,
|
|
3090
|
-
options = __rest(_a, ["children"]);
|
|
4527
|
+
options = __rest(_a, ["children"]); //controller
|
|
4528
|
+
|
|
4529
|
+
|
|
4530
|
+
var controller = useMintMapController(); //lifecycle
|
|
3091
4531
|
|
|
3092
|
-
var controller = useMintMapController();
|
|
3093
4532
|
useEffect(function () {
|
|
3094
4533
|
return function () {
|
|
3095
4534
|
if (polygonRef.current) {
|
|
4535
|
+
// console.log('polygon cleared')
|
|
3096
4536
|
controller.clearDrawable(polygonRef.current);
|
|
3097
4537
|
}
|
|
3098
4538
|
};
|
|
3099
|
-
}, []);
|
|
4539
|
+
}, []); //create/update object
|
|
4540
|
+
|
|
3100
4541
|
var polygonRef = useRef();
|
|
3101
4542
|
useEffect(function () {
|
|
4543
|
+
//console.log('Polygon useEffect')
|
|
3102
4544
|
if (options) {
|
|
3103
4545
|
if (polygonRef.current) {
|
|
4546
|
+
//console.log('update Polygon', options)
|
|
3104
4547
|
controller.updatePolygon(polygonRef.current, options);
|
|
3105
4548
|
} else {
|
|
3106
4549
|
var polygon = new Polygon(options);
|
|
3107
|
-
polygonRef.current = polygon;
|
|
4550
|
+
polygonRef.current = polygon; //console.log('create Polygon', options)
|
|
4551
|
+
|
|
3108
4552
|
controller.createPolygon(polygon);
|
|
3109
4553
|
}
|
|
3110
4554
|
}
|
|
@@ -3176,11 +4620,13 @@ function MapBuildingProjection(props) {
|
|
|
3176
4620
|
var wallPolygons = useRef();
|
|
3177
4621
|
var titlePosition = useRef();
|
|
3178
4622
|
useEffect(function () {
|
|
4623
|
+
//베이스 폴리곤
|
|
3179
4624
|
var base = {
|
|
3180
4625
|
position: basePolygonPath
|
|
3181
4626
|
};
|
|
3182
4627
|
var height = numberOfFloor * heightOfFloor;
|
|
3183
|
-
var projectionHeight = GeoCalulator.convertMeterToLatitudeValue(height);
|
|
4628
|
+
var projectionHeight = GeoCalulator.convertMeterToLatitudeValue(height); //roof
|
|
4629
|
+
|
|
3184
4630
|
var roofPaths = [];
|
|
3185
4631
|
|
|
3186
4632
|
for (var _i = 0, basePolygonPath_1 = basePolygonPath; _i < basePolygonPath_1.length; _i++) {
|
|
@@ -3190,7 +4636,8 @@ function MapBuildingProjection(props) {
|
|
|
3190
4636
|
|
|
3191
4637
|
roofPolygon.current = {
|
|
3192
4638
|
position: roofPaths
|
|
3193
|
-
};
|
|
4639
|
+
}; //walls
|
|
4640
|
+
|
|
3194
4641
|
wallPolygons.current = [];
|
|
3195
4642
|
|
|
3196
4643
|
for (var i = 0; i < basePolygonPath.length; i++) {
|
|
@@ -3201,13 +4648,14 @@ function MapBuildingProjection(props) {
|
|
|
3201
4648
|
wallPolygons.current.push({
|
|
3202
4649
|
position: [start, startNext, endNext, end]
|
|
3203
4650
|
});
|
|
3204
|
-
}
|
|
4651
|
+
} //latitude 기준으로 배열 재정렬
|
|
4652
|
+
|
|
3205
4653
|
|
|
3206
4654
|
wallPolygons.current.sort(function (a, b) {
|
|
3207
4655
|
var maxA = getMaxLat(a.position);
|
|
3208
4656
|
var maxB = getMaxLat(b.position);
|
|
3209
4657
|
return maxA.lat < maxB.lat ? 1 : -1;
|
|
3210
|
-
});
|
|
4658
|
+
}); //latitude 가장 높은값과 longitude 중간값으로 타이틀 위치 결정
|
|
3211
4659
|
|
|
3212
4660
|
if (title || titleElement) {
|
|
3213
4661
|
var maxPos = getMaxLat(wallPolygons.current[0].position);
|
|
@@ -3269,135 +4717,247 @@ function MapBuildingProjection(props) {
|
|
|
3269
4717
|
}, "".concat(title, " (").concat(numberOfFloor, "\uCE35)")))));
|
|
3270
4718
|
}
|
|
3271
4719
|
|
|
3272
|
-
var
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
var
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
var rows = [];
|
|
3286
|
-
boundsPos.push(rows);
|
|
3287
|
-
|
|
3288
|
-
for (var k = 0; k < colCount; k++) {
|
|
3289
|
-
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
3290
|
-
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
3291
|
-
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
3292
|
-
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
3293
|
-
rows.push({
|
|
3294
|
-
bounds: thisBounds,
|
|
3295
|
-
checked: false,
|
|
3296
|
-
center: false,
|
|
3297
|
-
centerPosition: thisBounds.getCenter(),
|
|
3298
|
-
incList: [],
|
|
3299
|
-
itemList: includedList,
|
|
3300
|
-
size: basePixelSize
|
|
3301
|
-
});
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
var centerList = [];
|
|
3306
|
-
var totalItemCount = 0;
|
|
3307
|
-
var min;
|
|
3308
|
-
var max;
|
|
3309
|
-
|
|
3310
|
-
for (var i = 0; i < boundsPos.length; i++) {
|
|
3311
|
-
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
3312
|
-
var curr = boundsPos[i][k];
|
|
3313
|
-
if (curr.checked) continue;
|
|
3314
|
-
curr.checked = true;
|
|
3315
|
-
var incList = [];
|
|
3316
|
-
|
|
3317
|
-
if (boundsPos[i]) {
|
|
3318
|
-
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
3319
|
-
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
3320
|
-
}
|
|
3321
|
-
|
|
3322
|
-
if (boundsPos[i - 1]) {
|
|
3323
|
-
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
3324
|
-
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
3325
|
-
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
3326
|
-
}
|
|
3327
|
-
|
|
3328
|
-
if (boundsPos[i + 1]) {
|
|
3329
|
-
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
3330
|
-
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
3331
|
-
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
3332
|
-
}
|
|
3333
|
-
|
|
3334
|
-
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
3335
|
-
var inc = incList_1[_i];
|
|
3336
|
-
if (inc.checked) continue;
|
|
3337
|
-
inc.checked = true;
|
|
4720
|
+
var cn$1 = classNames.bind(styles$2);
|
|
4721
|
+
function PointLoading(_a) {
|
|
4722
|
+
var _b = _a.text,
|
|
4723
|
+
text = _b === void 0 ? 'Loading' : _b,
|
|
4724
|
+
_c = _a.pointCount,
|
|
4725
|
+
pointCount = _c === void 0 ? 4 : _c,
|
|
4726
|
+
_d = _a.speedMs,
|
|
4727
|
+
speedMs = _d === void 0 ? 200 : _d;
|
|
4728
|
+
var pointStringPool = useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
4729
|
+
return Array.from(Array(idx + 1)).map(function () {
|
|
4730
|
+
return '.';
|
|
4731
|
+
}).join('');
|
|
4732
|
+
}))[0];
|
|
3338
4733
|
|
|
3339
|
-
|
|
3340
|
-
|
|
4734
|
+
var _e = useState(''),
|
|
4735
|
+
pointString = _e[0],
|
|
4736
|
+
setPointString = _e[1];
|
|
3341
4737
|
|
|
3342
|
-
|
|
4738
|
+
useEffect(function () {
|
|
4739
|
+
var pointStringIndex = 0;
|
|
4740
|
+
var interval = setInterval(function () {
|
|
4741
|
+
pointStringIndex += 1;
|
|
3343
4742
|
|
|
3344
|
-
|
|
3345
|
-
|
|
4743
|
+
if (pointStringIndex >= pointCount) {
|
|
4744
|
+
pointStringIndex = 0;
|
|
3346
4745
|
}
|
|
3347
4746
|
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
if (!max || curr.itemList.length > max) {
|
|
3364
|
-
max = curr.itemList.length;
|
|
3365
|
-
}
|
|
3366
|
-
}
|
|
4747
|
+
setPointString(pointStringPool[pointStringIndex]);
|
|
4748
|
+
}, speedMs);
|
|
4749
|
+
return function () {
|
|
4750
|
+
interval && clearInterval(interval);
|
|
4751
|
+
};
|
|
4752
|
+
}, []);
|
|
4753
|
+
return React.createElement("div", {
|
|
4754
|
+
className: cn$1('loading-point-container')
|
|
4755
|
+
}, React.createElement("div", {
|
|
4756
|
+
style: {
|
|
4757
|
+
width: '300px',
|
|
4758
|
+
fontSize: '16px',
|
|
4759
|
+
fontWeight: 600,
|
|
4760
|
+
color: 'gray',
|
|
4761
|
+
transform: 'translateX(130px)'
|
|
3367
4762
|
}
|
|
3368
|
-
}
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
min: min,
|
|
3374
|
-
max: max
|
|
3375
|
-
};
|
|
3376
|
-
|
|
3377
|
-
sizeFunction = sizeFunction || function (info, status) {
|
|
3378
|
-
var minSize = basePixelSize / 4;
|
|
3379
|
-
var maxSize = basePixelSize;
|
|
3380
|
-
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
3381
|
-
};
|
|
3382
|
-
|
|
3383
|
-
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
3384
|
-
var center = centerList_1[_b];
|
|
3385
|
-
center.size = sizeFunction(center, status);
|
|
3386
|
-
}
|
|
4763
|
+
}, "".concat(text, " ").concat(pointString)));
|
|
4764
|
+
}
|
|
4765
|
+
function MapLoadingWithImage(_a) {
|
|
4766
|
+
var _b = _a.size,
|
|
4767
|
+
size = _b === void 0 ? 256 : _b;
|
|
3387
4768
|
|
|
3388
|
-
|
|
3389
|
-
|
|
4769
|
+
var _c = useState(),
|
|
4770
|
+
width = _c[0],
|
|
4771
|
+
setWidth = _c[1];
|
|
3390
4772
|
|
|
3391
|
-
var
|
|
3392
|
-
|
|
4773
|
+
var _d = useState(),
|
|
4774
|
+
height = _d[0],
|
|
4775
|
+
setHeight = _d[1];
|
|
3393
4776
|
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
4777
|
+
var render = useMemo(function () {
|
|
4778
|
+
if (!height || !width) {
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
3398
4781
|
|
|
3399
|
-
|
|
3400
|
-
|
|
4782
|
+
var row = Math.ceil(height / size);
|
|
4783
|
+
var col = Math.ceil(width / size);
|
|
4784
|
+
console.log('re render', width, height, row, col);
|
|
4785
|
+
return Array.from(Array(row)).map(function () {
|
|
4786
|
+
return React.createElement("div", {
|
|
4787
|
+
style: {
|
|
4788
|
+
display: 'flex'
|
|
4789
|
+
}
|
|
4790
|
+
}, Array.from(Array(col)).map(function () {
|
|
4791
|
+
var duration = Number((Math.random() * 4).toFixed(1)) + 1;
|
|
4792
|
+
var delay = Number((Math.random() * 4).toFixed(1)) + 2;
|
|
4793
|
+
return React.createElement(LoadingImage, {
|
|
4794
|
+
size: size,
|
|
4795
|
+
duration: duration,
|
|
4796
|
+
delay: delay
|
|
4797
|
+
});
|
|
4798
|
+
}));
|
|
4799
|
+
});
|
|
4800
|
+
}, [width, height]);
|
|
4801
|
+
return React.createElement("div", {
|
|
4802
|
+
ref: function (refs) {
|
|
4803
|
+
setWidth(refs === null || refs === void 0 ? void 0 : refs.offsetWidth);
|
|
4804
|
+
setHeight(refs === null || refs === void 0 ? void 0 : refs.offsetHeight);
|
|
4805
|
+
},
|
|
4806
|
+
style: {
|
|
4807
|
+
width: '100%',
|
|
4808
|
+
height: '100%',
|
|
4809
|
+
overflow: 'hidden'
|
|
4810
|
+
}
|
|
4811
|
+
}, render);
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
function LoadingImage(_a) {
|
|
4815
|
+
var _b = _a.size,
|
|
4816
|
+
size = _b === void 0 ? 256 : _b,
|
|
4817
|
+
_c = _a.duration,
|
|
4818
|
+
duration = _c === void 0 ? 1 : _c,
|
|
4819
|
+
_d = _a.delay,
|
|
4820
|
+
delay = _d === void 0 ? 1 : _d;
|
|
4821
|
+
var scale = 256 / 4000;
|
|
4822
|
+
return React.createElement("svg", {
|
|
4823
|
+
className: cn$1("ani-fade-in"),
|
|
4824
|
+
style: {
|
|
4825
|
+
flex: "0 0 ".concat(size, "px"),
|
|
4826
|
+
opacity: 0,
|
|
4827
|
+
animationDelay: "".concat(delay, "s"),
|
|
4828
|
+
animationDuration: "".concat(duration, "s"),
|
|
4829
|
+
animationFillMode: 'forwards'
|
|
4830
|
+
},
|
|
4831
|
+
width: size,
|
|
4832
|
+
height: size,
|
|
4833
|
+
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
4834
|
+
fill: "none",
|
|
4835
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4836
|
+
}, React.createElement("g", {
|
|
4837
|
+
transform: "scale(".concat(scale, ")"),
|
|
4838
|
+
"clip-path": "url(#clip0_5_701)"
|
|
4839
|
+
}, React.createElement("rect", {
|
|
4840
|
+
width: "4000",
|
|
4841
|
+
height: "4000",
|
|
4842
|
+
transform: "translate(0 4000) rotate(-90)",
|
|
4843
|
+
fill: "#F8F8F8"
|
|
4844
|
+
}), React.createElement("path", {
|
|
4845
|
+
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
4846
|
+
fill: "#E6E6E6"
|
|
4847
|
+
}), React.createElement("path", {
|
|
4848
|
+
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
4849
|
+
fill: "#F6E4DD"
|
|
4850
|
+
}), React.createElement("path", {
|
|
4851
|
+
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
4852
|
+
fill: "#DCEACA"
|
|
4853
|
+
}), React.createElement("path", {
|
|
4854
|
+
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
4855
|
+
fill: "#E6E6E6"
|
|
4856
|
+
}), React.createElement("path", {
|
|
4857
|
+
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
4858
|
+
fill: "#DCEACA"
|
|
4859
|
+
}), React.createElement("path", {
|
|
4860
|
+
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",
|
|
4861
|
+
fill: "#A2CAEE"
|
|
4862
|
+
}), React.createElement("circle", {
|
|
4863
|
+
cx: "958",
|
|
4864
|
+
cy: "3092",
|
|
4865
|
+
r: "95",
|
|
4866
|
+
fill: "#A2CAEE"
|
|
4867
|
+
}), React.createElement("circle", {
|
|
4868
|
+
cx: "1127",
|
|
4869
|
+
cy: "3176",
|
|
4870
|
+
r: "56",
|
|
4871
|
+
fill: "#A2CAEE"
|
|
4872
|
+
}), React.createElement("path", {
|
|
4873
|
+
"fill-rule": "evenodd",
|
|
4874
|
+
"clip-rule": "evenodd",
|
|
4875
|
+
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
4876
|
+
fill: "white"
|
|
4877
|
+
}), React.createElement("path", {
|
|
4878
|
+
"fill-rule": "evenodd",
|
|
4879
|
+
"clip-rule": "evenodd",
|
|
4880
|
+
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",
|
|
4881
|
+
fill: "white"
|
|
4882
|
+
}), React.createElement("path", {
|
|
4883
|
+
"fill-rule": "evenodd",
|
|
4884
|
+
"clip-rule": "evenodd",
|
|
4885
|
+
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
4886
|
+
fill: "#FBEDB1"
|
|
4887
|
+
}), React.createElement("path", {
|
|
4888
|
+
"fill-rule": "evenodd",
|
|
4889
|
+
"clip-rule": "evenodd",
|
|
4890
|
+
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
4891
|
+
fill: "white"
|
|
4892
|
+
}), React.createElement("path", {
|
|
4893
|
+
"fill-rule": "evenodd",
|
|
4894
|
+
"clip-rule": "evenodd",
|
|
4895
|
+
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
4896
|
+
fill: "white"
|
|
4897
|
+
}), React.createElement("path", {
|
|
4898
|
+
"fill-rule": "evenodd",
|
|
4899
|
+
"clip-rule": "evenodd",
|
|
4900
|
+
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
4901
|
+
fill: "white"
|
|
4902
|
+
}), React.createElement("path", {
|
|
4903
|
+
"fill-rule": "evenodd",
|
|
4904
|
+
"clip-rule": "evenodd",
|
|
4905
|
+
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
4906
|
+
fill: "white"
|
|
4907
|
+
}), React.createElement("path", {
|
|
4908
|
+
"fill-rule": "evenodd",
|
|
4909
|
+
"clip-rule": "evenodd",
|
|
4910
|
+
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
4911
|
+
fill: "white"
|
|
4912
|
+
}), React.createElement("path", {
|
|
4913
|
+
"fill-rule": "evenodd",
|
|
4914
|
+
"clip-rule": "evenodd",
|
|
4915
|
+
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
4916
|
+
fill: "white"
|
|
4917
|
+
}), React.createElement("path", {
|
|
4918
|
+
"fill-rule": "evenodd",
|
|
4919
|
+
"clip-rule": "evenodd",
|
|
4920
|
+
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
4921
|
+
fill: "white"
|
|
4922
|
+
}), React.createElement("path", {
|
|
4923
|
+
"fill-rule": "evenodd",
|
|
4924
|
+
"clip-rule": "evenodd",
|
|
4925
|
+
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
4926
|
+
fill: "white"
|
|
4927
|
+
}), React.createElement("path", {
|
|
4928
|
+
"fill-rule": "evenodd",
|
|
4929
|
+
"clip-rule": "evenodd",
|
|
4930
|
+
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",
|
|
4931
|
+
fill: "white"
|
|
4932
|
+
}), React.createElement("path", {
|
|
4933
|
+
"fill-rule": "evenodd",
|
|
4934
|
+
"clip-rule": "evenodd",
|
|
4935
|
+
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
4936
|
+
fill: "white"
|
|
4937
|
+
}), React.createElement("path", {
|
|
4938
|
+
"fill-rule": "evenodd",
|
|
4939
|
+
"clip-rule": "evenodd",
|
|
4940
|
+
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
4941
|
+
fill: "white"
|
|
4942
|
+
}), React.createElement("path", {
|
|
4943
|
+
"fill-rule": "evenodd",
|
|
4944
|
+
"clip-rule": "evenodd",
|
|
4945
|
+
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
4946
|
+
fill: "white"
|
|
4947
|
+
}), React.createElement("path", {
|
|
4948
|
+
"fill-rule": "evenodd",
|
|
4949
|
+
"clip-rule": "evenodd",
|
|
4950
|
+
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",
|
|
4951
|
+
fill: "#FBEDB1"
|
|
4952
|
+
})), React.createElement("defs", null, React.createElement("clipPath", {
|
|
4953
|
+
id: "clip0_5_701"
|
|
4954
|
+
}, React.createElement("rect", {
|
|
4955
|
+
width: "4000",
|
|
4956
|
+
height: "4000",
|
|
4957
|
+
fill: "white",
|
|
4958
|
+
transform: "translate(0 4000) rotate(-90)"
|
|
4959
|
+
}))));
|
|
4960
|
+
}
|
|
3401
4961
|
|
|
3402
4962
|
var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n position: absolute;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
|
|
3403
4963
|
var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
|
|
@@ -3446,6 +5006,14 @@ var getAlignPosition = function (value, align) {
|
|
|
3446
5006
|
|
|
3447
5007
|
throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
|
|
3448
5008
|
};
|
|
5009
|
+
/**
|
|
5010
|
+
* Mint Map 컴포넌트
|
|
5011
|
+
*
|
|
5012
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
5013
|
+
*
|
|
5014
|
+
* @returns {JSX.Element} JSX
|
|
5015
|
+
*/
|
|
5016
|
+
|
|
3449
5017
|
|
|
3450
5018
|
function MapControlWrapper(_a) {
|
|
3451
5019
|
var _b = _a.width,
|
|
@@ -3468,26 +5036,40 @@ function MapControlWrapper(_a) {
|
|
|
3468
5036
|
}, children);
|
|
3469
5037
|
}
|
|
3470
5038
|
|
|
5039
|
+
/**
|
|
5040
|
+
* Mint Map 컴포넌트
|
|
5041
|
+
*
|
|
5042
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
5043
|
+
*
|
|
5044
|
+
* @returns {JSX.Element} JSX
|
|
5045
|
+
*/
|
|
5046
|
+
|
|
3471
5047
|
function MapPolylineWrapper(_a) {
|
|
3472
5048
|
var children = _a.children,
|
|
3473
|
-
options = __rest(_a, ["children"]);
|
|
5049
|
+
options = __rest(_a, ["children"]); //controller
|
|
5050
|
+
|
|
5051
|
+
|
|
5052
|
+
var controller = useMintMapController(); //lifecycle
|
|
3474
5053
|
|
|
3475
|
-
var controller = useMintMapController();
|
|
3476
5054
|
useEffect(function () {
|
|
3477
5055
|
return function () {
|
|
3478
5056
|
if (polylineRef.current) {
|
|
3479
|
-
controller.clearDrawable(polylineRef.current);
|
|
5057
|
+
controller.clearDrawable(polylineRef.current); // console.log('polyline cleared')
|
|
3480
5058
|
}
|
|
3481
5059
|
};
|
|
3482
|
-
}, []);
|
|
5060
|
+
}, []); //create/update object
|
|
5061
|
+
|
|
3483
5062
|
var polylineRef = useRef();
|
|
3484
5063
|
useEffect(function () {
|
|
5064
|
+
//console.log('Polyline useEffect')
|
|
3485
5065
|
if (options) {
|
|
3486
5066
|
if (polylineRef.current) {
|
|
5067
|
+
//console.log('update Polyline', options)
|
|
3487
5068
|
controller.updatePolyline(polylineRef.current, options);
|
|
3488
5069
|
} else {
|
|
3489
5070
|
var polyline = new Polyline(options);
|
|
3490
|
-
polylineRef.current = polyline;
|
|
5071
|
+
polylineRef.current = polyline; //console.log('create Polyline', options)
|
|
5072
|
+
|
|
3491
5073
|
controller.createPolyline(polyline);
|
|
3492
5074
|
}
|
|
3493
5075
|
}
|
|
@@ -3499,10 +5081,19 @@ var console$1 = {
|
|
|
3499
5081
|
log: function () {
|
|
3500
5082
|
}
|
|
3501
5083
|
};
|
|
5084
|
+
/**
|
|
5085
|
+
* Mint Map 컴포넌트
|
|
5086
|
+
*
|
|
5087
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
5088
|
+
*
|
|
5089
|
+
* @returns {JSX.Element} JSX
|
|
5090
|
+
*/
|
|
5091
|
+
|
|
3502
5092
|
function MapCanvasWrapper(_a) {
|
|
3503
5093
|
var children = _a.children;
|
|
3504
5094
|
__rest(_a, ["children"]);
|
|
3505
|
-
|
|
5095
|
+
|
|
5096
|
+
var controller = useMintMapController(); //render switch
|
|
3506
5097
|
|
|
3507
5098
|
var _b = useState(false),
|
|
3508
5099
|
renderFlag = _b[0],
|
|
@@ -3510,18 +5101,28 @@ function MapCanvasWrapper(_a) {
|
|
|
3510
5101
|
|
|
3511
5102
|
var invokeRender = useCallback(function () {
|
|
3512
5103
|
setRenderFlag(!renderFlag);
|
|
3513
|
-
}, []);
|
|
3514
|
-
|
|
3515
|
-
var
|
|
3516
|
-
|
|
3517
|
-
var
|
|
5104
|
+
}, []); //canvas renderer
|
|
5105
|
+
|
|
5106
|
+
var renderer = useRef(); //canvas container ref
|
|
5107
|
+
|
|
5108
|
+
var containerRef = useRef(null); //canvas ref
|
|
5109
|
+
|
|
5110
|
+
var canvasRef = useRef(null); //canvas context
|
|
5111
|
+
|
|
5112
|
+
var contextRef = useRef(); //clear rect
|
|
5113
|
+
|
|
3518
5114
|
var clearRect = useCallback(function () {
|
|
3519
5115
|
if (contextRef.current && canvasRef.current) {
|
|
3520
5116
|
contextRef.current.clearRect(canvasRef.current.width * -1, canvasRef.current.height * -1, canvasRef.current.width * 3, canvasRef.current.height * 3);
|
|
3521
5117
|
}
|
|
3522
5118
|
|
|
3523
5119
|
return true;
|
|
3524
|
-
}, []);
|
|
5120
|
+
}, []); //offset values
|
|
5121
|
+
// const offsetProvider = useRef(new Offset(0, 0))
|
|
5122
|
+
// const prevX = useRef(0)
|
|
5123
|
+
// const prevY = useRef(0)
|
|
5124
|
+
//scaling
|
|
5125
|
+
|
|
3525
5126
|
var scaleCanvas = useCallback(function (containerRef, canvasElement, canvasContext) {
|
|
3526
5127
|
var devicePixelRatio = window.devicePixelRatio;
|
|
3527
5128
|
var width = containerRef.offsetWidth;
|
|
@@ -3531,7 +5132,16 @@ function MapCanvasWrapper(_a) {
|
|
|
3531
5132
|
canvasElement.style.width = "".concat(width, "px");
|
|
3532
5133
|
canvasElement.style.height = "".concat(height, "px");
|
|
3533
5134
|
canvasContext.scale(devicePixelRatio, devicePixelRatio);
|
|
3534
|
-
}, []);
|
|
5135
|
+
}, []); //init transform
|
|
5136
|
+
// const initTransform = useCallback(()=>{
|
|
5137
|
+
// offsetProvider.current.x = 0
|
|
5138
|
+
// offsetProvider.current.y = 0
|
|
5139
|
+
// containerRef.current && (containerRef.current.style.transform = `translate(0px, 0px)`)
|
|
5140
|
+
// console.log('initTransform');
|
|
5141
|
+
// return true
|
|
5142
|
+
// }, [])
|
|
5143
|
+
//parse click param
|
|
5144
|
+
|
|
3535
5145
|
var parseClickParamToPosition = useCallback(function (mapType, e) {
|
|
3536
5146
|
var latlng = e.latlng || e.latLng;
|
|
3537
5147
|
|
|
@@ -3555,15 +5165,17 @@ function MapCanvasWrapper(_a) {
|
|
|
3555
5165
|
}
|
|
3556
5166
|
|
|
3557
5167
|
return clickPosition;
|
|
3558
|
-
}, []);
|
|
5168
|
+
}, []); //box includes
|
|
3559
5169
|
|
|
3560
5170
|
var includes = function (point, targetPoint, width, height) {
|
|
5171
|
+
// console.log('includes', point, targetPoint, width, height);
|
|
3561
5172
|
if (point.x >= targetPoint.x && point.x <= targetPoint.x + width && point.y >= targetPoint.y && point.y <= targetPoint.y + height) {
|
|
3562
5173
|
return true;
|
|
3563
5174
|
}
|
|
3564
5175
|
|
|
3565
5176
|
return false;
|
|
3566
|
-
};
|
|
5177
|
+
}; //process mouse event
|
|
5178
|
+
|
|
3567
5179
|
|
|
3568
5180
|
var processMouseEvent = useCallback(function (clickedOffset, eventName) {
|
|
3569
5181
|
var items = renderItemsOnView.current;
|
|
@@ -3577,9 +5189,10 @@ function MapCanvasWrapper(_a) {
|
|
|
3577
5189
|
|
|
3578
5190
|
if (!event_1) {
|
|
3579
5191
|
continue;
|
|
3580
|
-
}
|
|
5192
|
+
} //includes check
|
|
3581
5193
|
|
|
3582
|
-
|
|
5194
|
+
|
|
5195
|
+
var pos = item.position; // console.log('canvas mouseevent check', pos.offset);
|
|
3583
5196
|
|
|
3584
5197
|
if (pos && !pos.offset) {
|
|
3585
5198
|
pos.offset = controller.positionToOffset(pos);
|
|
@@ -3587,61 +5200,92 @@ function MapCanvasWrapper(_a) {
|
|
|
3587
5200
|
|
|
3588
5201
|
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
3589
5202
|
continue;
|
|
3590
|
-
}
|
|
5203
|
+
} // const propagation =
|
|
5204
|
+
|
|
3591
5205
|
|
|
3592
5206
|
event_1(clickedOffset);
|
|
3593
|
-
hitSet.add(item);
|
|
3594
|
-
|
|
5207
|
+
hitSet.add(item); // if(eventName === 'onMouseOver' || propagation === false){
|
|
5208
|
+
|
|
5209
|
+
break; // }
|
|
3595
5210
|
}
|
|
3596
5211
|
}
|
|
3597
5212
|
|
|
3598
5213
|
return hitSet;
|
|
3599
|
-
}, []);
|
|
5214
|
+
}, []); //initialize
|
|
5215
|
+
|
|
3600
5216
|
useEffect(function () {
|
|
3601
5217
|
var resizeObserver;
|
|
3602
5218
|
|
|
3603
5219
|
if (canvasRef.current && containerRef.current) {
|
|
3604
5220
|
resizeObserver = new ResizeObserver(function (entries) {
|
|
3605
5221
|
var elem = entries[0];
|
|
3606
|
-
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current);
|
|
5222
|
+
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current); // initTransform()
|
|
5223
|
+
|
|
3607
5224
|
renderMain();
|
|
3608
5225
|
});
|
|
3609
5226
|
resizeObserver.observe(containerRef.current);
|
|
3610
5227
|
var map = controller.getMap();
|
|
3611
5228
|
|
|
3612
5229
|
if (map) {
|
|
5230
|
+
// const center = controller.getCenter()
|
|
5231
|
+
// center.offset = controller.positionToOffset(center)
|
|
5232
|
+
// if(center.offset){
|
|
5233
|
+
// prevX.current = center.offset.x
|
|
5234
|
+
// prevY.current = center.offset.y
|
|
5235
|
+
// }
|
|
5236
|
+
//naver 전용 이벤트 'zooming' 일때 캔버스 클리어처리
|
|
5237
|
+
//@ts-ignore
|
|
3613
5238
|
map.addListener('zooming', function () {
|
|
3614
5239
|
clearRect();
|
|
3615
|
-
});
|
|
5240
|
+
}); //kakao 전용 이벤트 'zoom_start' 일때 캔버스 클리어처리
|
|
5241
|
+
//@ts-ignore
|
|
5242
|
+
|
|
3616
5243
|
map.addListener('zoom_start', function () {
|
|
3617
5244
|
clearRect();
|
|
3618
|
-
});
|
|
5245
|
+
}); //@ts-ignore
|
|
5246
|
+
|
|
3619
5247
|
map.addListener('center_changed', function () {
|
|
3620
5248
|
|
|
3621
5249
|
if (containerRef.current) {
|
|
5250
|
+
// const pos = controller.getCenter()
|
|
5251
|
+
// pos.offset = controller.positionToOffset(pos)
|
|
5252
|
+
// const deltaX = prevX.current - pos.offset.x
|
|
5253
|
+
// const deltaY = prevY.current - pos.offset.y
|
|
5254
|
+
// offsetProvider.current.x += deltaX
|
|
5255
|
+
// offsetProvider.current.y += deltaY
|
|
5256
|
+
// prevX.current = pos.offset.x
|
|
5257
|
+
// prevY.current = pos.offset.y
|
|
5258
|
+
// containerRef.current.style.transform = `translate(${offsetProvider.current.x}px, ${offsetProvider.current.y}px)`
|
|
3622
5259
|
containerRef.current.style.visibility = 'hidden';
|
|
3623
5260
|
}
|
|
3624
|
-
});
|
|
5261
|
+
}); //@ts-ignore
|
|
5262
|
+
|
|
3625
5263
|
map.addListener('idle', function () {
|
|
3626
5264
|
|
|
3627
5265
|
if (containerRef.current) {
|
|
3628
5266
|
containerRef.current.style.visibility = '';
|
|
3629
5267
|
}
|
|
3630
5268
|
|
|
3631
|
-
clearRect();
|
|
5269
|
+
clearRect(); // contextRef.current?.translate(offsetProvider.current.x, offsetProvider.current.y)
|
|
5270
|
+
// initTransform()
|
|
5271
|
+
|
|
3632
5272
|
invokeRender();
|
|
3633
|
-
});
|
|
5273
|
+
}); //@ts-ignore
|
|
5274
|
+
|
|
3634
5275
|
map.addListener('mousemove', function (e) {
|
|
3635
5276
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3636
|
-
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3637
|
-
|
|
5277
|
+
var clickedOffset = controller.positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
|
|
5278
|
+
|
|
5279
|
+
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver'); //mouse out 처리
|
|
5280
|
+
|
|
3638
5281
|
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3639
5282
|
if (!hitSet.has(item)) {
|
|
3640
5283
|
item.onMouseOut && item.onMouseOut(clickedOffset);
|
|
3641
5284
|
}
|
|
3642
5285
|
});
|
|
3643
5286
|
renderItemsMouseOverStatus.current = hitSet;
|
|
3644
|
-
});
|
|
5287
|
+
}); //@ts-ignore
|
|
5288
|
+
|
|
3645
5289
|
map.addListener('click', function (e) {
|
|
3646
5290
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3647
5291
|
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
@@ -3660,14 +5304,18 @@ function MapCanvasWrapper(_a) {
|
|
|
3660
5304
|
return function () {
|
|
3661
5305
|
resizeObserver && resizeObserver.disconnect();
|
|
3662
5306
|
};
|
|
3663
|
-
}, []);
|
|
5307
|
+
}, []); //items setting
|
|
5308
|
+
|
|
3664
5309
|
var renderItems = useRef([]);
|
|
3665
5310
|
var renderItemsOnView = useRef([]);
|
|
3666
5311
|
var renderItemsMouseOverStatus = useRef(new Set());
|
|
3667
5312
|
useEffect(function () {
|
|
3668
5313
|
renderItems.current = (Array.isArray(children) ? children : children ? [children] : []).map(function (item) {
|
|
3669
5314
|
return item.props;
|
|
3670
|
-
});
|
|
5315
|
+
}); //draw 를 위한 정렬 조건
|
|
5316
|
+
//1. zIndex 가 있는 것들 끼리 정렬처리
|
|
5317
|
+
//2. zIndex 가 없는 것들은 원래 배열 순서대로
|
|
5318
|
+
|
|
3671
5319
|
var zIndexList = [];
|
|
3672
5320
|
var undefinedList = [];
|
|
3673
5321
|
|
|
@@ -3687,16 +5335,19 @@ function MapCanvasWrapper(_a) {
|
|
|
3687
5335
|
}).forEach(function (item) {
|
|
3688
5336
|
renderItems.current.push(item);
|
|
3689
5337
|
});
|
|
3690
|
-
}, [children]);
|
|
5338
|
+
}, [children]); //rendering main
|
|
5339
|
+
|
|
3691
5340
|
var renderMain = useCallback(function () {
|
|
3692
5341
|
var ctx = contextRef.current;
|
|
3693
5342
|
var container = containerRef.current;
|
|
3694
5343
|
|
|
3695
5344
|
if (!ctx || !container || !renderer.current) {
|
|
3696
5345
|
return;
|
|
3697
|
-
}
|
|
5346
|
+
} //all clear
|
|
5347
|
+
|
|
5348
|
+
|
|
5349
|
+
clearRect(); //draw
|
|
3698
5350
|
|
|
3699
|
-
clearRect();
|
|
3700
5351
|
var t = new Date().getTime();
|
|
3701
5352
|
var items = renderItems.current;
|
|
3702
5353
|
renderItemsOnView.current.length = 0;
|
|
@@ -3706,7 +5357,8 @@ function MapCanvasWrapper(_a) {
|
|
|
3706
5357
|
var item = items_1[_i];
|
|
3707
5358
|
|
|
3708
5359
|
if (item.visible === undefined || item.visible) {
|
|
3709
|
-
var pos = item.position;
|
|
5360
|
+
var pos = item.position; //위치 변환
|
|
5361
|
+
|
|
3710
5362
|
pos.offset = controller.positionToOffset(pos);
|
|
3711
5363
|
|
|
3712
5364
|
if (item.anchor) {
|
|
@@ -3718,7 +5370,8 @@ function MapCanvasWrapper(_a) {
|
|
|
3718
5370
|
|
|
3719
5371
|
if (pos.offset.x < 0 || pos.offset.x > container.offsetWidth || pos.offset.y < 0 || pos.offset.y > container.offsetHeight) {
|
|
3720
5372
|
continue;
|
|
3721
|
-
}
|
|
5373
|
+
} //그리기
|
|
5374
|
+
|
|
3722
5375
|
|
|
3723
5376
|
item.renderer(renderer.current, pos.offset, item.payload);
|
|
3724
5377
|
renderItemsOnView.current.push(item);
|
|
@@ -3732,7 +5385,8 @@ function MapCanvasWrapper(_a) {
|
|
|
3732
5385
|
}
|
|
3733
5386
|
});
|
|
3734
5387
|
console$1.log("[render ends] ".concat(new Date().getTime() - t, " ms"));
|
|
3735
|
-
}, []);
|
|
5388
|
+
}, []); //render!!!
|
|
5389
|
+
|
|
3736
5390
|
renderMain();
|
|
3737
5391
|
return React.createElement("div", {
|
|
3738
5392
|
ref: containerRef,
|
|
@@ -3751,8 +5405,17 @@ function MapCanvasWrapper(_a) {
|
|
|
3751
5405
|
}), renderFlag && React.createElement(React.Fragment, null));
|
|
3752
5406
|
}
|
|
3753
5407
|
|
|
5408
|
+
/**
|
|
5409
|
+
* Mint Map 컴포넌트
|
|
5410
|
+
*
|
|
5411
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
5412
|
+
*
|
|
5413
|
+
* @returns {JSX.Element} JSX
|
|
5414
|
+
*/
|
|
5415
|
+
|
|
3754
5416
|
function MapCanvasMarkerWrapper(_props) {
|
|
5417
|
+
//실제 렌더링처리는 MapCanvasWrapper 에서...
|
|
3755
5418
|
return React.createElement(React.Fragment, null);
|
|
3756
5419
|
}
|
|
3757
5420
|
|
|
3758
|
-
export { AnimationPlayer, Bounds, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, Polyline, Position, getClusterInfo, useMarkerMoving, useMintMapController, waiting };
|
|
5421
|
+
export { AnimationPlayer, Bounds, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, getClusterInfo, useMarkerMoving, useMintMapController, waiting };
|