@mint-ui/map 0.4.5-beta → 0.4.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +58 -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 +2 -1
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +17 -8
- 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 +39 -34
- package/dist/components/mint-map/core/util/calculate.js +65 -26
- 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 +31 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +54 -25
- 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 +42 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +90 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +48 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +147 -65
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +45 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +136 -49
- 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/MapTypes.d.ts +59 -0
- package/dist/components/mint-map/types/MapTypes.js +151 -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 +5 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +1505 -946
- package/dist/index.js +12 -9
- package/dist/index.umd.js +1505 -946
- package/package.json +77 -77
- package/test.ts +0 -7
package/dist/index.umd.js
CHANGED
|
@@ -14,106 +14,9 @@
|
|
|
14
14
|
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-"};
|
|
15
15
|
styleInject__default["default"](css_248z$2);
|
|
16
16
|
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children = _a.children;
|
|
21
|
-
return React__default["default"].createElement(MintMapControllerContext.Provider, {
|
|
22
|
-
value: controller
|
|
23
|
-
}, children);
|
|
24
|
-
}
|
|
25
|
-
function useMintMapController() {
|
|
26
|
-
var controller = React.useContext(MintMapControllerContext);
|
|
27
|
-
|
|
28
|
-
if (controller === null) {
|
|
29
|
-
throw new Error('controller is not initialized');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return controller;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
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}";
|
|
36
|
-
var styles$1 = {"mint-map-root":"MintMapCore-module_mint-map-root__SMfwn","mint-map-container":"MintMapCore-module_mint-map-container__8MIIr"};
|
|
37
|
-
styleInject__default["default"](css_248z$1);
|
|
38
|
-
|
|
39
|
-
var cn$2 = classNames__default["default"].bind(styles$1);
|
|
40
|
-
function MintMapCore(_a) {
|
|
41
|
-
var _this = this;
|
|
42
|
-
|
|
43
|
-
var onLoad = _a.onLoad,
|
|
44
|
-
_b = _a.visible,
|
|
45
|
-
visible = _b === void 0 ? true : _b,
|
|
46
|
-
zoomLevel = _a.zoomLevel,
|
|
47
|
-
center = _a.center,
|
|
48
|
-
_c = _a.centerMoveWithPanning,
|
|
49
|
-
centerMoveWithPanning = _c === void 0 ? false : _c,
|
|
50
|
-
children = _a.children;
|
|
51
|
-
var controller = useMintMapController();
|
|
52
|
-
var elementRef = React.useRef(null);
|
|
53
|
-
|
|
54
|
-
var _d = React.useState(false),
|
|
55
|
-
mapInitialized = _d[0],
|
|
56
|
-
setMapInitialized = _d[1];
|
|
57
|
-
|
|
58
|
-
React.useEffect(function () {
|
|
59
|
-
(function () {
|
|
60
|
-
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
61
|
-
var map_1;
|
|
62
|
-
return tslib.__generator(this, function (_a) {
|
|
63
|
-
switch (_a.label) {
|
|
64
|
-
case 0:
|
|
65
|
-
if (!(elementRef && elementRef.current)) return [3, 2];
|
|
66
|
-
return [4, controller.initializingMap(elementRef.current)];
|
|
67
|
-
|
|
68
|
-
case 1:
|
|
69
|
-
map_1 = _a.sent();
|
|
70
|
-
setTimeout(function () {
|
|
71
|
-
setMapInitialized(true);
|
|
72
|
-
onLoad && onLoad(map_1, controller);
|
|
73
|
-
}, 100);
|
|
74
|
-
_a.label = 2;
|
|
75
|
-
|
|
76
|
-
case 2:
|
|
77
|
-
return [2];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
})();
|
|
82
|
-
|
|
83
|
-
return function () {
|
|
84
|
-
controller && controller.destroyMap();
|
|
85
|
-
};
|
|
86
|
-
}, [controller, elementRef]);
|
|
87
|
-
React.useEffect(function () {
|
|
88
|
-
if (zoomLevel && controller && mapInitialized) {
|
|
89
|
-
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
90
|
-
|
|
91
|
-
if (prevZoomLevel !== zoomLevel) {
|
|
92
|
-
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, [zoomLevel]);
|
|
96
|
-
React.useEffect(function () {
|
|
97
|
-
if (center && controller && mapInitialized) {
|
|
98
|
-
var prevCenter = controller.getCenter();
|
|
99
|
-
|
|
100
|
-
if (!Position.equals(prevCenter, center)) {
|
|
101
|
-
centerMoveWithPanning ? controller === null || controller === void 0 ? void 0 : controller.panningTo(center) : controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, [center]);
|
|
105
|
-
return React__default["default"].createElement("div", {
|
|
106
|
-
className: cn$2('mint-map-root')
|
|
107
|
-
}, mapInitialized && children, React__default["default"].createElement("div", {
|
|
108
|
-
className: cn$2('mint-map-container'),
|
|
109
|
-
style: {
|
|
110
|
-
visibility: visible ? 'inherit' : 'hidden'
|
|
111
|
-
},
|
|
112
|
-
ref: elementRef
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var LinePoints = function () {
|
|
17
|
+
var LinePoints =
|
|
18
|
+
/** @class */
|
|
19
|
+
function () {
|
|
117
20
|
function LinePoints(x1, y1, x2, y2) {
|
|
118
21
|
this.x1 = x1;
|
|
119
22
|
this.y1 = y1;
|
|
@@ -124,7 +27,20 @@
|
|
|
124
27
|
return LinePoints;
|
|
125
28
|
}();
|
|
126
29
|
|
|
127
|
-
var
|
|
30
|
+
var PositionMirror =
|
|
31
|
+
/** @class */
|
|
32
|
+
function () {
|
|
33
|
+
function PositionMirror(lat, lng) {
|
|
34
|
+
this.lat = lat;
|
|
35
|
+
this.lng = lng;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return PositionMirror;
|
|
39
|
+
}();
|
|
40
|
+
|
|
41
|
+
var PolygonCalculator =
|
|
42
|
+
/** @class */
|
|
43
|
+
function () {
|
|
128
44
|
function PolygonCalculator() {}
|
|
129
45
|
|
|
130
46
|
PolygonCalculator.getCenter = function (positions) {
|
|
@@ -148,10 +64,11 @@
|
|
|
148
64
|
if (minY === undefined || pos.lng < minY) {
|
|
149
65
|
minY = pos.lng;
|
|
150
66
|
}
|
|
151
|
-
}
|
|
67
|
+
} //console.log('center min max => ', maxX, minX, maxY, minY)
|
|
68
|
+
|
|
152
69
|
|
|
153
70
|
if (maxX && minX && maxY && minY) {
|
|
154
|
-
return new
|
|
71
|
+
return new PositionMirror(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
|
|
155
72
|
}
|
|
156
73
|
|
|
157
74
|
throw new Error('Calculate Center Error!!!');
|
|
@@ -184,9 +101,10 @@
|
|
|
184
101
|
var lines = this.convertPolygonToLinePoints(polygon);
|
|
185
102
|
|
|
186
103
|
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
|
187
|
-
var target = targets_1[_i];
|
|
188
|
-
|
|
189
|
-
var
|
|
104
|
+
var target = targets_1[_i]; //x 축으로 긴 직선과 폴리곤 path 와의 교차 수 비교
|
|
105
|
+
|
|
106
|
+
var tempLine = this.convertPositionToPoints(target, new PositionMirror(target.lat, maxX));
|
|
107
|
+
var crossPoints = this.getCrossPointAll(lines, tempLine); // console.log('crossPoints',crossPoints);
|
|
190
108
|
|
|
191
109
|
if (crossPoints.length > 0 && crossPoints.length % 2 != 0) {
|
|
192
110
|
result.push(target);
|
|
@@ -208,16 +126,20 @@
|
|
|
208
126
|
|
|
209
127
|
PolygonCalculator.convertPositionToPoints = function (pos1, pos2) {
|
|
210
128
|
return new LinePoints(pos1.lng, pos1.lat, pos2.lng, pos2.lat);
|
|
211
|
-
};
|
|
129
|
+
}; //두 직선의 교점 구하기
|
|
130
|
+
|
|
212
131
|
|
|
213
132
|
PolygonCalculator.getCrossPoint = function (sr, tr) {
|
|
214
|
-
var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2);
|
|
133
|
+
var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2); //분모로 사용됨
|
|
134
|
+
// p1 ==0 이면 평행선 또는 일치 이므로 제외(분모)
|
|
215
135
|
|
|
216
136
|
if (p1 != 0) {
|
|
217
137
|
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;
|
|
218
138
|
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;
|
|
219
139
|
|
|
220
|
-
if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0
|
|
140
|
+
if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0 //교점이 1선분 위에 있고
|
|
141
|
+
&& this.toFixedPosition((x - tr.x1) * (x - tr.x2)) <= 0 && this.toFixedPosition((y - tr.y1) * (y - tr.y2)) <= 0 //교점이 2선분 위에 있을경우
|
|
142
|
+
) {
|
|
221
143
|
return {
|
|
222
144
|
x: x,
|
|
223
145
|
y: y
|
|
@@ -247,7 +169,7 @@
|
|
|
247
169
|
|
|
248
170
|
PolygonCalculator.findCrossPoint = function (sr, tr) {
|
|
249
171
|
for (var _i = 0, sr_2 = sr; _i < sr_2.length; _i++) {
|
|
250
|
-
var tmp = sr_2[_i];
|
|
172
|
+
var tmp = sr_2[_i]; //교점이 있으면 true
|
|
251
173
|
|
|
252
174
|
if (this.getCrossPoint(tmp, tr)) {
|
|
253
175
|
return true;
|
|
@@ -260,7 +182,9 @@
|
|
|
260
182
|
return PolygonCalculator;
|
|
261
183
|
}();
|
|
262
184
|
|
|
263
|
-
var GeoCalulator =
|
|
185
|
+
var GeoCalulator =
|
|
186
|
+
/** @class */
|
|
187
|
+
function () {
|
|
264
188
|
function GeoCalulator() {}
|
|
265
189
|
|
|
266
190
|
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
@@ -268,7 +192,8 @@
|
|
|
268
192
|
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
269
193
|
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);
|
|
270
194
|
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
271
|
-
var d = this.EARTH_RADIUS * c;
|
|
195
|
+
var d = this.EARTH_RADIUS * c; // Distance in km
|
|
196
|
+
|
|
272
197
|
return d;
|
|
273
198
|
};
|
|
274
199
|
|
|
@@ -286,178 +211,480 @@
|
|
|
286
211
|
prevPos2 = context.prevPos2,
|
|
287
212
|
velocityKmh = context.velocityKmh,
|
|
288
213
|
prevVelocityKmh = context.prevVelocityKmh,
|
|
289
|
-
elapsedTimeMs = context.elapsedTimeMs;
|
|
214
|
+
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
215
|
+
//총 가야할 거리 (km)
|
|
290
216
|
|
|
291
217
|
if (pos2 !== prevPos2) {
|
|
218
|
+
//목표가 바뀌면 거리 및 비율 재계산
|
|
292
219
|
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
293
220
|
context.currDistance = 0;
|
|
294
221
|
context.prevPos2 = pos2;
|
|
295
222
|
}
|
|
296
223
|
|
|
297
|
-
var totalDistance = context.totalDistance;
|
|
224
|
+
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
225
|
+
//ms 속으로 환산
|
|
298
226
|
|
|
299
227
|
if (velocityKmh !== prevVelocityKmh) {
|
|
228
|
+
//속도가 바뀌면 재계산
|
|
300
229
|
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
301
230
|
context.prevVelocityKmh = velocityKmh;
|
|
302
231
|
}
|
|
303
232
|
|
|
304
|
-
var vPerMs = context.vPerMs;
|
|
305
|
-
|
|
233
|
+
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
234
|
+
//실제 가는 거리 계산
|
|
235
|
+
|
|
236
|
+
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
237
|
+
//목표점까지 이동 후에도 남는 거리
|
|
238
|
+
|
|
306
239
|
context.currDistance = nextDistance;
|
|
307
240
|
|
|
308
241
|
if (totalDistance < context.currDistance) {
|
|
242
|
+
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
309
243
|
context.distanceRemain = context.currDistance - totalDistance;
|
|
310
244
|
context.nextPos = pos2;
|
|
311
245
|
return context;
|
|
312
246
|
} else {
|
|
313
247
|
context.distanceRemain = 0;
|
|
314
|
-
}
|
|
248
|
+
} //각 축으로 나가야할 비율
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
252
|
+
//방향값 체크
|
|
315
253
|
|
|
316
|
-
var ratio = nextDistance / totalDistance;
|
|
317
254
|
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
318
|
-
var lngCalib = pos2.lng > pos1.lng ? 1 : -1;
|
|
319
|
-
|
|
255
|
+
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
256
|
+
|
|
257
|
+
var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
320
258
|
|
|
321
259
|
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)) {
|
|
322
260
|
newPos = pos2;
|
|
323
|
-
}
|
|
261
|
+
} // console.log('newPos', newPos);
|
|
262
|
+
//console.log('==============================================================\n');
|
|
263
|
+
|
|
324
264
|
|
|
325
265
|
context.nextPos = newPos;
|
|
326
266
|
return context;
|
|
327
267
|
};
|
|
328
268
|
|
|
329
|
-
GeoCalulator.EARTH_RADIUS = 6371;
|
|
330
|
-
|
|
269
|
+
GeoCalulator.EARTH_RADIUS = 6371; //in km (6,371.230 km)
|
|
270
|
+
|
|
271
|
+
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / (110 * 1000); //위도 기준 1도는 110km
|
|
272
|
+
|
|
331
273
|
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
332
274
|
return GeoCalulator;
|
|
333
275
|
}();
|
|
334
276
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
277
|
+
/**
|
|
278
|
+
* 좌표값
|
|
279
|
+
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
var Position =
|
|
283
|
+
/** @class */
|
|
284
|
+
function () {
|
|
285
|
+
function Position(lat, lng) {
|
|
286
|
+
/**
|
|
287
|
+
* 위도
|
|
288
|
+
* @description 위도(latitude)
|
|
289
|
+
*/
|
|
290
|
+
this.lat = 0;
|
|
291
|
+
/**
|
|
292
|
+
* 경도
|
|
293
|
+
* @description 경도(longitude)
|
|
294
|
+
*/
|
|
295
|
+
|
|
296
|
+
this.lng = 0;
|
|
297
|
+
this.lat = lat;
|
|
298
|
+
this.lng = lng;
|
|
341
299
|
}
|
|
342
300
|
|
|
343
|
-
|
|
344
|
-
return
|
|
301
|
+
Position.equals = function (pos1, pos2) {
|
|
302
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
345
303
|
};
|
|
346
304
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
};
|
|
305
|
+
return Position;
|
|
306
|
+
}();
|
|
350
307
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
var lng = Math.abs(maxLng - minLng);
|
|
359
|
-
var x = w * (position.lng - minLng) / lng;
|
|
360
|
-
var maxLat = bounds.ne.lat;
|
|
361
|
-
var minLat = bounds.sw.lat;
|
|
362
|
-
var lat = Math.abs(maxLat - minLat);
|
|
363
|
-
var y = h * (maxLat - position.lat) / lat;
|
|
364
|
-
return new Offset(x, y);
|
|
365
|
-
};
|
|
308
|
+
var Bounds =
|
|
309
|
+
/** @class */
|
|
310
|
+
function () {
|
|
311
|
+
function Bounds(nw, se, ne, sw) {
|
|
312
|
+
if (!(nw && se || ne && sw)) {
|
|
313
|
+
throw new Error('nw/se or ne/sw needed');
|
|
314
|
+
} //@ts-ignore
|
|
366
315
|
|
|
367
|
-
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
368
|
-
var div = this.mapDivElement;
|
|
369
|
-
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
370
|
-
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
371
|
-
var bounds = this.getCurrBounds();
|
|
372
|
-
var maxLng = bounds.ne.lng;
|
|
373
|
-
var minLng = bounds.sw.lng;
|
|
374
|
-
var lng = Math.abs(maxLng - minLng);
|
|
375
|
-
var lngVal = offset.x * lng / w + minLng;
|
|
376
|
-
var maxLat = bounds.ne.lat;
|
|
377
|
-
var minLat = bounds.sw.lat;
|
|
378
|
-
var lat = Math.abs(maxLat - minLat);
|
|
379
|
-
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
380
|
-
return new Position(latVal, lngVal);
|
|
381
|
-
};
|
|
382
316
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (checkLoaded()) {
|
|
388
|
-
resolve(false);
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
317
|
+
this.nw = nw;
|
|
318
|
+
this.se = se;
|
|
319
|
+
this.ne = ne;
|
|
320
|
+
this.sw = sw;
|
|
391
321
|
|
|
392
|
-
|
|
322
|
+
if (nw && se) {
|
|
323
|
+
this.covertNWSEtoNESW(nw, se);
|
|
324
|
+
} else if (ne && sw) {
|
|
325
|
+
this.covertNESWtoNWSE(ne, sw);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
393
328
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
});
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
329
|
+
Bounds.fromNWSE = function (nw, se) {
|
|
330
|
+
return new Bounds(nw, se, undefined, undefined);
|
|
331
|
+
};
|
|
400
332
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
script.async = true;
|
|
404
|
-
script.defer = true;
|
|
405
|
-
id && (script.id = id);
|
|
406
|
-
script.addEventListener('load', function () {
|
|
407
|
-
resolve(true);
|
|
408
|
-
});
|
|
409
|
-
document.body.appendChild(script);
|
|
410
|
-
})];
|
|
411
|
-
});
|
|
412
|
-
});
|
|
333
|
+
Bounds.fromNESW = function (ne, sw) {
|
|
334
|
+
return new Bounds(undefined, undefined, ne, sw);
|
|
413
335
|
};
|
|
414
336
|
|
|
415
|
-
|
|
416
|
-
|
|
337
|
+
Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
|
|
338
|
+
this.ne = new Position(nw.lat, se.lng);
|
|
339
|
+
this.sw = new Position(se.lat, nw.lng);
|
|
417
340
|
};
|
|
418
341
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
value = _a[1];
|
|
423
|
-
var temp = encodeURIComponent(Array.isArray(value) ? value.join(',') : value);
|
|
424
|
-
return "".concat(key, "=").concat(temp);
|
|
425
|
-
}).join('&');
|
|
426
|
-
return "".concat(baseUrl, "?").concat(params);
|
|
342
|
+
Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
|
|
343
|
+
this.nw = new Position(ne.lat, sw.lng);
|
|
344
|
+
this.se = new Position(sw.lat, ne.lng);
|
|
427
345
|
};
|
|
428
346
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
347
|
+
Bounds.prototype.getCenter = function () {
|
|
348
|
+
return new Position(this.se.lat + (this.nw.lat - this.se.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
|
|
349
|
+
};
|
|
432
350
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
} else {
|
|
436
|
-
this.processedTime = time;
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
351
|
+
Bounds.prototype.includesPosition = function (pos) {
|
|
352
|
+
return this.nw.lng < pos.lng && this.se.lng > pos.lng && this.se.lat < pos.lat && this.nw.lat > pos.lat;
|
|
439
353
|
};
|
|
440
354
|
|
|
441
|
-
|
|
442
|
-
var
|
|
355
|
+
Bounds.prototype.getIncludedPositions = function (positions) {
|
|
356
|
+
var result = [];
|
|
443
357
|
|
|
444
|
-
|
|
445
|
-
var
|
|
358
|
+
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
359
|
+
var pos = positions_1[_i];
|
|
446
360
|
|
|
447
|
-
if (
|
|
448
|
-
|
|
361
|
+
if (this.includesPosition(pos)) {
|
|
362
|
+
result.push(pos);
|
|
449
363
|
}
|
|
450
364
|
}
|
|
451
365
|
|
|
452
|
-
|
|
366
|
+
return result;
|
|
453
367
|
};
|
|
454
368
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
369
|
+
Bounds.prototype.includes = function (positions) {
|
|
370
|
+
positions = Array.isArray(positions) ? positions : [positions];
|
|
371
|
+
|
|
372
|
+
for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
|
|
373
|
+
var pos = positions_2[_i];
|
|
374
|
+
|
|
375
|
+
if (!this.includesPosition(pos)) {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return true;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
Bounds.prototype.includesOnlyOnePoint = function (positions) {
|
|
384
|
+
for (var _i = 0, positions_3 = positions; _i < positions_3.length; _i++) {
|
|
385
|
+
var pos = positions_3[_i];
|
|
386
|
+
|
|
387
|
+
if (this.includesPosition(pos)) {
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return false;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
Bounds.prototype.intersects = function (positions) {
|
|
396
|
+
return PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
return Bounds;
|
|
400
|
+
}();
|
|
401
|
+
/**
|
|
402
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
var Offset =
|
|
406
|
+
/** @class */
|
|
407
|
+
function () {
|
|
408
|
+
/**
|
|
409
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
410
|
+
*/
|
|
411
|
+
function Offset(x, y) {
|
|
412
|
+
this.x = x;
|
|
413
|
+
this.y = y;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return Offset;
|
|
417
|
+
}();
|
|
418
|
+
|
|
419
|
+
var MintMapControllerContext = React.createContext(null);
|
|
420
|
+
function MintMapProvider(_a) {
|
|
421
|
+
var controller = _a.controller,
|
|
422
|
+
children = _a.children;
|
|
423
|
+
return React__default["default"].createElement(MintMapControllerContext.Provider, {
|
|
424
|
+
value: controller
|
|
425
|
+
}, children);
|
|
426
|
+
}
|
|
427
|
+
function useMintMapController() {
|
|
428
|
+
var controller = React.useContext(MintMapControllerContext);
|
|
429
|
+
|
|
430
|
+
if (controller === null) {
|
|
431
|
+
throw new Error('controller is not initialized');
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return controller;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
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}";
|
|
438
|
+
var styles$1 = {"mint-map-root":"MintMapCore-module_mint-map-root__SMfwn","mint-map-container":"MintMapCore-module_mint-map-container__8MIIr"};
|
|
439
|
+
styleInject__default["default"](css_248z$1);
|
|
440
|
+
|
|
441
|
+
var cn$3 = classNames__default["default"].bind(styles$1);
|
|
442
|
+
function MintMapCore(_a) {
|
|
443
|
+
var _this = this;
|
|
444
|
+
|
|
445
|
+
var onLoad = _a.onLoad,
|
|
446
|
+
_b = _a.visible,
|
|
447
|
+
visible = _b === void 0 ? true : _b,
|
|
448
|
+
zoomLevel = _a.zoomLevel,
|
|
449
|
+
center = _a.center,
|
|
450
|
+
_c = _a.centerMoveWithPanning,
|
|
451
|
+
centerMoveWithPanning = _c === void 0 ? false : _c,
|
|
452
|
+
children = _a.children; //controller
|
|
453
|
+
|
|
454
|
+
var controller = useMintMapController(); //맵 초기화
|
|
455
|
+
|
|
456
|
+
var elementRef = React.useRef(null);
|
|
457
|
+
|
|
458
|
+
var _d = React.useState(false),
|
|
459
|
+
mapInitialized = _d[0],
|
|
460
|
+
setMapInitialized = _d[1];
|
|
461
|
+
|
|
462
|
+
React.useEffect(function () {
|
|
463
|
+
(function () {
|
|
464
|
+
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
465
|
+
var map_1;
|
|
466
|
+
return tslib.__generator(this, function (_a) {
|
|
467
|
+
switch (_a.label) {
|
|
468
|
+
case 0:
|
|
469
|
+
if (!(elementRef && elementRef.current)) return [3
|
|
470
|
+
/*break*/
|
|
471
|
+
, 2];
|
|
472
|
+
return [4
|
|
473
|
+
/*yield*/
|
|
474
|
+
, controller.initializingMap(elementRef.current) //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
475
|
+
];
|
|
476
|
+
|
|
477
|
+
case 1:
|
|
478
|
+
map_1 = _a.sent(); //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
|
|
479
|
+
|
|
480
|
+
setTimeout(function () {
|
|
481
|
+
setMapInitialized(true);
|
|
482
|
+
onLoad && onLoad(map_1, controller);
|
|
483
|
+
}, 100);
|
|
484
|
+
_a.label = 2;
|
|
485
|
+
|
|
486
|
+
case 2:
|
|
487
|
+
return [2
|
|
488
|
+
/*return*/
|
|
489
|
+
];
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
})();
|
|
494
|
+
|
|
495
|
+
return function () {
|
|
496
|
+
controller && controller.destroyMap();
|
|
497
|
+
};
|
|
498
|
+
}, [controller, elementRef]); //줌레벨
|
|
499
|
+
|
|
500
|
+
React.useEffect(function () {
|
|
501
|
+
if (zoomLevel && controller && mapInitialized) {
|
|
502
|
+
var prevZoomLevel = controller === null || controller === void 0 ? void 0 : controller.getZoomLevel();
|
|
503
|
+
|
|
504
|
+
if (prevZoomLevel !== zoomLevel) {
|
|
505
|
+
controller === null || controller === void 0 ? void 0 : controller.setZoomLevel(zoomLevel);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}, [zoomLevel]); //센터
|
|
509
|
+
|
|
510
|
+
React.useEffect(function () {
|
|
511
|
+
if (center && controller && mapInitialized) {
|
|
512
|
+
var prevCenter = controller.getCenter();
|
|
513
|
+
|
|
514
|
+
if (!Position.equals(prevCenter, center)) {
|
|
515
|
+
centerMoveWithPanning ? controller === null || controller === void 0 ? void 0 : controller.panningTo(center) : controller === null || controller === void 0 ? void 0 : controller.setCenter(center);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}, [center]);
|
|
519
|
+
return React__default["default"].createElement("div", {
|
|
520
|
+
className: cn$3('mint-map-root')
|
|
521
|
+
}, mapInitialized && children, React__default["default"].createElement("div", {
|
|
522
|
+
className: cn$3('mint-map-container'),
|
|
523
|
+
style: {
|
|
524
|
+
visibility: visible ? 'inherit' : 'hidden'
|
|
525
|
+
},
|
|
526
|
+
ref: elementRef
|
|
527
|
+
}));
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
var MintMapController =
|
|
531
|
+
/** @class */
|
|
532
|
+
function () {
|
|
533
|
+
//constructor
|
|
534
|
+
function MintMapController(props) {
|
|
535
|
+
this.mapApiLoaded = false;
|
|
536
|
+
this.mapInitialized = false;
|
|
537
|
+
this.processedTime = 0; //props
|
|
538
|
+
|
|
539
|
+
this.mapProps = props;
|
|
540
|
+
} //기본 기능
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
MintMapController.prototype.getMap = function () {
|
|
544
|
+
return this.map;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
MintMapController.prototype.getMapType = function () {
|
|
548
|
+
return this.type;
|
|
549
|
+
}; //기본 기능 - 좌표 변환
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
MintMapController.prototype.positionToOffset = function (position) {
|
|
553
|
+
var div = this.mapDivElement;
|
|
554
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
555
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
556
|
+
var bounds = this.getCurrBounds();
|
|
557
|
+
var maxLng = bounds.ne.lng;
|
|
558
|
+
var minLng = bounds.sw.lng;
|
|
559
|
+
var lng = Math.abs(maxLng - minLng);
|
|
560
|
+
var x = w * (position.lng - minLng) / lng;
|
|
561
|
+
var maxLat = bounds.ne.lat;
|
|
562
|
+
var minLat = bounds.sw.lat;
|
|
563
|
+
var lat = Math.abs(maxLat - minLat);
|
|
564
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
565
|
+
return new Offset(x, y);
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
569
|
+
var div = this.mapDivElement;
|
|
570
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
571
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
572
|
+
var bounds = this.getCurrBounds();
|
|
573
|
+
var maxLng = bounds.ne.lng;
|
|
574
|
+
var minLng = bounds.sw.lng;
|
|
575
|
+
var lng = Math.abs(maxLng - minLng); //const x = w * (position.lng - minLng) / lng
|
|
576
|
+
|
|
577
|
+
var lngVal = offset.x * lng / w + minLng;
|
|
578
|
+
var maxLat = bounds.ne.lat;
|
|
579
|
+
var minLat = bounds.sw.lat;
|
|
580
|
+
var lat = Math.abs(maxLat - minLat); //const y = h * (maxLat - position.lat) / lat
|
|
581
|
+
|
|
582
|
+
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
583
|
+
return new Position(latVal, lngVal);
|
|
584
|
+
}; //스크립트 로드
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
MintMapController.prototype.loadScript = function (url, id, checkLoaded) {
|
|
588
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
589
|
+
return tslib.__generator(this, function (_a) {
|
|
590
|
+
//boolean -> script 로드 후 callback 실행 여부
|
|
591
|
+
//** callback 실행이 여기서 안된 경우는 바깥에서 해줘야한다.
|
|
592
|
+
return [2
|
|
593
|
+
/*return*/
|
|
594
|
+
, new Promise(function (resolve) {
|
|
595
|
+
//이미 로드되어 있으면 종료
|
|
596
|
+
if (checkLoaded()) {
|
|
597
|
+
resolve(false);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
var prevElement = id ? document.getElementById(id) : undefined; //기존 스크립트 로드 정보가 있으면
|
|
602
|
+
|
|
603
|
+
if (prevElement) {
|
|
604
|
+
// console.log(`already loaded script => ${id}`)
|
|
605
|
+
//로드 되어 있지 않으면 스크립트 load 이벤트 끼워넣기
|
|
606
|
+
prevElement.addEventListener('load', function () {
|
|
607
|
+
// console.log('script loaded!!!')
|
|
608
|
+
resolve(false);
|
|
609
|
+
});
|
|
610
|
+
return;
|
|
611
|
+
} //스크립트 로드 처리
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
var script = document.createElement('script');
|
|
615
|
+
script.src = url;
|
|
616
|
+
script.async = true;
|
|
617
|
+
script.defer = true;
|
|
618
|
+
id && (script.id = id);
|
|
619
|
+
script.addEventListener('load', function () {
|
|
620
|
+
resolve(true);
|
|
621
|
+
});
|
|
622
|
+
document.body.appendChild(script);
|
|
623
|
+
})];
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
MintMapController.prototype.getRandomFunctionName = function (prefix) {
|
|
629
|
+
return "".concat(prefix, "_").concat(uuid.v4().replace(/-/g, '_'));
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* URL 빌더 메서드
|
|
633
|
+
*
|
|
634
|
+
* @param {string} baseUrl: 기본 URL
|
|
635
|
+
* @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
|
|
636
|
+
* @returns {string} URL
|
|
637
|
+
*/
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
MintMapController.prototype.buildUrl = function (baseUrl, param) {
|
|
641
|
+
var params = Object.entries(param).map(function (_a) {
|
|
642
|
+
var key = _a[0],
|
|
643
|
+
value = _a[1];
|
|
644
|
+
var temp = encodeURIComponent(Array.isArray(value) ? value.join(',') : value);
|
|
645
|
+
return "".concat(key, "=").concat(temp);
|
|
646
|
+
}).join('&');
|
|
647
|
+
return "".concat(baseUrl, "?").concat(params);
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* 쓰로틀링 처리
|
|
651
|
+
* @returns
|
|
652
|
+
*/
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
MintMapController.prototype.checkBoundsChangeThrottleTime = function () {
|
|
656
|
+
if (!this.mapProps.boundsChangeThrottlingTime) return true; //boundsChangeThrottlingTime 이내의 연속 요청은 제외시킴
|
|
657
|
+
|
|
658
|
+
var time = new Date().getTime();
|
|
659
|
+
|
|
660
|
+
if (this.processedTime > 0 && time - this.processedTime < this.mapProps.boundsChangeThrottlingTime) {
|
|
661
|
+
return false;
|
|
662
|
+
} else {
|
|
663
|
+
this.processedTime = time;
|
|
664
|
+
return true;
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
MintMapController.prototype.getBaseToMapZoom = function (zoomBase) {
|
|
669
|
+
var baseMap = MapZoomInfo.BASE_TO_MAP.get(zoomBase);
|
|
670
|
+
|
|
671
|
+
if (baseMap) {
|
|
672
|
+
var mapZoomInfo = baseMap.get(this.getMapType());
|
|
673
|
+
|
|
674
|
+
if (mapZoomInfo) {
|
|
675
|
+
return mapZoomInfo.level;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
throw new Error("[getBaseToMapZoom][".concat(zoomBase, "] is not valid zoom level"));
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
MintMapController.prototype.getMapToBaseZoom = function (mapZoom) {
|
|
683
|
+
var baseZoom = MapZoomInfo.MAP_TO_BASE.get(this.getMapType() + mapZoom);
|
|
684
|
+
|
|
685
|
+
if (baseZoom) {
|
|
686
|
+
return baseZoom;
|
|
687
|
+
}
|
|
461
688
|
|
|
462
689
|
throw new Error("[getMapToBaseZoom][".concat(mapZoom, "] is not valid zoom level"));
|
|
463
690
|
};
|
|
@@ -465,7 +692,9 @@
|
|
|
465
692
|
return MintMapController;
|
|
466
693
|
}();
|
|
467
694
|
|
|
468
|
-
var MapZoomInfo =
|
|
695
|
+
var MapZoomInfo =
|
|
696
|
+
/** @class */
|
|
697
|
+
function () {
|
|
469
698
|
function MapZoomInfo() {}
|
|
470
699
|
|
|
471
700
|
MapZoomInfo.BASE_TO_MAP = new Map([[1, new Map([['google', {
|
|
@@ -662,16 +891,20 @@
|
|
|
662
891
|
var max;
|
|
663
892
|
return tslib.__generator(this, function (_a) {
|
|
664
893
|
max = (timeoutSeconds || 5) * 1000;
|
|
665
|
-
return [2
|
|
894
|
+
return [2
|
|
895
|
+
/*return*/
|
|
896
|
+
, new Promise(function (resolve) {
|
|
666
897
|
var start = new Date().getTime();
|
|
667
898
|
var inter = setInterval(function () {
|
|
899
|
+
//타임아웃 체크
|
|
668
900
|
var time = new Date().getTime();
|
|
669
901
|
|
|
670
902
|
if (time - start > max) {
|
|
671
903
|
clearInterval(inter);
|
|
672
904
|
resolve(false);
|
|
673
905
|
return;
|
|
674
|
-
}
|
|
906
|
+
} //평가식 체크
|
|
907
|
+
|
|
675
908
|
|
|
676
909
|
if (evaluation()) {
|
|
677
910
|
clearInterval(inter);
|
|
@@ -683,7 +916,9 @@
|
|
|
683
916
|
});
|
|
684
917
|
}
|
|
685
918
|
|
|
686
|
-
var NaverMintMapController =
|
|
919
|
+
var NaverMintMapController =
|
|
920
|
+
/** @class */
|
|
921
|
+
function (_super) {
|
|
687
922
|
tslib.__extends(NaverMintMapController, _super);
|
|
688
923
|
|
|
689
924
|
function NaverMintMapController(props) {
|
|
@@ -698,21 +933,30 @@
|
|
|
698
933
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
699
934
|
_this.dragStartPoint = [0, 0];
|
|
700
935
|
_this.dragged = false;
|
|
701
|
-
return _this;
|
|
936
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
702
937
|
}
|
|
703
938
|
|
|
704
939
|
NaverMintMapController.prototype.initMarkerPool = function () {
|
|
705
940
|
var _this = this;
|
|
706
941
|
|
|
707
|
-
if (!this.mapProps.markerCache) return;
|
|
708
|
-
|
|
942
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
943
|
+
|
|
944
|
+
this.markerPool = new tools.ObjectPool() //logging on
|
|
945
|
+
//.setLog(true)
|
|
946
|
+
//factory 셋팅
|
|
947
|
+
.setFactory(function () {
|
|
948
|
+
//console.log('pool item created');
|
|
709
949
|
return new naver.maps.Marker({
|
|
710
950
|
position: new Position(0, 0),
|
|
711
951
|
map: _this.map || undefined
|
|
712
952
|
});
|
|
713
|
-
})
|
|
953
|
+
}) //clear function 셋팅
|
|
954
|
+
.setClear(function (item) {
|
|
955
|
+
//console.log('pool item cleared');
|
|
714
956
|
item.setMap(null);
|
|
715
|
-
})
|
|
957
|
+
}) //초기 pool 사이즈
|
|
958
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
959
|
+
.setCheckLiveTimeInterval(1000);
|
|
716
960
|
};
|
|
717
961
|
|
|
718
962
|
NaverMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -730,7 +974,7 @@
|
|
|
730
974
|
visible = _e === void 0 ? true : _e,
|
|
731
975
|
_f = _a.editable,
|
|
732
976
|
editable = _f === void 0 ? false : _f,
|
|
733
|
-
event = _a.event;
|
|
977
|
+
event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
734
978
|
|
|
735
979
|
if (this.map && Array.isArray(position)) {
|
|
736
980
|
var path = position.map(function (elem) {
|
|
@@ -744,8 +988,13 @@
|
|
|
744
988
|
strokeOpacity: lineOpacity,
|
|
745
989
|
clickable: true,
|
|
746
990
|
visible: visible
|
|
747
|
-
});
|
|
748
|
-
|
|
991
|
+
}); //@ts-ignore
|
|
992
|
+
|
|
993
|
+
editable && pol_1.setEditable(editable); // if(editable){
|
|
994
|
+
// //@ts-ignore
|
|
995
|
+
// this.drawingManager.addDrawing(pol, naver.maps.drawing.DrawingMode.POLYLINE)
|
|
996
|
+
// }
|
|
997
|
+
|
|
749
998
|
polyline.native = pol_1;
|
|
750
999
|
event && event.forEach(function (handler, key) {
|
|
751
1000
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -756,7 +1005,9 @@
|
|
|
756
1005
|
};
|
|
757
1006
|
|
|
758
1007
|
NaverMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
1008
|
+
//console.log('controller updatePolyline', options);
|
|
759
1009
|
if (polyline && polyline.native && polyline.native instanceof naver.maps.Polyline) {
|
|
1010
|
+
//console.log('controller updatePolyline start');
|
|
760
1011
|
var path = void 0;
|
|
761
1012
|
|
|
762
1013
|
if (Array.isArray(options.position)) {
|
|
@@ -771,7 +1022,8 @@
|
|
|
771
1022
|
strokeColor: options.lineColor,
|
|
772
1023
|
strokeWeight: options.lineSize,
|
|
773
1024
|
strokeOpacity: options.lineOpacity
|
|
774
|
-
});
|
|
1025
|
+
}); //@ts-ignore
|
|
1026
|
+
|
|
775
1027
|
options.editable !== undefined && polyline.native.setEditable(options.editable);
|
|
776
1028
|
}
|
|
777
1029
|
};
|
|
@@ -795,7 +1047,7 @@
|
|
|
795
1047
|
_g = _a.visible,
|
|
796
1048
|
visible = _g === void 0 ? true : _g;
|
|
797
1049
|
_a.editable;
|
|
798
|
-
var event = _a.event;
|
|
1050
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
799
1051
|
|
|
800
1052
|
if (this.map && Array.isArray(position)) {
|
|
801
1053
|
var outLine = position.map(function (elem) {
|
|
@@ -813,7 +1065,9 @@
|
|
|
813
1065
|
fillOpacity: fillOpacity,
|
|
814
1066
|
clickable: true,
|
|
815
1067
|
visible: visible
|
|
816
|
-
});
|
|
1068
|
+
}); //@ts-ignore
|
|
1069
|
+
//pol.setEditable(editable)
|
|
1070
|
+
|
|
817
1071
|
polygon.native = pol_2;
|
|
818
1072
|
event && event.forEach(function (handler, key) {
|
|
819
1073
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -824,7 +1078,9 @@
|
|
|
824
1078
|
};
|
|
825
1079
|
|
|
826
1080
|
NaverMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
1081
|
+
//console.log('controller updatePolygon', options);
|
|
827
1082
|
if (polygon && polygon.native && polygon.native instanceof naver.maps.Polygon) {
|
|
1083
|
+
//console.log('controller updatePolygon start');
|
|
828
1084
|
var paths = void 0;
|
|
829
1085
|
|
|
830
1086
|
if (Array.isArray(options.position)) {
|
|
@@ -843,7 +1099,8 @@
|
|
|
843
1099
|
strokeOpacity: options.lineOpacity,
|
|
844
1100
|
fillColor: options.fillColor,
|
|
845
1101
|
fillOpacity: options.fillOpacity
|
|
846
|
-
});
|
|
1102
|
+
}); //@ts-ignore
|
|
1103
|
+
|
|
847
1104
|
options.editable !== undefined && polygon.native.setEditable(options.editable);
|
|
848
1105
|
}
|
|
849
1106
|
};
|
|
@@ -858,7 +1115,8 @@
|
|
|
858
1115
|
map: this.map,
|
|
859
1116
|
position: marker.options.position,
|
|
860
1117
|
visible: marker.options.visible === undefined || marker.options.visible
|
|
861
|
-
};
|
|
1118
|
+
}; //console.log('controller createMarker', marker.options);
|
|
1119
|
+
|
|
862
1120
|
marker.element && (options.icon = {
|
|
863
1121
|
content: marker.element,
|
|
864
1122
|
anchor: marker.options.anchor
|
|
@@ -885,10 +1143,18 @@
|
|
|
885
1143
|
};
|
|
886
1144
|
|
|
887
1145
|
NaverMintMapController.prototype.updateMarker = function (marker, options) {
|
|
1146
|
+
//console.log('controller updateMarker', options);
|
|
888
1147
|
if (marker && marker.native && marker.native instanceof naver.maps.Marker) {
|
|
889
1148
|
var map = marker.native.getMap();
|
|
890
1149
|
|
|
891
1150
|
if (map) {
|
|
1151
|
+
/** 중요!!!!
|
|
1152
|
+
* naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
|
|
1153
|
+
* setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
|
|
1154
|
+
* (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
|
|
1155
|
+
* 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
|
|
1156
|
+
*/
|
|
1157
|
+
//Position
|
|
892
1158
|
if (options.position && options.position instanceof Position) {
|
|
893
1159
|
marker.native.setPosition(options.position);
|
|
894
1160
|
}
|
|
@@ -901,7 +1167,21 @@
|
|
|
901
1167
|
marker.native.setIcon(tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
|
|
902
1168
|
anchor: options.anchor
|
|
903
1169
|
}));
|
|
904
|
-
}
|
|
1170
|
+
} // const newOption = {
|
|
1171
|
+
// map:map,
|
|
1172
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1173
|
+
// visible:options.visible === undefined || options.visible,
|
|
1174
|
+
// } as naver.maps.MarkerOptions
|
|
1175
|
+
// if(options.anchor){
|
|
1176
|
+
// newOption.icon = {...marker.native.getIcon(), anchor:options.anchor}
|
|
1177
|
+
// }
|
|
1178
|
+
// marker.native.setOptions({
|
|
1179
|
+
// map:map,
|
|
1180
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1181
|
+
// visible:options.visible === undefined || options.visible,
|
|
1182
|
+
// icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
1183
|
+
// })
|
|
1184
|
+
|
|
905
1185
|
}
|
|
906
1186
|
}
|
|
907
1187
|
};
|
|
@@ -981,7 +1261,7 @@
|
|
|
981
1261
|
NaverMintMapController.prototype.checkLoaded = function () {
|
|
982
1262
|
var _a, _b;
|
|
983
1263
|
|
|
984
|
-
return (_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
1264
|
+
return ((_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
985
1265
|
};
|
|
986
1266
|
|
|
987
1267
|
NaverMintMapController.prototype.loadMapApi = function () {
|
|
@@ -989,17 +1269,21 @@
|
|
|
989
1269
|
var _this = this;
|
|
990
1270
|
|
|
991
1271
|
return tslib.__generator(this, function (_a) {
|
|
992
|
-
return [2
|
|
1272
|
+
return [2
|
|
1273
|
+
/*return*/
|
|
1274
|
+
, new Promise(function (resolve, error) {
|
|
993
1275
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
994
1276
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
995
1277
|
return tslib.__generator(this, function (_a) {
|
|
996
1278
|
switch (_a.label) {
|
|
997
1279
|
case 0:
|
|
998
1280
|
callbackName = this.getRandomFunctionName('load_naver');
|
|
999
|
-
loaded = false;
|
|
1281
|
+
loaded = false; //@ts-ignore
|
|
1000
1282
|
|
|
1001
1283
|
window[callbackName] = function () {
|
|
1002
|
-
|
|
1284
|
+
// console.log('naver api loaded');
|
|
1285
|
+
loaded = true; //@ts-ignore
|
|
1286
|
+
|
|
1003
1287
|
delete window[callbackName];
|
|
1004
1288
|
};
|
|
1005
1289
|
|
|
@@ -1008,17 +1292,22 @@
|
|
|
1008
1292
|
submodules: this.scriptModules.join(','),
|
|
1009
1293
|
callback: callbackName
|
|
1010
1294
|
};
|
|
1011
|
-
return [4
|
|
1295
|
+
return [4
|
|
1296
|
+
/*yield*/
|
|
1297
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
|
|
1012
1298
|
|
|
1013
1299
|
case 1:
|
|
1014
1300
|
callbackExecFlag = _a.sent();
|
|
1015
1301
|
|
|
1016
1302
|
if (!callbackExecFlag) {
|
|
1017
|
-
loaded = true;
|
|
1303
|
+
loaded = true; //@ts-ignore
|
|
1304
|
+
|
|
1018
1305
|
delete window[callbackName];
|
|
1019
1306
|
}
|
|
1020
1307
|
|
|
1021
|
-
return [4
|
|
1308
|
+
return [4
|
|
1309
|
+
/*yield*/
|
|
1310
|
+
, waiting(function () {
|
|
1022
1311
|
return loaded;
|
|
1023
1312
|
})];
|
|
1024
1313
|
|
|
@@ -1031,7 +1320,9 @@
|
|
|
1031
1320
|
|
|
1032
1321
|
this.mapApiLoaded = true;
|
|
1033
1322
|
resolve(true);
|
|
1034
|
-
return [2
|
|
1323
|
+
return [2
|
|
1324
|
+
/*return*/
|
|
1325
|
+
];
|
|
1035
1326
|
}
|
|
1036
1327
|
});
|
|
1037
1328
|
});
|
|
@@ -1045,8 +1336,11 @@
|
|
|
1045
1336
|
var _this = this;
|
|
1046
1337
|
|
|
1047
1338
|
return tslib.__generator(this, function (_a) {
|
|
1339
|
+
//div element
|
|
1048
1340
|
this.mapDivElement = divElement;
|
|
1049
|
-
return [2
|
|
1341
|
+
return [2
|
|
1342
|
+
/*return*/
|
|
1343
|
+
, new Promise(function (resolve) {
|
|
1050
1344
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1051
1345
|
var options, maxZoom, minZoom, map;
|
|
1052
1346
|
|
|
@@ -1057,17 +1351,26 @@
|
|
|
1057
1351
|
return tslib.__generator(this, function (_e) {
|
|
1058
1352
|
switch (_e.label) {
|
|
1059
1353
|
case 0:
|
|
1354
|
+
//이미 생성했으면
|
|
1355
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
1356
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
1060
1357
|
if (this.mapInitialized && this.map) {
|
|
1061
1358
|
if (this.map.getElement() === divElement) {
|
|
1062
1359
|
resolve(this.map);
|
|
1063
|
-
return [2
|
|
1360
|
+
return [2
|
|
1361
|
+
/*return*/
|
|
1362
|
+
];
|
|
1064
1363
|
} else {
|
|
1065
1364
|
this.map.destroy();
|
|
1066
1365
|
}
|
|
1067
1366
|
}
|
|
1068
1367
|
|
|
1069
|
-
if (!!this.mapApiLoaded) return [3
|
|
1070
|
-
|
|
1368
|
+
if (!!this.mapApiLoaded) return [3
|
|
1369
|
+
/*break*/
|
|
1370
|
+
, 2];
|
|
1371
|
+
return [4
|
|
1372
|
+
/*yield*/
|
|
1373
|
+
, this.loadMapApi()];
|
|
1071
1374
|
|
|
1072
1375
|
case 1:
|
|
1073
1376
|
_e.sent();
|
|
@@ -1104,43 +1407,59 @@
|
|
|
1104
1407
|
options.minZoom = minZoom;
|
|
1105
1408
|
options.maxZoom = maxZoom;
|
|
1106
1409
|
map = new naver.maps.Map(divElement, options);
|
|
1107
|
-
this.map = map;
|
|
1410
|
+
this.map = map; //@ts-ignore
|
|
1411
|
+
|
|
1108
1412
|
map.addListener('dragstart', function (e) {
|
|
1413
|
+
//console.log('map dragstart', e);
|
|
1109
1414
|
_this.dragStartPoint[0] = e.domEvent.clientX;
|
|
1110
1415
|
_this.dragStartPoint[1] = e.domEvent.clientY;
|
|
1111
|
-
});
|
|
1416
|
+
}); //@ts-ignore
|
|
1417
|
+
|
|
1112
1418
|
map.addListener('dragend', function (e) {
|
|
1419
|
+
//console.log('map dragend', e);
|
|
1113
1420
|
if (_this.dragStartPoint[0] === e.domEvent.clientX && _this.dragStartPoint[1] === e.domEvent.clientY) {
|
|
1114
1421
|
_this.dragged = false;
|
|
1115
1422
|
} else {
|
|
1116
1423
|
_this.dragged = true;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1424
|
+
} //console.log('map dragend', this.dragged)
|
|
1425
|
+
|
|
1426
|
+
}); //@ts-ignore
|
|
1427
|
+
|
|
1119
1428
|
map.addListener('idle', function (e) {
|
|
1429
|
+
//onBoundsChanged event
|
|
1120
1430
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
1121
1431
|
});
|
|
1122
1432
|
map.addListener('zoom_changed', function () {
|
|
1433
|
+
//onZoomChanged event
|
|
1434
|
+
//console.log('zoom_changed');
|
|
1123
1435
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom());
|
|
1124
|
-
});
|
|
1436
|
+
}); //@ts-ignore
|
|
1437
|
+
|
|
1125
1438
|
map.addListener('click', function (e) {
|
|
1439
|
+
// console.log('map click', e);
|
|
1126
1440
|
if (!_this.mapProps.onClick) return;
|
|
1127
1441
|
var pos = new Position(e.coord.y, e.coord.x);
|
|
1128
1442
|
pos.offset = new Offset(e.offset.x, e.offset.y);
|
|
1129
1443
|
|
|
1130
1444
|
_this.mapProps.onClick(pos);
|
|
1131
|
-
});
|
|
1445
|
+
}); //@ts-ignore
|
|
1446
|
+
|
|
1132
1447
|
map.addListener('mousemove', function (e) {
|
|
1133
1448
|
if (!_this.mapProps.onMouseMove) return;
|
|
1134
1449
|
var pos = new Position(e.coord.y, e.coord.x);
|
|
1135
|
-
pos.offset = new Offset(e.offset.x, e.offset.y);
|
|
1450
|
+
pos.offset = new Offset(e.offset.x, e.offset.y); // console.log('mousemove', pos)
|
|
1136
1451
|
|
|
1137
1452
|
_this.mapProps.onMouseMove(pos);
|
|
1138
1453
|
});
|
|
1139
1454
|
this.mapInitialized = true;
|
|
1140
|
-
this.initMarkerPool();
|
|
1141
|
-
|
|
1455
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
1456
|
+
|
|
1457
|
+
resolve(map); //네이버는 로드 후에 idle 이 발생 안해서 직접 일으켜준다
|
|
1458
|
+
|
|
1142
1459
|
map.trigger('idle');
|
|
1143
|
-
return [2
|
|
1460
|
+
return [2
|
|
1461
|
+
/*return*/
|
|
1462
|
+
];
|
|
1144
1463
|
}
|
|
1145
1464
|
});
|
|
1146
1465
|
});
|
|
@@ -1167,7 +1486,8 @@
|
|
|
1167
1486
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1168
1487
|
} catch (e) {
|
|
1169
1488
|
console.log('naver map destroy error', e);
|
|
1170
|
-
}
|
|
1489
|
+
} // console.log(`${this.type} map destroyed`);
|
|
1490
|
+
|
|
1171
1491
|
};
|
|
1172
1492
|
|
|
1173
1493
|
NaverMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -1212,7 +1532,9 @@
|
|
|
1212
1532
|
return NaverMintMapController;
|
|
1213
1533
|
}(MintMapController);
|
|
1214
1534
|
|
|
1215
|
-
var GoogleMintMapController =
|
|
1535
|
+
var GoogleMintMapController =
|
|
1536
|
+
/** @class */
|
|
1537
|
+
function (_super) {
|
|
1216
1538
|
tslib.__extends(GoogleMintMapController, _super);
|
|
1217
1539
|
|
|
1218
1540
|
function GoogleMintMapController(props) {
|
|
@@ -1221,7 +1543,8 @@
|
|
|
1221
1543
|
_this.type = 'google';
|
|
1222
1544
|
_this.map = null;
|
|
1223
1545
|
_this.scriptUrl = 'https://maps.googleapis.com/maps/api/js';
|
|
1224
|
-
_this.scriptModules = ['marker'];
|
|
1546
|
+
_this.scriptModules = ['marker']; //'drawing' , 'geometry' , 'journeySharing' , 'localContext' , 'places' , 'visualization']
|
|
1547
|
+
|
|
1225
1548
|
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
1226
1549
|
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
1227
1550
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
@@ -1232,10 +1555,11 @@
|
|
|
1232
1555
|
_this.map && google.maps.event.clearInstanceListeners(_this.map);
|
|
1233
1556
|
} catch (e) {
|
|
1234
1557
|
console.log('google map destroy error', e);
|
|
1235
|
-
}
|
|
1558
|
+
} // console.log(`${this.type} map destroyed`);
|
|
1559
|
+
|
|
1236
1560
|
};
|
|
1237
1561
|
|
|
1238
|
-
return _this;
|
|
1562
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
1239
1563
|
}
|
|
1240
1564
|
|
|
1241
1565
|
GoogleMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -1253,12 +1577,13 @@
|
|
|
1253
1577
|
visible = _e === void 0 ? true : _e,
|
|
1254
1578
|
_f = _a.editable,
|
|
1255
1579
|
editable = _f === void 0 ? false : _f,
|
|
1256
|
-
event = _a.event;
|
|
1580
|
+
event = _a.event; //console.log('polyline', polyline);
|
|
1257
1581
|
|
|
1258
1582
|
if (this.map && Array.isArray(position)) {
|
|
1259
1583
|
var path = position.map(function (elem) {
|
|
1260
1584
|
return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
|
|
1261
|
-
});
|
|
1585
|
+
}); //console.log('polyline path',path);
|
|
1586
|
+
|
|
1262
1587
|
var pol_1 = new google.maps.Polyline({
|
|
1263
1588
|
map: this.map,
|
|
1264
1589
|
path: path,
|
|
@@ -1268,7 +1593,8 @@
|
|
|
1268
1593
|
clickable: true,
|
|
1269
1594
|
visible: visible,
|
|
1270
1595
|
editable: editable
|
|
1271
|
-
});
|
|
1596
|
+
}); //console.log('google polyline created', polyline);
|
|
1597
|
+
|
|
1272
1598
|
polyline.native = pol_1;
|
|
1273
1599
|
event && event.forEach(function (handler, key) {
|
|
1274
1600
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -1279,8 +1605,9 @@
|
|
|
1279
1605
|
};
|
|
1280
1606
|
|
|
1281
1607
|
GoogleMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
1608
|
+
//console.log('controller updatePolyline', options);
|
|
1282
1609
|
if (polyline && polyline.native && polyline.native instanceof google.maps.Polyline) {
|
|
1283
|
-
var polylineOption = this.getValidOptions(options);
|
|
1610
|
+
var polylineOption = this.getValidOptions(options); //console.log('controller updatePolyline start', polylineOption);
|
|
1284
1611
|
|
|
1285
1612
|
if (this.map && Array.isArray(options.position)) {
|
|
1286
1613
|
var path = options.position.map(function (elem) {
|
|
@@ -1313,7 +1640,7 @@
|
|
|
1313
1640
|
visible = _g === void 0 ? true : _g,
|
|
1314
1641
|
_h = _a.editable,
|
|
1315
1642
|
editable = _h === void 0 ? false : _h,
|
|
1316
|
-
event = _a.event;
|
|
1643
|
+
event = _a.event; //console.log('polygon', polygon);
|
|
1317
1644
|
|
|
1318
1645
|
if (this.map && Array.isArray(position)) {
|
|
1319
1646
|
var outLine = position.map(function (elem) {
|
|
@@ -1332,7 +1659,8 @@
|
|
|
1332
1659
|
clickable: true,
|
|
1333
1660
|
visible: visible,
|
|
1334
1661
|
editable: editable
|
|
1335
|
-
});
|
|
1662
|
+
}); //console.log('google polygon created', polygon);
|
|
1663
|
+
|
|
1336
1664
|
polygon.native = pol_2;
|
|
1337
1665
|
event && event.forEach(function (handler, key) {
|
|
1338
1666
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -1343,8 +1671,9 @@
|
|
|
1343
1671
|
};
|
|
1344
1672
|
|
|
1345
1673
|
GoogleMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
1674
|
+
//console.log('controller updatePolygon', options);
|
|
1346
1675
|
if (polygon && polygon.native && polygon.native instanceof google.maps.Polygon) {
|
|
1347
|
-
var polygonOption = this.getValidOptions(options);
|
|
1676
|
+
var polygonOption = this.getValidOptions(options); //console.log('controller updatePolygon start', polygonOption);
|
|
1348
1677
|
|
|
1349
1678
|
if (this.map && Array.isArray(options.position)) {
|
|
1350
1679
|
var outLine = options.position.map(function (elem) {
|
|
@@ -1360,12 +1689,14 @@
|
|
|
1360
1689
|
};
|
|
1361
1690
|
|
|
1362
1691
|
GoogleMintMapController.prototype.getValidOptions = function (options) {
|
|
1692
|
+
//console.log('getValidOptions DrawableOptions',options)
|
|
1363
1693
|
var target = {};
|
|
1364
1694
|
|
|
1365
1695
|
for (var _i = 0, _a = Object.getOwnPropertyNames(options); _i < _a.length; _i++) {
|
|
1366
|
-
var name_1 = _a[_i];
|
|
1696
|
+
var name_1 = _a[_i]; //@ts-ignore
|
|
1367
1697
|
|
|
1368
1698
|
if (options[name_1] !== undefined) {
|
|
1699
|
+
//@ts-ignore
|
|
1369
1700
|
target[name_1] = options[name_1];
|
|
1370
1701
|
}
|
|
1371
1702
|
}
|
|
@@ -1381,7 +1712,7 @@
|
|
|
1381
1712
|
if (this.map) {
|
|
1382
1713
|
var googleMarker_1;
|
|
1383
1714
|
|
|
1384
|
-
if (marker.element) {
|
|
1715
|
+
if (marker.element && marker.element instanceof Element) {
|
|
1385
1716
|
var options = {
|
|
1386
1717
|
map: this.map,
|
|
1387
1718
|
position: marker.options.position
|
|
@@ -1412,6 +1743,7 @@
|
|
|
1412
1743
|
};
|
|
1413
1744
|
|
|
1414
1745
|
GoogleMintMapController.prototype.updateMarker = function (marker, options) {
|
|
1746
|
+
//console.log('controller updateMarker', options);
|
|
1415
1747
|
var _a, _b;
|
|
1416
1748
|
|
|
1417
1749
|
if (marker && marker.native) {
|
|
@@ -1422,7 +1754,8 @@
|
|
|
1422
1754
|
marker.native.setOptions({
|
|
1423
1755
|
map: map,
|
|
1424
1756
|
position: options.position instanceof Position ? options.position : marker.native.getPosition(),
|
|
1425
|
-
visible: options.visible === undefined || options.visible
|
|
1757
|
+
visible: options.visible === undefined || options.visible // icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
1758
|
+
|
|
1426
1759
|
});
|
|
1427
1760
|
}
|
|
1428
1761
|
} else if (marker.native instanceof google.maps.marker.AdvancedMarkerView) {
|
|
@@ -1518,7 +1851,7 @@
|
|
|
1518
1851
|
GoogleMintMapController.prototype.checkLoaded = function () {
|
|
1519
1852
|
var _a, _b, _c;
|
|
1520
1853
|
|
|
1521
|
-
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;
|
|
1854
|
+
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;
|
|
1522
1855
|
};
|
|
1523
1856
|
|
|
1524
1857
|
GoogleMintMapController.prototype.loadMapApi = function () {
|
|
@@ -1526,17 +1859,21 @@
|
|
|
1526
1859
|
var _this = this;
|
|
1527
1860
|
|
|
1528
1861
|
return tslib.__generator(this, function (_a) {
|
|
1529
|
-
return [2
|
|
1862
|
+
return [2
|
|
1863
|
+
/*return*/
|
|
1864
|
+
, new Promise(function (resolve) {
|
|
1530
1865
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1531
1866
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
1532
1867
|
return tslib.__generator(this, function (_a) {
|
|
1533
1868
|
switch (_a.label) {
|
|
1534
1869
|
case 0:
|
|
1535
1870
|
callbackName = this.getRandomFunctionName('load_google');
|
|
1536
|
-
loaded = false;
|
|
1871
|
+
loaded = false; //@ts-ignore
|
|
1537
1872
|
|
|
1538
1873
|
window[callbackName] = function () {
|
|
1539
|
-
|
|
1874
|
+
// console.log('google api loaded');
|
|
1875
|
+
loaded = true; //@ts-ignore
|
|
1876
|
+
|
|
1540
1877
|
delete window[callbackName];
|
|
1541
1878
|
};
|
|
1542
1879
|
|
|
@@ -1546,17 +1883,23 @@
|
|
|
1546
1883
|
v: 'beta',
|
|
1547
1884
|
callback: callbackName
|
|
1548
1885
|
};
|
|
1549
|
-
return [4
|
|
1886
|
+
return [4
|
|
1887
|
+
/*yield*/
|
|
1888
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
|
|
1550
1889
|
|
|
1551
1890
|
case 1:
|
|
1552
1891
|
callbackExecFlag = _a.sent();
|
|
1553
1892
|
|
|
1554
1893
|
if (!callbackExecFlag) {
|
|
1555
|
-
loaded
|
|
1894
|
+
// console.log('google api loaded 222222');
|
|
1895
|
+
loaded = true; //@ts-ignore
|
|
1896
|
+
|
|
1556
1897
|
delete window[callbackName];
|
|
1557
1898
|
}
|
|
1558
1899
|
|
|
1559
|
-
return [4
|
|
1900
|
+
return [4
|
|
1901
|
+
/*yield*/
|
|
1902
|
+
, waiting(function () {
|
|
1560
1903
|
return loaded;
|
|
1561
1904
|
})];
|
|
1562
1905
|
|
|
@@ -1569,7 +1912,9 @@
|
|
|
1569
1912
|
|
|
1570
1913
|
this.mapApiLoaded = true;
|
|
1571
1914
|
resolve(true);
|
|
1572
|
-
return [2
|
|
1915
|
+
return [2
|
|
1916
|
+
/*return*/
|
|
1917
|
+
];
|
|
1573
1918
|
}
|
|
1574
1919
|
});
|
|
1575
1920
|
});
|
|
@@ -1583,8 +1928,11 @@
|
|
|
1583
1928
|
var _this = this;
|
|
1584
1929
|
|
|
1585
1930
|
return tslib.__generator(this, function (_a) {
|
|
1931
|
+
//div element
|
|
1586
1932
|
this.mapDivElement = divElement;
|
|
1587
|
-
return [2
|
|
1933
|
+
return [2
|
|
1934
|
+
/*return*/
|
|
1935
|
+
, new Promise(function (resolve) {
|
|
1588
1936
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1589
1937
|
var map;
|
|
1590
1938
|
|
|
@@ -1595,15 +1943,24 @@
|
|
|
1595
1943
|
return tslib.__generator(this, function (_e) {
|
|
1596
1944
|
switch (_e.label) {
|
|
1597
1945
|
case 0:
|
|
1946
|
+
//이미 생성했으면
|
|
1947
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
1948
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
1598
1949
|
if (this.mapInitialized && this.map) {
|
|
1599
1950
|
if (this.map.getDiv() === divElement) {
|
|
1600
1951
|
resolve(this.map);
|
|
1601
|
-
return [2
|
|
1952
|
+
return [2
|
|
1953
|
+
/*return*/
|
|
1954
|
+
];
|
|
1602
1955
|
}
|
|
1603
1956
|
}
|
|
1604
1957
|
|
|
1605
|
-
if (!!this.mapApiLoaded) return [3
|
|
1606
|
-
|
|
1958
|
+
if (!!this.mapApiLoaded) return [3
|
|
1959
|
+
/*break*/
|
|
1960
|
+
, 2];
|
|
1961
|
+
return [4
|
|
1962
|
+
/*yield*/
|
|
1963
|
+
, this.loadMapApi()];
|
|
1607
1964
|
|
|
1608
1965
|
case 1:
|
|
1609
1966
|
_e.sent();
|
|
@@ -1622,14 +1979,20 @@
|
|
|
1622
1979
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
1623
1980
|
clickableIcons: false
|
|
1624
1981
|
});
|
|
1625
|
-
this.map = map;
|
|
1982
|
+
this.map = map; //@ts-ignore
|
|
1983
|
+
|
|
1626
1984
|
map.addListener('idle', function () {
|
|
1985
|
+
//onBoundsChanged event
|
|
1627
1986
|
_this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
1628
1987
|
});
|
|
1629
1988
|
map.addListener('zoom_changed', function () {
|
|
1630
|
-
|
|
1631
|
-
|
|
1989
|
+
//onZoomChanged event
|
|
1990
|
+
// console.log('zoom_changed');
|
|
1991
|
+
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom() || 10);
|
|
1992
|
+
}); //@ts-ignore
|
|
1993
|
+
|
|
1632
1994
|
map.addListener('click', function (e) {
|
|
1995
|
+
// console.log('map click', e)
|
|
1633
1996
|
if (!_this.mapProps.onClick) return;
|
|
1634
1997
|
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
1635
1998
|
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
@@ -1639,13 +2002,16 @@
|
|
|
1639
2002
|
map.addListener('mousemove', function (e) {
|
|
1640
2003
|
if (!_this.mapProps.onMouseMove) return;
|
|
1641
2004
|
var pos = new Position(e.latLng.lat(), e.latLng.lng());
|
|
1642
|
-
pos.offset = new Offset(e.pixel.x, e.pixel.y);
|
|
2005
|
+
pos.offset = new Offset(e.pixel.x, e.pixel.y); // console.log('mousemove', pos)
|
|
1643
2006
|
|
|
1644
2007
|
_this.mapProps.onMouseMove(pos);
|
|
1645
2008
|
});
|
|
1646
|
-
this.mapInitialized = true;
|
|
2009
|
+
this.mapInitialized = true; // console.log(`${this.type} map script initialized`, divElement);
|
|
2010
|
+
|
|
1647
2011
|
resolve(map);
|
|
1648
|
-
return [2
|
|
2012
|
+
return [2
|
|
2013
|
+
/*return*/
|
|
2014
|
+
];
|
|
1649
2015
|
}
|
|
1650
2016
|
});
|
|
1651
2017
|
});
|
|
@@ -1668,7 +2034,7 @@
|
|
|
1668
2034
|
if (bounds) {
|
|
1669
2035
|
return this.fromGoogleBounds(bounds);
|
|
1670
2036
|
} else {
|
|
1671
|
-
throw new Error('bounds is not found!!!');
|
|
2037
|
+
throw new Error('bounds is not found!!!'); //return new Bounds(new Position(0,0), new Position(0,0))
|
|
1672
2038
|
}
|
|
1673
2039
|
};
|
|
1674
2040
|
|
|
@@ -1703,7 +2069,9 @@
|
|
|
1703
2069
|
return GoogleMintMapController;
|
|
1704
2070
|
}(MintMapController);
|
|
1705
2071
|
|
|
1706
|
-
var KakaoMintMapController =
|
|
2072
|
+
var KakaoMintMapController =
|
|
2073
|
+
/** @class */
|
|
2074
|
+
function (_super) {
|
|
1707
2075
|
tslib.__extends(KakaoMintMapController, _super);
|
|
1708
2076
|
|
|
1709
2077
|
function KakaoMintMapController(props) {
|
|
@@ -1718,21 +2086,30 @@
|
|
|
1718
2086
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
1719
2087
|
_this.dragStartPoint = [0, 0];
|
|
1720
2088
|
_this.dragged = false;
|
|
1721
|
-
return _this;
|
|
2089
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
1722
2090
|
}
|
|
1723
2091
|
|
|
1724
2092
|
KakaoMintMapController.prototype.initMarkerPool = function () {
|
|
1725
2093
|
var _this = this;
|
|
1726
2094
|
|
|
1727
|
-
if (!this.mapProps.markerCache) return;
|
|
1728
|
-
|
|
2095
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
2096
|
+
|
|
2097
|
+
this.markerPool = new tools.ObjectPool() //logging on
|
|
2098
|
+
//.setLog(true)
|
|
2099
|
+
//factory 셋팅
|
|
2100
|
+
.setFactory(function () {
|
|
2101
|
+
//console.log('pool item created');
|
|
1729
2102
|
return new kakao.maps.CustomOverlay({
|
|
1730
2103
|
position: _this.positionToLatLng(new Position(0, 0)),
|
|
1731
2104
|
map: _this.map || undefined
|
|
1732
2105
|
});
|
|
1733
|
-
})
|
|
2106
|
+
}) //clear function 셋팅
|
|
2107
|
+
.setClear(function (item) {
|
|
2108
|
+
//console.log('pool item cleared');
|
|
1734
2109
|
item.setMap(null);
|
|
1735
|
-
})
|
|
2110
|
+
}) //초기 pool 사이즈
|
|
2111
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
2112
|
+
.setCheckLiveTimeInterval(1000);
|
|
1736
2113
|
};
|
|
1737
2114
|
|
|
1738
2115
|
KakaoMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -1748,7 +2125,7 @@
|
|
|
1748
2125
|
lineOpacity = _d === void 0 ? 1 : _d;
|
|
1749
2126
|
_a.visible;
|
|
1750
2127
|
_a.editable;
|
|
1751
|
-
var event = _a.event;
|
|
2128
|
+
var event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
1752
2129
|
|
|
1753
2130
|
if (this.map && Array.isArray(position)) {
|
|
1754
2131
|
var path = position.map(function (elem) {
|
|
@@ -1760,7 +2137,11 @@
|
|
|
1760
2137
|
strokeColor: lineColor,
|
|
1761
2138
|
strokeWeight: lineSize,
|
|
1762
2139
|
strokeOpacity: lineOpacity
|
|
1763
|
-
});
|
|
2140
|
+
}); // if(editable){
|
|
2141
|
+
// //@ts-ignore
|
|
2142
|
+
// this.drawingManager.addDrawing(pol, kakao.maps.drawing.DrawingMode.POLYLINE)
|
|
2143
|
+
// }
|
|
2144
|
+
|
|
1764
2145
|
polyline.native = pol_1;
|
|
1765
2146
|
event && event.forEach(function (handler, key) {
|
|
1766
2147
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -1771,9 +2152,11 @@
|
|
|
1771
2152
|
};
|
|
1772
2153
|
|
|
1773
2154
|
KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
2155
|
+
//console.log('controller updatePolyline', options);
|
|
1774
2156
|
var _this = this;
|
|
1775
2157
|
|
|
1776
2158
|
if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
|
|
2159
|
+
//console.log('controller updatePolyline start');
|
|
1777
2160
|
var path = void 0;
|
|
1778
2161
|
|
|
1779
2162
|
if (Array.isArray(options.position)) {
|
|
@@ -1784,6 +2167,7 @@
|
|
|
1784
2167
|
|
|
1785
2168
|
polyline.native.setOptions({
|
|
1786
2169
|
path: path || polyline.native.getPath(),
|
|
2170
|
+
//visible:options.visible === undefined || options.visible,
|
|
1787
2171
|
strokeColor: options.lineColor,
|
|
1788
2172
|
strokeWeight: options.lineSize,
|
|
1789
2173
|
strokeOpacity: options.lineOpacity
|
|
@@ -1809,15 +2193,17 @@
|
|
|
1809
2193
|
fillOpacity = _f === void 0 ? 0.5 : _f;
|
|
1810
2194
|
_a.visible;
|
|
1811
2195
|
_a.editable;
|
|
1812
|
-
var event = _a.event;
|
|
2196
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
1813
2197
|
|
|
1814
2198
|
if (this.map && Array.isArray(position)) {
|
|
1815
2199
|
var outLine = position.map(function (elem) {
|
|
1816
2200
|
return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
|
|
1817
2201
|
});
|
|
1818
2202
|
var path = [outLine];
|
|
1819
|
-
innerPositions && path.push(innerPositions.map(function (inner) {
|
|
1820
|
-
return
|
|
2203
|
+
innerPositions && path.push.apply(path, innerPositions.map(function (inner) {
|
|
2204
|
+
return inner.map(function (innerItem) {
|
|
2205
|
+
return _this.positionToLatLng(innerItem);
|
|
2206
|
+
});
|
|
1821
2207
|
}));
|
|
1822
2208
|
var pol_2 = new kakao.maps.Polygon({
|
|
1823
2209
|
map: this.map,
|
|
@@ -1826,8 +2212,12 @@
|
|
|
1826
2212
|
strokeWeight: lineSize,
|
|
1827
2213
|
strokeOpacity: lineOpacity,
|
|
1828
2214
|
fillColor: fillColor,
|
|
1829
|
-
fillOpacity: fillOpacity
|
|
1830
|
-
|
|
2215
|
+
fillOpacity: fillOpacity // clickable:true,
|
|
2216
|
+
// visible:visible,
|
|
2217
|
+
|
|
2218
|
+
}); //@ts-ignore
|
|
2219
|
+
//pol.setEditable(editable)
|
|
2220
|
+
|
|
1831
2221
|
polygon.native = pol_2;
|
|
1832
2222
|
event && event.forEach(function (handler, key) {
|
|
1833
2223
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -1838,9 +2228,11 @@
|
|
|
1838
2228
|
};
|
|
1839
2229
|
|
|
1840
2230
|
KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
2231
|
+
//console.log('controller updatePolygon', options);
|
|
1841
2232
|
var _this = this;
|
|
1842
2233
|
|
|
1843
2234
|
if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
|
|
2235
|
+
//console.log('controller updatePolygon start');
|
|
1844
2236
|
var paths = void 0;
|
|
1845
2237
|
|
|
1846
2238
|
if (Array.isArray(options.position)) {
|
|
@@ -1849,18 +2241,22 @@
|
|
|
1849
2241
|
});
|
|
1850
2242
|
paths = [outLine];
|
|
1851
2243
|
options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
|
|
1852
|
-
return
|
|
2244
|
+
return inner.map(function (innerItem) {
|
|
2245
|
+
return _this.positionToLatLng(innerItem);
|
|
2246
|
+
});
|
|
1853
2247
|
}));
|
|
1854
2248
|
}
|
|
1855
2249
|
|
|
1856
2250
|
polygon.native.setOptions({
|
|
1857
2251
|
path: paths || polygon.native.getPath(),
|
|
2252
|
+
// visible:options.visible === undefined || options.visible,
|
|
1858
2253
|
strokeColor: options.lineColor,
|
|
1859
2254
|
strokeWeight: options.lineSize,
|
|
1860
2255
|
strokeOpacity: options.lineOpacity,
|
|
1861
2256
|
fillColor: options.fillColor,
|
|
1862
2257
|
fillOpacity: options.fillOpacity
|
|
1863
|
-
});
|
|
2258
|
+
}); //@ts-ignore
|
|
2259
|
+
// options.editable !== undefined && polygon.native.setEditable(options.editable)
|
|
1864
2260
|
}
|
|
1865
2261
|
};
|
|
1866
2262
|
|
|
@@ -1872,8 +2268,10 @@
|
|
|
1872
2268
|
if (this.map) {
|
|
1873
2269
|
var options = {
|
|
1874
2270
|
map: this.map,
|
|
1875
|
-
position: this.positionToLatLng(marker.options.position)
|
|
1876
|
-
|
|
2271
|
+
position: this.positionToLatLng(marker.options.position) // visible:marker.options.visible === undefined || marker.options.visible,
|
|
2272
|
+
|
|
2273
|
+
}; //console.log('controller createMarker', marker.options);
|
|
2274
|
+
|
|
1877
2275
|
marker.element && (options.content = marker.element);
|
|
1878
2276
|
var kakaoMarker_1;
|
|
1879
2277
|
|
|
@@ -1886,7 +2284,7 @@
|
|
|
1886
2284
|
} else {
|
|
1887
2285
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
1888
2286
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
1889
|
-
marker
|
|
2287
|
+
this.removeParentElementsMargin(marker);
|
|
1890
2288
|
marker.native = kakaoMarker_1;
|
|
1891
2289
|
}
|
|
1892
2290
|
|
|
@@ -1899,10 +2297,12 @@
|
|
|
1899
2297
|
};
|
|
1900
2298
|
|
|
1901
2299
|
KakaoMintMapController.prototype.updateMarker = function (marker, options) {
|
|
2300
|
+
//console.log('controller updateMarker', options);
|
|
1902
2301
|
if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
|
|
1903
2302
|
var map = marker.native.getMap();
|
|
1904
2303
|
|
|
1905
2304
|
if (map) {
|
|
2305
|
+
//Position
|
|
1906
2306
|
if (options.position && options.position instanceof Position) {
|
|
1907
2307
|
marker.native.setPosition(this.positionToLatLng(options.position));
|
|
1908
2308
|
}
|
|
@@ -1911,11 +2311,16 @@
|
|
|
1911
2311
|
marker.native.setVisible(options.visible);
|
|
1912
2312
|
}
|
|
1913
2313
|
|
|
1914
|
-
marker
|
|
2314
|
+
this.removeParentElementsMargin(marker);
|
|
1915
2315
|
}
|
|
1916
2316
|
}
|
|
1917
2317
|
};
|
|
1918
2318
|
|
|
2319
|
+
KakaoMintMapController.prototype.removeParentElementsMargin = function (marker) {
|
|
2320
|
+
//맵 별로 offset 통일을 위해서 margin 제거
|
|
2321
|
+
marker.element && marker.element instanceof HTMLElement && marker.element.parentElement && (marker.element.parentElement.style.margin = '0');
|
|
2322
|
+
};
|
|
2323
|
+
|
|
1919
2324
|
KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
|
|
1920
2325
|
if (increment === void 0) {
|
|
1921
2326
|
increment = 0;
|
|
@@ -1925,14 +2330,16 @@
|
|
|
1925
2330
|
var targetPane = parent.parentElement;
|
|
1926
2331
|
var max = 0;
|
|
1927
2332
|
|
|
1928
|
-
|
|
1929
|
-
var
|
|
2333
|
+
if (targetPane) {
|
|
2334
|
+
for (var i = 0; i < targetPane.childElementCount; i++) {
|
|
2335
|
+
var elem = targetPane.children[i];
|
|
1930
2336
|
|
|
1931
|
-
|
|
1932
|
-
|
|
2337
|
+
if (elem instanceof HTMLElement) {
|
|
2338
|
+
var index = Number(elem.style.zIndex);
|
|
1933
2339
|
|
|
1934
|
-
|
|
1935
|
-
|
|
2340
|
+
if (!isNaN(index) && index > max) {
|
|
2341
|
+
max = index;
|
|
2342
|
+
}
|
|
1936
2343
|
}
|
|
1937
2344
|
}
|
|
1938
2345
|
}
|
|
@@ -2003,7 +2410,7 @@
|
|
|
2003
2410
|
KakaoMintMapController.prototype.checkLoaded = function () {
|
|
2004
2411
|
var _a, _b;
|
|
2005
2412
|
|
|
2006
|
-
return (_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
2413
|
+
return ((_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
2007
2414
|
};
|
|
2008
2415
|
|
|
2009
2416
|
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
@@ -2011,7 +2418,9 @@
|
|
|
2011
2418
|
var _this = this;
|
|
2012
2419
|
|
|
2013
2420
|
return tslib.__generator(this, function (_a) {
|
|
2014
|
-
return [2
|
|
2421
|
+
return [2
|
|
2422
|
+
/*return*/
|
|
2423
|
+
, new Promise(function (resolve) {
|
|
2015
2424
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
2016
2425
|
var params, ok;
|
|
2017
2426
|
|
|
@@ -2025,13 +2434,17 @@
|
|
|
2025
2434
|
libraries: this.scriptModules.join(','),
|
|
2026
2435
|
autoload: false
|
|
2027
2436
|
};
|
|
2028
|
-
return [4
|
|
2437
|
+
return [4
|
|
2438
|
+
/*yield*/
|
|
2439
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
|
|
2029
2440
|
|
|
2030
2441
|
case 1:
|
|
2031
2442
|
_a.sent();
|
|
2032
2443
|
|
|
2033
|
-
window.kakao.maps.load();
|
|
2034
|
-
return [4
|
|
2444
|
+
window.kakao.maps.load(function () {});
|
|
2445
|
+
return [4
|
|
2446
|
+
/*yield*/
|
|
2447
|
+
, waiting(function () {
|
|
2035
2448
|
return _this.checkLoaded() ? true : false;
|
|
2036
2449
|
})];
|
|
2037
2450
|
|
|
@@ -2044,7 +2457,9 @@
|
|
|
2044
2457
|
|
|
2045
2458
|
this.mapApiLoaded = true;
|
|
2046
2459
|
resolve(true);
|
|
2047
|
-
return [2
|
|
2460
|
+
return [2
|
|
2461
|
+
/*return*/
|
|
2462
|
+
];
|
|
2048
2463
|
}
|
|
2049
2464
|
});
|
|
2050
2465
|
});
|
|
@@ -2059,7 +2474,9 @@
|
|
|
2059
2474
|
|
|
2060
2475
|
return tslib.__generator(this, function (_a) {
|
|
2061
2476
|
this.mapDivElement = divElement;
|
|
2062
|
-
return [2
|
|
2477
|
+
return [2
|
|
2478
|
+
/*return*/
|
|
2479
|
+
, new Promise(function (resolve) {
|
|
2063
2480
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
2064
2481
|
var options, maxZoom, minZoom, map;
|
|
2065
2482
|
|
|
@@ -2070,17 +2487,12 @@
|
|
|
2070
2487
|
return tslib.__generator(this, function (_e) {
|
|
2071
2488
|
switch (_e.label) {
|
|
2072
2489
|
case 0:
|
|
2073
|
-
if (this.
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
if (!!this.mapApiLoaded) return [3, 2];
|
|
2083
|
-
return [4, this.loadMapApi()];
|
|
2490
|
+
if (!!this.mapApiLoaded) return [3
|
|
2491
|
+
/*break*/
|
|
2492
|
+
, 2];
|
|
2493
|
+
return [4
|
|
2494
|
+
/*yield*/
|
|
2495
|
+
, this.loadMapApi()];
|
|
2084
2496
|
|
|
2085
2497
|
case 1:
|
|
2086
2498
|
_e.sent();
|
|
@@ -2090,7 +2502,7 @@
|
|
|
2090
2502
|
case 2:
|
|
2091
2503
|
options = {
|
|
2092
2504
|
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
2093
|
-
level: this.getBaseToMapZoom((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel),
|
|
2505
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
|
|
2094
2506
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
2095
2507
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
2096
2508
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -2113,31 +2525,58 @@
|
|
|
2113
2525
|
map = new kakao.maps.Map(divElement, options);
|
|
2114
2526
|
map.setMaxLevel(minZoom);
|
|
2115
2527
|
map.setMinLevel(maxZoom);
|
|
2116
|
-
this.map = map;
|
|
2528
|
+
this.map = map; //@ts-ignore
|
|
2529
|
+
// map.addListener('dragstart', (e)=>{
|
|
2530
|
+
// //console.log('map dragstart', e);
|
|
2531
|
+
// this.dragStartPoint[0] = e.domEvent.clientX
|
|
2532
|
+
// this.dragStartPoint[1] = e.domEvent.clientY
|
|
2533
|
+
// })
|
|
2534
|
+
//@ts-ignore
|
|
2535
|
+
// map.addListener('dragend', (e)=>{
|
|
2536
|
+
// //console.log('map dragend', e);
|
|
2537
|
+
// if(this.dragStartPoint[0] === e.domEvent.clientX && this.dragStartPoint[1] === e.domEvent.clientY){
|
|
2538
|
+
// this.dragged = false
|
|
2539
|
+
// }else{
|
|
2540
|
+
// this.dragged = true
|
|
2541
|
+
// }
|
|
2542
|
+
// //console.log('map dragend', this.dragged)
|
|
2543
|
+
// })
|
|
2544
|
+
//@ts-ignore
|
|
2545
|
+
|
|
2117
2546
|
map.addListener('idle', function (e) {
|
|
2547
|
+
//onBoundsChanged event
|
|
2118
2548
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
2119
|
-
});
|
|
2549
|
+
}); //@ts-ignore
|
|
2550
|
+
|
|
2120
2551
|
map.addListener('zoom_changed', function () {
|
|
2552
|
+
//onZoomChanged event
|
|
2553
|
+
//console.log('zoom_changed');
|
|
2121
2554
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
|
|
2122
|
-
});
|
|
2555
|
+
}); //@ts-ignore
|
|
2556
|
+
|
|
2123
2557
|
map.addListener('click', function (e) {
|
|
2558
|
+
// console.log('map click', e);
|
|
2124
2559
|
if (!_this.mapProps.onClick) return;
|
|
2125
2560
|
var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
|
|
2126
2561
|
pos.offset = new Offset(e.point.x, e.point.y);
|
|
2127
2562
|
|
|
2128
2563
|
_this.mapProps.onClick(pos);
|
|
2129
|
-
});
|
|
2564
|
+
}); //@ts-ignore
|
|
2565
|
+
|
|
2130
2566
|
map.addListener('mousemove', function (e) {
|
|
2131
2567
|
if (!_this.mapProps.onMouseMove) return;
|
|
2132
2568
|
var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
|
|
2133
|
-
pos.offset = new Offset(e.point.x, e.point.y);
|
|
2569
|
+
pos.offset = new Offset(e.point.x, e.point.y); // console.log('mousemove', pos)
|
|
2134
2570
|
|
|
2135
2571
|
_this.mapProps.onMouseMove(pos);
|
|
2136
2572
|
});
|
|
2137
2573
|
this.mapInitialized = true;
|
|
2138
|
-
this.initMarkerPool();
|
|
2574
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
2575
|
+
|
|
2139
2576
|
resolve(map);
|
|
2140
|
-
return [2
|
|
2577
|
+
return [2
|
|
2578
|
+
/*return*/
|
|
2579
|
+
];
|
|
2141
2580
|
}
|
|
2142
2581
|
});
|
|
2143
2582
|
});
|
|
@@ -2147,6 +2586,14 @@
|
|
|
2147
2586
|
};
|
|
2148
2587
|
|
|
2149
2588
|
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
2589
|
+
/**
|
|
2590
|
+
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
2591
|
+
* - 가장 확대된 값 : 1
|
|
2592
|
+
* - 가장 축소된 값 : 14
|
|
2593
|
+
*
|
|
2594
|
+
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
2595
|
+
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
2596
|
+
*/
|
|
2150
2597
|
var mapValue = this.getBaseToMapZoom(value);
|
|
2151
2598
|
|
|
2152
2599
|
if (mapValue > 14) {
|
|
@@ -2165,7 +2612,8 @@
|
|
|
2165
2612
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
2166
2613
|
} catch (e) {
|
|
2167
2614
|
console.log('kakao map destroy error', e);
|
|
2168
|
-
}
|
|
2615
|
+
} // console.log(`${this.type} map destroyed`);
|
|
2616
|
+
|
|
2169
2617
|
};
|
|
2170
2618
|
|
|
2171
2619
|
KakaoMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -2204,519 +2652,134 @@
|
|
|
2204
2652
|
};
|
|
2205
2653
|
|
|
2206
2654
|
KakaoMintMapController.prototype.positionToLatLng = function (pos) {
|
|
2207
|
-
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) :
|
|
2655
|
+
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : new kakao.maps.LatLng(0, 0);
|
|
2208
2656
|
};
|
|
2209
2657
|
|
|
2210
2658
|
KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
|
|
2211
|
-
return latLng ? new Position(latLng.getLat(), latLng.getLng()) :
|
|
2659
|
+
return latLng ? new Position(latLng.getLat(), latLng.getLng()) : new Position(0, 0);
|
|
2212
2660
|
};
|
|
2213
2661
|
|
|
2214
2662
|
return KakaoMintMapController;
|
|
2215
2663
|
}(MintMapController);
|
|
2216
2664
|
|
|
2217
|
-
var
|
|
2218
|
-
function Position(lat, lng) {
|
|
2219
|
-
this.lat = 0;
|
|
2220
|
-
this.lng = 0;
|
|
2221
|
-
this.lat = lat;
|
|
2222
|
-
this.lng = lng;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
Position.equals = function (pos1, pos2) {
|
|
2226
|
-
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
2227
|
-
};
|
|
2228
|
-
|
|
2229
|
-
return Position;
|
|
2230
|
-
}();
|
|
2231
|
-
|
|
2232
|
-
var Bounds = function () {
|
|
2233
|
-
function Bounds(nw, se, ne, sw) {
|
|
2234
|
-
if (!(nw && se || ne && sw)) {
|
|
2235
|
-
throw new Error('nw/se or ne/sw needed');
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
this.nw = nw;
|
|
2239
|
-
this.se = se;
|
|
2240
|
-
this.ne = ne;
|
|
2241
|
-
this.sw = sw;
|
|
2242
|
-
|
|
2243
|
-
if (nw && se) {
|
|
2244
|
-
this.covertNWSEtoNESW(nw, se);
|
|
2245
|
-
} else if (ne && sw) {
|
|
2246
|
-
this.covertNESWtoNWSE(ne, sw);
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
Bounds.fromNWSE = function (nw, se) {
|
|
2251
|
-
return new Bounds(nw, se, undefined, undefined);
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
|
-
Bounds.fromNESW = function (ne, sw) {
|
|
2255
|
-
return new Bounds(undefined, undefined, ne, sw);
|
|
2256
|
-
};
|
|
2257
|
-
|
|
2258
|
-
Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
|
|
2259
|
-
this.ne = new Position(nw.lat, se.lng);
|
|
2260
|
-
this.sw = new Position(se.lat, nw.lng);
|
|
2261
|
-
};
|
|
2262
|
-
|
|
2263
|
-
Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
|
|
2264
|
-
this.nw = new Position(ne.lat, sw.lng);
|
|
2265
|
-
this.se = new Position(sw.lat, ne.lng);
|
|
2266
|
-
};
|
|
2267
|
-
|
|
2268
|
-
Bounds.prototype.getCenter = function () {
|
|
2269
|
-
return new Position(this.se.lat + (this.nw.lat - this.se.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
|
|
2270
|
-
};
|
|
2271
|
-
|
|
2272
|
-
Bounds.prototype.includesPosition = function (pos) {
|
|
2273
|
-
return this.nw.lng < pos.lng && this.se.lng > pos.lng && this.se.lat < pos.lat && this.nw.lat > pos.lat;
|
|
2274
|
-
};
|
|
2275
|
-
|
|
2276
|
-
Bounds.prototype.getIncludedPositions = function (positions) {
|
|
2277
|
-
var result = [];
|
|
2278
|
-
|
|
2279
|
-
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
2280
|
-
var pos = positions_1[_i];
|
|
2281
|
-
|
|
2282
|
-
if (this.includesPosition(pos)) {
|
|
2283
|
-
result.push(pos);
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
return result;
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
Bounds.prototype.includes = function (positions) {
|
|
2291
|
-
positions = Array.isArray(positions) ? positions : [positions];
|
|
2292
|
-
|
|
2293
|
-
for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
|
|
2294
|
-
var pos = positions_2[_i];
|
|
2295
|
-
|
|
2296
|
-
if (!this.includesPosition(pos)) {
|
|
2297
|
-
return false;
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
return true;
|
|
2302
|
-
};
|
|
2303
|
-
|
|
2304
|
-
Bounds.prototype.includesOnlyOnePoint = function (positions) {
|
|
2305
|
-
for (var _i = 0, positions_3 = positions; _i < positions_3.length; _i++) {
|
|
2306
|
-
var pos = positions_3[_i];
|
|
2665
|
+
var cn$2 = classNames__default["default"].bind(styles$2); //지도 기본 센터
|
|
2307
2666
|
|
|
2308
|
-
if (this.includesPosition(pos)) {
|
|
2309
|
-
return true;
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
|
|
2313
|
-
return false;
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
Bounds.prototype.intersects = function (positions) {
|
|
2317
|
-
return PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
2318
|
-
};
|
|
2319
|
-
|
|
2320
|
-
return Bounds;
|
|
2321
|
-
}();
|
|
2322
|
-
|
|
2323
|
-
var Offset = function () {
|
|
2324
|
-
function Offset(x, y) {
|
|
2325
|
-
this.x = x;
|
|
2326
|
-
this.y = y;
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
|
-
return Offset;
|
|
2330
|
-
}();
|
|
2331
|
-
|
|
2332
|
-
var Drawable = function () {
|
|
2333
|
-
function Drawable() {}
|
|
2334
|
-
|
|
2335
|
-
return Drawable;
|
|
2336
|
-
}();
|
|
2337
|
-
|
|
2338
|
-
var Marker = function (_super) {
|
|
2339
|
-
tslib.__extends(Marker, _super);
|
|
2340
|
-
|
|
2341
|
-
function Marker(options) {
|
|
2342
|
-
var _this = _super.call(this) || this;
|
|
2343
|
-
|
|
2344
|
-
_this.options = options;
|
|
2345
|
-
return _this;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
return Marker;
|
|
2349
|
-
}(Drawable);
|
|
2350
|
-
|
|
2351
|
-
var Polyline = function (_super) {
|
|
2352
|
-
tslib.__extends(Polyline, _super);
|
|
2353
|
-
|
|
2354
|
-
function Polyline(options) {
|
|
2355
|
-
var _this = _super.call(this) || this;
|
|
2356
|
-
|
|
2357
|
-
_this.options = options;
|
|
2358
|
-
return _this;
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
return Polyline;
|
|
2362
|
-
}(Drawable);
|
|
2363
|
-
|
|
2364
|
-
var Polygon = function (_super) {
|
|
2365
|
-
tslib.__extends(Polygon, _super);
|
|
2366
|
-
|
|
2367
|
-
function Polygon(options) {
|
|
2368
|
-
var _this = _super.call(this) || this;
|
|
2369
|
-
|
|
2370
|
-
_this.options = options;
|
|
2371
|
-
return _this;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
Polygon.prototype.getCenter = function () {
|
|
2375
|
-
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
2376
|
-
var paths = this.options.position.map(function (elem) {
|
|
2377
|
-
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
2378
|
-
});
|
|
2379
|
-
return PolygonCalculator.getCenter(paths);
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
throw new Error('center 를 찾을 수 없습니다.');
|
|
2383
|
-
};
|
|
2384
|
-
|
|
2385
|
-
return Polygon;
|
|
2386
|
-
}(Drawable);
|
|
2387
|
-
var cn$1 = classNames__default["default"].bind(styles$2);
|
|
2388
2667
|
var DEFAULT_CENTER = {
|
|
2389
2668
|
lat: 37.5036845,
|
|
2390
2669
|
lng: 127.0448698
|
|
2391
|
-
};
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
mapType: mapType
|
|
2427
|
-
}, props), {
|
|
2428
|
-
base: base
|
|
2429
|
-
})) :
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
style: {
|
|
2469
|
-
position: 'absolute',
|
|
2470
|
-
top: '0px',
|
|
2471
|
-
left: '0px',
|
|
2472
|
-
width: '100%',
|
|
2473
|
-
height: '100%',
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
if (pointStringIndex >= pointCount) {
|
|
2501
|
-
pointStringIndex = 0;
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
setPointString(pointStringPool[pointStringIndex]);
|
|
2505
|
-
}, speedMs);
|
|
2506
|
-
return function () {
|
|
2507
|
-
interval && clearInterval(interval);
|
|
2508
|
-
};
|
|
2509
|
-
}, []);
|
|
2510
|
-
return React__default["default"].createElement("div", {
|
|
2511
|
-
className: cn$1('loading-point-container')
|
|
2512
|
-
}, React__default["default"].createElement("div", {
|
|
2513
|
-
style: {
|
|
2514
|
-
width: '300px',
|
|
2515
|
-
fontSize: '16px',
|
|
2516
|
-
fontWeight: 600,
|
|
2517
|
-
color: 'gray',
|
|
2518
|
-
transform: 'translateX(130px)'
|
|
2519
|
-
}
|
|
2520
|
-
}, "".concat(text, " ").concat(pointString)));
|
|
2521
|
-
}
|
|
2522
|
-
function MapLoadingWithImage(_a) {
|
|
2523
|
-
var _b = _a.size,
|
|
2524
|
-
size = _b === void 0 ? 256 : _b;
|
|
2525
|
-
|
|
2526
|
-
var _c = React.useState(),
|
|
2527
|
-
width = _c[0],
|
|
2528
|
-
setWidth = _c[1];
|
|
2529
|
-
|
|
2530
|
-
var _d = React.useState(),
|
|
2531
|
-
height = _d[0],
|
|
2532
|
-
setHeight = _d[1];
|
|
2533
|
-
|
|
2534
|
-
var render = React.useMemo(function () {
|
|
2535
|
-
if (!height || !width) {
|
|
2536
|
-
return;
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
var row = Math.ceil(height / size);
|
|
2540
|
-
var col = Math.ceil(width / size);
|
|
2541
|
-
console.log('re render', width, height, row, col);
|
|
2542
|
-
return Array.from(Array(row)).map(function () {
|
|
2543
|
-
return React__default["default"].createElement("div", {
|
|
2544
|
-
style: {
|
|
2545
|
-
display: 'flex'
|
|
2546
|
-
}
|
|
2547
|
-
}, Array.from(Array(col)).map(function () {
|
|
2548
|
-
var duration = Number((Math.random() * 4).toFixed(1)) + 1;
|
|
2549
|
-
var delay = Number((Math.random() * 4).toFixed(1)) + 2;
|
|
2550
|
-
return React__default["default"].createElement(LoadingImage, {
|
|
2551
|
-
size: size,
|
|
2552
|
-
duration: duration,
|
|
2553
|
-
delay: delay
|
|
2554
|
-
});
|
|
2555
|
-
}));
|
|
2556
|
-
});
|
|
2557
|
-
}, [width, height]);
|
|
2558
|
-
return React__default["default"].createElement("div", {
|
|
2559
|
-
ref: function (refs) {
|
|
2560
|
-
setWidth(refs === null || refs === void 0 ? void 0 : refs.offsetWidth);
|
|
2561
|
-
setHeight(refs === null || refs === void 0 ? void 0 : refs.offsetHeight);
|
|
2562
|
-
},
|
|
2563
|
-
style: {
|
|
2564
|
-
width: '100%',
|
|
2565
|
-
height: '100%',
|
|
2566
|
-
overflow: 'hidden'
|
|
2567
|
-
}
|
|
2568
|
-
}, render);
|
|
2569
|
-
}
|
|
2570
|
-
|
|
2571
|
-
function LoadingImage(_a) {
|
|
2572
|
-
var _b = _a.size,
|
|
2573
|
-
size = _b === void 0 ? 256 : _b,
|
|
2574
|
-
_c = _a.duration,
|
|
2575
|
-
duration = _c === void 0 ? 1 : _c,
|
|
2576
|
-
_d = _a.delay,
|
|
2577
|
-
delay = _d === void 0 ? 1 : _d;
|
|
2578
|
-
var scale = 256 / 4000;
|
|
2579
|
-
return React__default["default"].createElement("svg", {
|
|
2580
|
-
className: cn$1("ani-fade-in"),
|
|
2581
|
-
style: {
|
|
2582
|
-
flex: "0 0 ".concat(size, "px"),
|
|
2583
|
-
opacity: 0,
|
|
2584
|
-
animationDelay: "".concat(delay, "s"),
|
|
2585
|
-
animationDuration: "".concat(duration, "s"),
|
|
2586
|
-
animationFillMode: 'forwards'
|
|
2587
|
-
},
|
|
2588
|
-
width: size,
|
|
2589
|
-
height: size,
|
|
2590
|
-
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
2591
|
-
fill: "none",
|
|
2592
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2593
|
-
}, React__default["default"].createElement("g", {
|
|
2594
|
-
transform: "scale(".concat(scale, ")"),
|
|
2595
|
-
"clip-path": "url(#clip0_5_701)"
|
|
2596
|
-
}, React__default["default"].createElement("rect", {
|
|
2597
|
-
width: "4000",
|
|
2598
|
-
height: "4000",
|
|
2599
|
-
transform: "translate(0 4000) rotate(-90)",
|
|
2600
|
-
fill: "#F8F8F8"
|
|
2601
|
-
}), React__default["default"].createElement("path", {
|
|
2602
|
-
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
2603
|
-
fill: "#E6E6E6"
|
|
2604
|
-
}), React__default["default"].createElement("path", {
|
|
2605
|
-
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
2606
|
-
fill: "#F6E4DD"
|
|
2607
|
-
}), React__default["default"].createElement("path", {
|
|
2608
|
-
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
2609
|
-
fill: "#DCEACA"
|
|
2610
|
-
}), React__default["default"].createElement("path", {
|
|
2611
|
-
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
2612
|
-
fill: "#E6E6E6"
|
|
2613
|
-
}), React__default["default"].createElement("path", {
|
|
2614
|
-
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
2615
|
-
fill: "#DCEACA"
|
|
2616
|
-
}), React__default["default"].createElement("path", {
|
|
2617
|
-
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",
|
|
2618
|
-
fill: "#A2CAEE"
|
|
2619
|
-
}), React__default["default"].createElement("circle", {
|
|
2620
|
-
cx: "958",
|
|
2621
|
-
cy: "3092",
|
|
2622
|
-
r: "95",
|
|
2623
|
-
fill: "#A2CAEE"
|
|
2624
|
-
}), React__default["default"].createElement("circle", {
|
|
2625
|
-
cx: "1127",
|
|
2626
|
-
cy: "3176",
|
|
2627
|
-
r: "56",
|
|
2628
|
-
fill: "#A2CAEE"
|
|
2629
|
-
}), React__default["default"].createElement("path", {
|
|
2630
|
-
"fill-rule": "evenodd",
|
|
2631
|
-
"clip-rule": "evenodd",
|
|
2632
|
-
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
2633
|
-
fill: "white"
|
|
2634
|
-
}), React__default["default"].createElement("path", {
|
|
2635
|
-
"fill-rule": "evenodd",
|
|
2636
|
-
"clip-rule": "evenodd",
|
|
2637
|
-
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",
|
|
2638
|
-
fill: "white"
|
|
2639
|
-
}), React__default["default"].createElement("path", {
|
|
2640
|
-
"fill-rule": "evenodd",
|
|
2641
|
-
"clip-rule": "evenodd",
|
|
2642
|
-
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
2643
|
-
fill: "#FBEDB1"
|
|
2644
|
-
}), React__default["default"].createElement("path", {
|
|
2645
|
-
"fill-rule": "evenodd",
|
|
2646
|
-
"clip-rule": "evenodd",
|
|
2647
|
-
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
2648
|
-
fill: "white"
|
|
2649
|
-
}), React__default["default"].createElement("path", {
|
|
2650
|
-
"fill-rule": "evenodd",
|
|
2651
|
-
"clip-rule": "evenodd",
|
|
2652
|
-
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
2653
|
-
fill: "white"
|
|
2654
|
-
}), React__default["default"].createElement("path", {
|
|
2655
|
-
"fill-rule": "evenodd",
|
|
2656
|
-
"clip-rule": "evenodd",
|
|
2657
|
-
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
2658
|
-
fill: "white"
|
|
2659
|
-
}), React__default["default"].createElement("path", {
|
|
2660
|
-
"fill-rule": "evenodd",
|
|
2661
|
-
"clip-rule": "evenodd",
|
|
2662
|
-
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
2663
|
-
fill: "white"
|
|
2664
|
-
}), React__default["default"].createElement("path", {
|
|
2665
|
-
"fill-rule": "evenodd",
|
|
2666
|
-
"clip-rule": "evenodd",
|
|
2667
|
-
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
2668
|
-
fill: "white"
|
|
2669
|
-
}), React__default["default"].createElement("path", {
|
|
2670
|
-
"fill-rule": "evenodd",
|
|
2671
|
-
"clip-rule": "evenodd",
|
|
2672
|
-
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
2673
|
-
fill: "white"
|
|
2674
|
-
}), React__default["default"].createElement("path", {
|
|
2675
|
-
"fill-rule": "evenodd",
|
|
2676
|
-
"clip-rule": "evenodd",
|
|
2677
|
-
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
2678
|
-
fill: "white"
|
|
2679
|
-
}), React__default["default"].createElement("path", {
|
|
2680
|
-
"fill-rule": "evenodd",
|
|
2681
|
-
"clip-rule": "evenodd",
|
|
2682
|
-
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
2683
|
-
fill: "white"
|
|
2684
|
-
}), React__default["default"].createElement("path", {
|
|
2685
|
-
"fill-rule": "evenodd",
|
|
2686
|
-
"clip-rule": "evenodd",
|
|
2687
|
-
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",
|
|
2688
|
-
fill: "white"
|
|
2689
|
-
}), React__default["default"].createElement("path", {
|
|
2690
|
-
"fill-rule": "evenodd",
|
|
2691
|
-
"clip-rule": "evenodd",
|
|
2692
|
-
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
2693
|
-
fill: "white"
|
|
2694
|
-
}), React__default["default"].createElement("path", {
|
|
2695
|
-
"fill-rule": "evenodd",
|
|
2696
|
-
"clip-rule": "evenodd",
|
|
2697
|
-
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
2698
|
-
fill: "white"
|
|
2699
|
-
}), React__default["default"].createElement("path", {
|
|
2700
|
-
"fill-rule": "evenodd",
|
|
2701
|
-
"clip-rule": "evenodd",
|
|
2702
|
-
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
2703
|
-
fill: "white"
|
|
2704
|
-
}), React__default["default"].createElement("path", {
|
|
2705
|
-
"fill-rule": "evenodd",
|
|
2706
|
-
"clip-rule": "evenodd",
|
|
2707
|
-
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",
|
|
2708
|
-
fill: "#FBEDB1"
|
|
2709
|
-
})), React__default["default"].createElement("defs", null, React__default["default"].createElement("clipPath", {
|
|
2710
|
-
id: "clip0_5_701"
|
|
2711
|
-
}, React__default["default"].createElement("rect", {
|
|
2712
|
-
width: "4000",
|
|
2713
|
-
height: "4000",
|
|
2714
|
-
fill: "white",
|
|
2715
|
-
transform: "translate(0 4000) rotate(-90)"
|
|
2716
|
-
}))));
|
|
2670
|
+
};
|
|
2671
|
+
/**
|
|
2672
|
+
* Mint Map 컴포넌트
|
|
2673
|
+
*
|
|
2674
|
+
* @param {MintMapProps} MintMapProps
|
|
2675
|
+
*
|
|
2676
|
+
* @returns {JSX.Element} JSX
|
|
2677
|
+
*/
|
|
2678
|
+
|
|
2679
|
+
function MintMap(_a) {
|
|
2680
|
+
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
2681
|
+
_b = _a.dissolveEffectWhenLoaded,
|
|
2682
|
+
dissolveEffectWhenLoaded = _b === void 0 ? true : _b,
|
|
2683
|
+
mapType = _a.mapType,
|
|
2684
|
+
children = _a.children,
|
|
2685
|
+
_c = _a.base,
|
|
2686
|
+
base = _c === void 0 ? {
|
|
2687
|
+
center: DEFAULT_CENTER,
|
|
2688
|
+
zoomLevel: 12
|
|
2689
|
+
} : _c,
|
|
2690
|
+
props = tslib.__rest(_a, ["mapLoadingComponent", "dissolveEffectWhenLoaded", "mapType", "children", "base"]);
|
|
2691
|
+
|
|
2692
|
+
var loadingRef = React.useRef(null);
|
|
2693
|
+
|
|
2694
|
+
var _d = React.useState(),
|
|
2695
|
+
controller = _d[0],
|
|
2696
|
+
setController = _d[1];
|
|
2697
|
+
|
|
2698
|
+
var loading = React.useMemo(function () {
|
|
2699
|
+
return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
2700
|
+
}, [mapLoadingComponent]);
|
|
2701
|
+
React.useEffect(function () {
|
|
2702
|
+
if (mapType && mapType.length > 0) {
|
|
2703
|
+
setController(undefined);
|
|
2704
|
+
var newController_1 = mapType === 'naver' ? new NaverMintMapController(tslib.__assign(tslib.__assign({
|
|
2705
|
+
mapType: mapType
|
|
2706
|
+
}, props), {
|
|
2707
|
+
base: base
|
|
2708
|
+
})) : mapType === 'google' ? new GoogleMintMapController(tslib.__assign(tslib.__assign({
|
|
2709
|
+
mapType: mapType
|
|
2710
|
+
}, props), {
|
|
2711
|
+
base: base
|
|
2712
|
+
})) : mapType === 'kakao' ? new KakaoMintMapController(tslib.__assign(tslib.__assign({
|
|
2713
|
+
mapType: mapType
|
|
2714
|
+
}, props), {
|
|
2715
|
+
base: base
|
|
2716
|
+
})) : null;
|
|
2717
|
+
|
|
2718
|
+
if (newController_1) {
|
|
2719
|
+
newController_1.loadMapApi().then(function () {
|
|
2720
|
+
setController(newController_1); // fade in 로직은 일단 스킵
|
|
2721
|
+
// if(dissolveEffectWhenLoaded && loadingRef.current){
|
|
2722
|
+
// const elemStyle = loadingRef.current.style
|
|
2723
|
+
// elemStyle.background = 'white'
|
|
2724
|
+
// elemStyle.opacity = '0'
|
|
2725
|
+
// elemStyle.animationDuration = '0.1s'
|
|
2726
|
+
// loadingRef.current.addEventListener('animationend', ()=>{
|
|
2727
|
+
// setController(newController as MintMapController)
|
|
2728
|
+
// }, {
|
|
2729
|
+
// once:true
|
|
2730
|
+
// })
|
|
2731
|
+
// loadingRef.current.classList.add(cn('ani-fade-in'))
|
|
2732
|
+
// }else{
|
|
2733
|
+
// setController(newController as MintMapController)
|
|
2734
|
+
// }
|
|
2735
|
+
});
|
|
2736
|
+
} else {
|
|
2737
|
+
throw new Error("Not Supported Map type ".concat(mapType));
|
|
2738
|
+
}
|
|
2739
|
+
} else {
|
|
2740
|
+
setController(undefined);
|
|
2741
|
+
}
|
|
2742
|
+
}, [mapType]);
|
|
2743
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, controller ? React__default["default"].createElement(MintMapProvider, {
|
|
2744
|
+
controller: controller
|
|
2745
|
+
}, dissolveEffectWhenLoaded && React__default["default"].createElement("div", {
|
|
2746
|
+
className: cn$2('ani-fade-out'),
|
|
2747
|
+
style: {
|
|
2748
|
+
position: 'absolute',
|
|
2749
|
+
top: '0px',
|
|
2750
|
+
left: '0px',
|
|
2751
|
+
width: '100%',
|
|
2752
|
+
height: '100%',
|
|
2753
|
+
background: 'white',
|
|
2754
|
+
zIndex: 1000,
|
|
2755
|
+
animationFillMode: 'forwards',
|
|
2756
|
+
animationDuration: '0.7s'
|
|
2757
|
+
},
|
|
2758
|
+
onAnimationEnd: function (e) {
|
|
2759
|
+
e.target.style.display = 'none';
|
|
2760
|
+
}
|
|
2761
|
+
}), React__default["default"].createElement(MintMapCore, tslib.__assign({
|
|
2762
|
+
mapType: mapType
|
|
2763
|
+
}, props, {
|
|
2764
|
+
base: base
|
|
2765
|
+
}), children)) : React__default["default"].createElement(React__default["default"].Fragment, null, dissolveEffectWhenLoaded && React__default["default"].createElement("div", {
|
|
2766
|
+
ref: function (refs) {
|
|
2767
|
+
loadingRef.current = refs;
|
|
2768
|
+
},
|
|
2769
|
+
style: {
|
|
2770
|
+
position: 'absolute',
|
|
2771
|
+
top: '0px',
|
|
2772
|
+
left: '0px',
|
|
2773
|
+
width: '100%',
|
|
2774
|
+
height: '100%',
|
|
2775
|
+
zIndex: 1000
|
|
2776
|
+
}
|
|
2777
|
+
}), loading));
|
|
2717
2778
|
}
|
|
2718
2779
|
|
|
2719
|
-
var MintMapCanvasRenderer =
|
|
2780
|
+
var MintMapCanvasRenderer =
|
|
2781
|
+
/** @class */
|
|
2782
|
+
function () {
|
|
2720
2783
|
function MintMapCanvasRenderer(context) {
|
|
2721
2784
|
this.context = context;
|
|
2722
2785
|
}
|
|
@@ -2724,7 +2787,9 @@
|
|
|
2724
2787
|
return MintMapCanvasRenderer;
|
|
2725
2788
|
}();
|
|
2726
2789
|
|
|
2727
|
-
var AnimationPlayer =
|
|
2790
|
+
var AnimationPlayer =
|
|
2791
|
+
/** @class */
|
|
2792
|
+
function () {
|
|
2728
2793
|
function AnimationPlayer(drawFunction, fps) {
|
|
2729
2794
|
this.prevtime = 0;
|
|
2730
2795
|
this.elapsedTime = 0;
|
|
@@ -2759,21 +2824,27 @@
|
|
|
2759
2824
|
};
|
|
2760
2825
|
|
|
2761
2826
|
AnimationPlayer.prototype.resume = function () {
|
|
2762
|
-
this.playing = true;
|
|
2827
|
+
this.playing = true; //@ts-ignore
|
|
2828
|
+
|
|
2763
2829
|
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
2764
2830
|
};
|
|
2765
2831
|
|
|
2766
2832
|
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
2833
|
+
//frame 간 시간 변화
|
|
2767
2834
|
if (this.prevtime === 0) {
|
|
2768
2835
|
this.prevtime = timestamp;
|
|
2769
2836
|
}
|
|
2770
2837
|
|
|
2771
|
-
this.deltaTime += timestamp - this.prevtime;
|
|
2838
|
+
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
2839
|
+
|
|
2772
2840
|
this.prevtime = timestamp;
|
|
2773
2841
|
|
|
2774
2842
|
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
2775
|
-
|
|
2776
|
-
|
|
2843
|
+
//다음 루프 준비
|
|
2844
|
+
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
2845
|
+
|
|
2846
|
+
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
2847
|
+
|
|
2777
2848
|
this.deltaTime = 0;
|
|
2778
2849
|
|
|
2779
2850
|
if (stopFlag) {
|
|
@@ -2782,6 +2853,7 @@
|
|
|
2782
2853
|
}
|
|
2783
2854
|
|
|
2784
2855
|
if (this.playing) {
|
|
2856
|
+
//@ts-ignore
|
|
2785
2857
|
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
2786
2858
|
}
|
|
2787
2859
|
};
|
|
@@ -2815,13 +2887,16 @@
|
|
|
2815
2887
|
_h = _a.velocity,
|
|
2816
2888
|
velocity = _h === void 0 ? 10 : _h,
|
|
2817
2889
|
onMovingStart = _a.onMovingStart,
|
|
2818
|
-
onMovingEnd = _a.onMovingEnd;
|
|
2890
|
+
onMovingEnd = _a.onMovingEnd; //controller
|
|
2891
|
+
|
|
2819
2892
|
var controller = useMintMapController();
|
|
2820
2893
|
React.useEffect(function () {
|
|
2894
|
+
//console.log('velocity changed!!!!', velocity);
|
|
2821
2895
|
contextRef.current && (contextRef.current.velocityKmh = velocity);
|
|
2822
2896
|
}, [velocity]);
|
|
2823
2897
|
var contextRef = React.useRef();
|
|
2824
2898
|
React.useEffect(function () {
|
|
2899
|
+
//console.log('ani marker', marker);
|
|
2825
2900
|
if (marker) {
|
|
2826
2901
|
var currTargetIndex_1 = nextIndex(positions, startPositionIndex);
|
|
2827
2902
|
var stopNext_1 = false;
|
|
@@ -2839,15 +2914,19 @@
|
|
|
2839
2914
|
var draw = function (frameGapTime, _elapsedTime) {
|
|
2840
2915
|
if (!marker) {
|
|
2841
2916
|
console.log('myMarker is not exist!!!');
|
|
2842
|
-
return true;
|
|
2843
|
-
}
|
|
2917
|
+
return true; //종료
|
|
2918
|
+
} //지난 시간
|
|
2919
|
+
|
|
2844
2920
|
|
|
2845
|
-
context_1.elapsedTimeMs = frameGapTime;
|
|
2921
|
+
context_1.elapsedTimeMs = frameGapTime; //next position 계산
|
|
2846
2922
|
|
|
2847
2923
|
while (true) {
|
|
2848
|
-
|
|
2924
|
+
//계산
|
|
2925
|
+
GeoCalulator.computeNextPositionAndDistances(context_1); //타겟에 도착했으면, 원래 얼마나 더 갈수 있었는지 체크해서
|
|
2926
|
+
//그 만큼 더 가도록 계속 처리하기위해 다시 계산
|
|
2849
2927
|
|
|
2850
2928
|
if (context_1.nextPos === context_1.pos2) {
|
|
2929
|
+
//다음 목표가 시작점과 같으면 loop 카운트 +1
|
|
2851
2930
|
if (currTargetIndex_1 === startPositionIndex) {
|
|
2852
2931
|
loopCount_1 += 1;
|
|
2853
2932
|
}
|
|
@@ -2855,9 +2934,11 @@
|
|
|
2855
2934
|
if (!loop && loopCount_1 > 0) {
|
|
2856
2935
|
stopNext_1 = true;
|
|
2857
2936
|
break;
|
|
2858
|
-
}
|
|
2937
|
+
} //현재 출발점
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
context_1.pos1 = positions[currTargetIndex_1]; //현재 목표점
|
|
2859
2941
|
|
|
2860
|
-
context_1.pos1 = positions[currTargetIndex_1];
|
|
2861
2942
|
currTargetIndex_1 = nextIndex(positions, currTargetIndex_1);
|
|
2862
2943
|
|
|
2863
2944
|
if (currTargetIndex_1 === 0 && !positionClosed) {
|
|
@@ -2877,7 +2958,7 @@
|
|
|
2877
2958
|
|
|
2878
2959
|
if (stopNext_1) {
|
|
2879
2960
|
onMovingEnd && onMovingEnd();
|
|
2880
|
-
return true;
|
|
2961
|
+
return true; //종료
|
|
2881
2962
|
}
|
|
2882
2963
|
|
|
2883
2964
|
return false;
|
|
@@ -2924,13 +3005,102 @@
|
|
|
2924
3005
|
return [start, stop, resume];
|
|
2925
3006
|
}
|
|
2926
3007
|
|
|
3008
|
+
var Drawable =
|
|
3009
|
+
/** @class */
|
|
3010
|
+
function () {
|
|
3011
|
+
function Drawable() {}
|
|
3012
|
+
|
|
3013
|
+
return Drawable;
|
|
3014
|
+
}();
|
|
3015
|
+
|
|
3016
|
+
var Marker =
|
|
3017
|
+
/** @class */
|
|
3018
|
+
function (_super) {
|
|
3019
|
+
tslib.__extends(Marker, _super);
|
|
3020
|
+
/**
|
|
3021
|
+
* 지도에 표시할 마커정보
|
|
3022
|
+
*/
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
function Marker(options) {
|
|
3026
|
+
var _this = _super.call(this) || this;
|
|
3027
|
+
|
|
3028
|
+
_this.options = options;
|
|
3029
|
+
return _this;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
return Marker;
|
|
3033
|
+
}(Drawable);
|
|
3034
|
+
|
|
3035
|
+
var Polyline =
|
|
3036
|
+
/** @class */
|
|
3037
|
+
function (_super) {
|
|
3038
|
+
tslib.__extends(Polyline, _super);
|
|
3039
|
+
/**
|
|
3040
|
+
* 지도에 표시할 폴리곤정보
|
|
3041
|
+
*/
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
function Polyline(options) {
|
|
3045
|
+
var _this = _super.call(this) || this;
|
|
3046
|
+
|
|
3047
|
+
_this.options = options;
|
|
3048
|
+
return _this;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
return Polyline;
|
|
3052
|
+
}(Drawable);
|
|
3053
|
+
|
|
3054
|
+
var Polygon =
|
|
3055
|
+
/** @class */
|
|
3056
|
+
function (_super) {
|
|
3057
|
+
tslib.__extends(Polygon, _super);
|
|
3058
|
+
/**
|
|
3059
|
+
* 지도에 표시할 폴리곤정보
|
|
3060
|
+
*/
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
function Polygon(options) {
|
|
3064
|
+
var _this = _super.call(this) || this;
|
|
3065
|
+
|
|
3066
|
+
_this.options = options;
|
|
3067
|
+
return _this;
|
|
3068
|
+
}
|
|
3069
|
+
/**
|
|
3070
|
+
* 폴리곤의 중점을 구한다.
|
|
3071
|
+
*/
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
Polygon.prototype.getCenter = function () {
|
|
3075
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
3076
|
+
var paths = this.options.position.map(function (elem) {
|
|
3077
|
+
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
3078
|
+
});
|
|
3079
|
+
return PolygonCalculator.getCenter(paths);
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
3083
|
+
};
|
|
3084
|
+
|
|
3085
|
+
return Polygon;
|
|
3086
|
+
}(Drawable);
|
|
3087
|
+
|
|
2927
3088
|
var offsetCalibration = function (mapType, divElement, options) {
|
|
3089
|
+
//google 맵의 anchor 보정 (네이버와 같이 왼쪽/위 기준으로 처리)
|
|
2928
3090
|
if (mapType === 'google') {
|
|
2929
3091
|
divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2930
3092
|
} else if (mapType === 'kakao') {
|
|
2931
3093
|
divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2932
3094
|
}
|
|
2933
3095
|
};
|
|
3096
|
+
/**
|
|
3097
|
+
* Mint Map 컴포넌트
|
|
3098
|
+
*
|
|
3099
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3100
|
+
*
|
|
3101
|
+
* @returns {JSX.Element} JSX
|
|
3102
|
+
*/
|
|
3103
|
+
|
|
2934
3104
|
|
|
2935
3105
|
function MapMarkerWrapper(_a) {
|
|
2936
3106
|
var startAnimationClassName = _a.startAnimationClassName,
|
|
@@ -2941,19 +3111,24 @@
|
|
|
2941
3111
|
topOnHover = _c === void 0 ? false : _c,
|
|
2942
3112
|
movingAnimation = _a.movingAnimation,
|
|
2943
3113
|
children = _a.children,
|
|
2944
|
-
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "children"]);
|
|
3114
|
+
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "children"]); //controller
|
|
3115
|
+
|
|
3116
|
+
|
|
3117
|
+
var controller = useMintMapController(); //element
|
|
2945
3118
|
|
|
2946
|
-
var controller = useMintMapController();
|
|
2947
3119
|
var divRef = React.useRef(document.createElement('div'));
|
|
2948
|
-
var divElement = divRef.current;
|
|
2949
|
-
|
|
2950
|
-
var
|
|
3120
|
+
var divElement = divRef.current; //element clone for animation
|
|
3121
|
+
|
|
3122
|
+
var divCloneRef = React.useRef(); //marker
|
|
3123
|
+
|
|
3124
|
+
var markerRef = React.useRef(); //moving animation
|
|
2951
3125
|
|
|
2952
3126
|
var _d = React.useState({}),
|
|
2953
3127
|
movingState = _d[0],
|
|
2954
3128
|
setMovingState = _d[1];
|
|
2955
3129
|
|
|
2956
3130
|
React.useEffect(function () {
|
|
3131
|
+
// console.log('movingState', movingState);
|
|
2957
3132
|
if (movingState.autoStart) {
|
|
2958
3133
|
setTimeout(function () {
|
|
2959
3134
|
start();
|
|
@@ -2961,18 +3136,20 @@
|
|
|
2961
3136
|
}
|
|
2962
3137
|
}, [movingState]);
|
|
2963
3138
|
React.useEffect(function () {
|
|
3139
|
+
// console.log('movingAnimation changed', movingAnimation);
|
|
2964
3140
|
if (movingAnimation) {
|
|
2965
3141
|
setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
|
|
2966
3142
|
marker: markerRef.current
|
|
2967
3143
|
}));
|
|
2968
3144
|
}
|
|
2969
|
-
}, [movingAnimation]);
|
|
2970
|
-
|
|
3145
|
+
}, [movingAnimation]); //marker moving hook
|
|
3146
|
+
|
|
3147
|
+
var start = useMarkerMoving(movingState)[0]; //event handlers
|
|
2971
3148
|
|
|
2972
3149
|
var onClickHandler = function (e) {
|
|
2973
3150
|
var _a;
|
|
2974
3151
|
|
|
2975
|
-
var marker = markerRef.current;
|
|
3152
|
+
var marker = markerRef.current; //console.log('onClickHandler', marker);
|
|
2976
3153
|
|
|
2977
3154
|
if (marker) {
|
|
2978
3155
|
controller.setMapDragged(false);
|
|
@@ -2991,7 +3168,7 @@
|
|
|
2991
3168
|
var onMouseOverHandler = function (e) {
|
|
2992
3169
|
var _a;
|
|
2993
3170
|
|
|
2994
|
-
var marker = markerRef.current;
|
|
3171
|
+
var marker = markerRef.current; //console.log('onMouseOverHandler', marker);
|
|
2995
3172
|
|
|
2996
3173
|
if (marker) {
|
|
2997
3174
|
var mouseOverHandler = (_a = options === null || options === void 0 ? void 0 : options.event) === null || _a === void 0 ? void 0 : _a.get('mouseover');
|
|
@@ -3004,20 +3181,26 @@
|
|
|
3004
3181
|
|
|
3005
3182
|
next && topOnHover && controller.markerToTheTop(marker);
|
|
3006
3183
|
}
|
|
3007
|
-
};
|
|
3184
|
+
}; //create object
|
|
3185
|
+
|
|
3008
3186
|
|
|
3009
3187
|
React.useEffect(function () {
|
|
3188
|
+
// console.log('drawable created')
|
|
3010
3189
|
divElement.addEventListener('click', onClickHandler);
|
|
3011
3190
|
divElement.addEventListener('mouseover', onMouseOverHandler);
|
|
3012
3191
|
return function () {
|
|
3192
|
+
//** kakao 는 viewport 안에 있는 마커만 렌더링하므로,
|
|
3193
|
+
//마커 해제가 되더라도 애니메이션 이벤트가 일어나지 않아서 해지된 마커가 잠시 보이는 현상이 있음
|
|
3194
|
+
//그래서 kakao 일때는 endAnimationClassName 영향을 받지 않도록 처리함
|
|
3013
3195
|
if (divCloneRef.current && endAnimationClassName && controller.getMapType() !== 'kakao') {
|
|
3014
3196
|
divCloneRef.current.classList.add(endAnimationClassName);
|
|
3015
3197
|
|
|
3016
3198
|
var aniListener_1 = function () {
|
|
3199
|
+
//console.log('animationend!!!', divCloneRef.current);
|
|
3017
3200
|
divCloneRef.current && divCloneRef.current.removeEventListener('animationend', aniListener_1);
|
|
3018
3201
|
|
|
3019
3202
|
if (markerRef.current) {
|
|
3020
|
-
controller.clearDrawable(markerRef.current);
|
|
3203
|
+
controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
|
|
3021
3204
|
}
|
|
3022
3205
|
|
|
3023
3206
|
divCloneRef.current = undefined;
|
|
@@ -3030,35 +3213,42 @@
|
|
|
3030
3213
|
divElement.removeEventListener('mouseover', onMouseOverHandler);
|
|
3031
3214
|
|
|
3032
3215
|
if (markerRef.current) {
|
|
3033
|
-
controller.clearDrawable(markerRef.current);
|
|
3216
|
+
controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
|
|
3034
3217
|
}
|
|
3035
3218
|
}
|
|
3036
3219
|
};
|
|
3037
|
-
}, []);
|
|
3220
|
+
}, []); //create / update object
|
|
3221
|
+
|
|
3038
3222
|
React.useEffect(function () {
|
|
3039
3223
|
if (options) {
|
|
3040
3224
|
if (markerRef.current) {
|
|
3041
|
-
|
|
3042
|
-
|
|
3225
|
+
//console.log('update Marker')
|
|
3226
|
+
controller.updateMarker(markerRef.current, options); //marker offset 보정
|
|
3043
3227
|
|
|
3044
|
-
|
|
3045
|
-
|
|
3228
|
+
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
3229
|
+
|
|
3230
|
+
if (options.zIndex !== undefined) {
|
|
3231
|
+
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
3046
3232
|
}
|
|
3047
3233
|
} else {
|
|
3234
|
+
//console.log('create Marker')
|
|
3048
3235
|
markerRef.current = new Marker(options);
|
|
3049
3236
|
markerRef.current.element = divElement;
|
|
3050
|
-
controller.createMarker(markerRef.current);
|
|
3051
|
-
|
|
3237
|
+
controller.createMarker(markerRef.current); //marker offset 보정
|
|
3238
|
+
|
|
3239
|
+
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
3240
|
+
|
|
3241
|
+
if (options.zIndex !== undefined) {
|
|
3242
|
+
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
3243
|
+
} //moving 애니메이션 시작
|
|
3052
3244
|
|
|
3053
|
-
if (markerRef.current.options.zIndex !== undefined) {
|
|
3054
|
-
controller.setMarkerZIndex(markerRef.current, markerRef.current.options.zIndex);
|
|
3055
|
-
}
|
|
3056
3245
|
|
|
3057
3246
|
if (movingAnimation) {
|
|
3058
3247
|
setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
|
|
3059
3248
|
marker: markerRef.current
|
|
3060
3249
|
}));
|
|
3061
|
-
}
|
|
3250
|
+
} //start animation
|
|
3251
|
+
|
|
3062
3252
|
|
|
3063
3253
|
if (startAnimationClassName) {
|
|
3064
3254
|
divElement.style.visibility = 'hidden';
|
|
@@ -3089,26 +3279,41 @@
|
|
|
3089
3279
|
return reactDom.createPortal(children, divElement);
|
|
3090
3280
|
}
|
|
3091
3281
|
|
|
3282
|
+
/**
|
|
3283
|
+
* Mint Map 컴포넌트
|
|
3284
|
+
*
|
|
3285
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3286
|
+
*
|
|
3287
|
+
* @returns {JSX.Element} JSX
|
|
3288
|
+
*/
|
|
3289
|
+
|
|
3092
3290
|
function MapPolygonWrapper(_a) {
|
|
3093
3291
|
var children = _a.children,
|
|
3094
|
-
options = tslib.__rest(_a, ["children"]);
|
|
3292
|
+
options = tslib.__rest(_a, ["children"]); //controller
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
var controller = useMintMapController(); //lifecycle
|
|
3095
3296
|
|
|
3096
|
-
var controller = useMintMapController();
|
|
3097
3297
|
React.useEffect(function () {
|
|
3098
3298
|
return function () {
|
|
3099
3299
|
if (polygonRef.current) {
|
|
3300
|
+
// console.log('polygon cleared')
|
|
3100
3301
|
controller.clearDrawable(polygonRef.current);
|
|
3101
3302
|
}
|
|
3102
3303
|
};
|
|
3103
|
-
}, []);
|
|
3304
|
+
}, []); //create/update object
|
|
3305
|
+
|
|
3104
3306
|
var polygonRef = React.useRef();
|
|
3105
3307
|
React.useEffect(function () {
|
|
3308
|
+
//console.log('Polygon useEffect')
|
|
3106
3309
|
if (options) {
|
|
3107
3310
|
if (polygonRef.current) {
|
|
3311
|
+
//console.log('update Polygon', options)
|
|
3108
3312
|
controller.updatePolygon(polygonRef.current, options);
|
|
3109
3313
|
} else {
|
|
3110
3314
|
var polygon = new Polygon(options);
|
|
3111
|
-
polygonRef.current = polygon;
|
|
3315
|
+
polygonRef.current = polygon; //console.log('create Polygon', options)
|
|
3316
|
+
|
|
3112
3317
|
controller.createPolygon(polygon);
|
|
3113
3318
|
}
|
|
3114
3319
|
}
|
|
@@ -3180,11 +3385,13 @@
|
|
|
3180
3385
|
var wallPolygons = React.useRef();
|
|
3181
3386
|
var titlePosition = React.useRef();
|
|
3182
3387
|
React.useEffect(function () {
|
|
3388
|
+
//베이스 폴리곤
|
|
3183
3389
|
var base = {
|
|
3184
3390
|
position: basePolygonPath
|
|
3185
3391
|
};
|
|
3186
3392
|
var height = numberOfFloor * heightOfFloor;
|
|
3187
|
-
var projectionHeight = GeoCalulator.convertMeterToLatitudeValue(height);
|
|
3393
|
+
var projectionHeight = GeoCalulator.convertMeterToLatitudeValue(height); //roof
|
|
3394
|
+
|
|
3188
3395
|
var roofPaths = [];
|
|
3189
3396
|
|
|
3190
3397
|
for (var _i = 0, basePolygonPath_1 = basePolygonPath; _i < basePolygonPath_1.length; _i++) {
|
|
@@ -3194,7 +3401,8 @@
|
|
|
3194
3401
|
|
|
3195
3402
|
roofPolygon.current = {
|
|
3196
3403
|
position: roofPaths
|
|
3197
|
-
};
|
|
3404
|
+
}; //walls
|
|
3405
|
+
|
|
3198
3406
|
wallPolygons.current = [];
|
|
3199
3407
|
|
|
3200
3408
|
for (var i = 0; i < basePolygonPath.length; i++) {
|
|
@@ -3205,13 +3413,14 @@
|
|
|
3205
3413
|
wallPolygons.current.push({
|
|
3206
3414
|
position: [start, startNext, endNext, end]
|
|
3207
3415
|
});
|
|
3208
|
-
}
|
|
3416
|
+
} //latitude 기준으로 배열 재정렬
|
|
3417
|
+
|
|
3209
3418
|
|
|
3210
3419
|
wallPolygons.current.sort(function (a, b) {
|
|
3211
3420
|
var maxA = getMaxLat(a.position);
|
|
3212
3421
|
var maxB = getMaxLat(b.position);
|
|
3213
3422
|
return maxA.lat < maxB.lat ? 1 : -1;
|
|
3214
|
-
});
|
|
3423
|
+
}); //latitude 가장 높은값과 longitude 중간값으로 타이틀 위치 결정
|
|
3215
3424
|
|
|
3216
3425
|
if (title || titleElement) {
|
|
3217
3426
|
var maxPos = getMaxLat(wallPolygons.current[0].position);
|
|
@@ -3259,27 +3468,271 @@
|
|
|
3259
3468
|
left: 'calc(50% - 75px)',
|
|
3260
3469
|
top: '-35px'
|
|
3261
3470
|
}
|
|
3262
|
-
}, React__default["default"].createElement("div", {
|
|
3471
|
+
}, React__default["default"].createElement("div", {
|
|
3472
|
+
style: {
|
|
3473
|
+
maxWidth: '150px',
|
|
3474
|
+
border: '1px solid gray',
|
|
3475
|
+
borderRadius: '5px',
|
|
3476
|
+
padding: '2px 5px',
|
|
3477
|
+
background: 'white',
|
|
3478
|
+
fontSize: '12px',
|
|
3479
|
+
fontWeight: 600,
|
|
3480
|
+
color: '#006fd1'
|
|
3481
|
+
}
|
|
3482
|
+
}, "".concat(title, " (").concat(numberOfFloor, "\uCE35)")))));
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
var cn$1 = classNames__default["default"].bind(styles$2);
|
|
3486
|
+
function PointLoading(_a) {
|
|
3487
|
+
var _b = _a.text,
|
|
3488
|
+
text = _b === void 0 ? 'Loading' : _b,
|
|
3489
|
+
_c = _a.pointCount,
|
|
3490
|
+
pointCount = _c === void 0 ? 4 : _c,
|
|
3491
|
+
_d = _a.speedMs,
|
|
3492
|
+
speedMs = _d === void 0 ? 200 : _d;
|
|
3493
|
+
var pointStringPool = React.useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
3494
|
+
return Array.from(Array(idx + 1)).map(function () {
|
|
3495
|
+
return '.';
|
|
3496
|
+
}).join('');
|
|
3497
|
+
}))[0];
|
|
3498
|
+
|
|
3499
|
+
var _e = React.useState(''),
|
|
3500
|
+
pointString = _e[0],
|
|
3501
|
+
setPointString = _e[1];
|
|
3502
|
+
|
|
3503
|
+
React.useEffect(function () {
|
|
3504
|
+
var pointStringIndex = 0;
|
|
3505
|
+
var interval = setInterval(function () {
|
|
3506
|
+
pointStringIndex += 1;
|
|
3507
|
+
|
|
3508
|
+
if (pointStringIndex >= pointCount) {
|
|
3509
|
+
pointStringIndex = 0;
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
setPointString(pointStringPool[pointStringIndex]);
|
|
3513
|
+
}, speedMs);
|
|
3514
|
+
return function () {
|
|
3515
|
+
interval && clearInterval(interval);
|
|
3516
|
+
};
|
|
3517
|
+
}, []);
|
|
3518
|
+
return React__default["default"].createElement("div", {
|
|
3519
|
+
className: cn$1('loading-point-container')
|
|
3520
|
+
}, React__default["default"].createElement("div", {
|
|
3521
|
+
style: {
|
|
3522
|
+
width: '300px',
|
|
3523
|
+
fontSize: '16px',
|
|
3524
|
+
fontWeight: 600,
|
|
3525
|
+
color: 'gray',
|
|
3526
|
+
transform: 'translateX(130px)'
|
|
3527
|
+
}
|
|
3528
|
+
}, "".concat(text, " ").concat(pointString)));
|
|
3529
|
+
}
|
|
3530
|
+
function MapLoadingWithImage(_a) {
|
|
3531
|
+
var _b = _a.size,
|
|
3532
|
+
size = _b === void 0 ? 256 : _b;
|
|
3533
|
+
|
|
3534
|
+
var _c = React.useState(),
|
|
3535
|
+
width = _c[0],
|
|
3536
|
+
setWidth = _c[1];
|
|
3537
|
+
|
|
3538
|
+
var _d = React.useState(),
|
|
3539
|
+
height = _d[0],
|
|
3540
|
+
setHeight = _d[1];
|
|
3541
|
+
|
|
3542
|
+
var render = React.useMemo(function () {
|
|
3543
|
+
if (!height || !width) {
|
|
3544
|
+
return;
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
var row = Math.ceil(height / size);
|
|
3548
|
+
var col = Math.ceil(width / size);
|
|
3549
|
+
console.log('re render', width, height, row, col);
|
|
3550
|
+
return Array.from(Array(row)).map(function () {
|
|
3551
|
+
return React__default["default"].createElement("div", {
|
|
3552
|
+
style: {
|
|
3553
|
+
display: 'flex'
|
|
3554
|
+
}
|
|
3555
|
+
}, Array.from(Array(col)).map(function () {
|
|
3556
|
+
var duration = Number((Math.random() * 4).toFixed(1)) + 1;
|
|
3557
|
+
var delay = Number((Math.random() * 4).toFixed(1)) + 2;
|
|
3558
|
+
return React__default["default"].createElement(LoadingImage, {
|
|
3559
|
+
size: size,
|
|
3560
|
+
duration: duration,
|
|
3561
|
+
delay: delay
|
|
3562
|
+
});
|
|
3563
|
+
}));
|
|
3564
|
+
});
|
|
3565
|
+
}, [width, height]);
|
|
3566
|
+
return React__default["default"].createElement("div", {
|
|
3567
|
+
ref: function (refs) {
|
|
3568
|
+
setWidth(refs === null || refs === void 0 ? void 0 : refs.offsetWidth);
|
|
3569
|
+
setHeight(refs === null || refs === void 0 ? void 0 : refs.offsetHeight);
|
|
3570
|
+
},
|
|
3263
3571
|
style: {
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
padding: '2px 5px',
|
|
3268
|
-
background: 'white',
|
|
3269
|
-
fontSize: '12px',
|
|
3270
|
-
fontWeight: 600,
|
|
3271
|
-
color: '#006fd1'
|
|
3572
|
+
width: '100%',
|
|
3573
|
+
height: '100%',
|
|
3574
|
+
overflow: 'hidden'
|
|
3272
3575
|
}
|
|
3273
|
-
},
|
|
3576
|
+
}, render);
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
function LoadingImage(_a) {
|
|
3580
|
+
var _b = _a.size,
|
|
3581
|
+
size = _b === void 0 ? 256 : _b,
|
|
3582
|
+
_c = _a.duration,
|
|
3583
|
+
duration = _c === void 0 ? 1 : _c,
|
|
3584
|
+
_d = _a.delay,
|
|
3585
|
+
delay = _d === void 0 ? 1 : _d;
|
|
3586
|
+
var scale = 256 / 4000;
|
|
3587
|
+
return React__default["default"].createElement("svg", {
|
|
3588
|
+
className: cn$1("ani-fade-in"),
|
|
3589
|
+
style: {
|
|
3590
|
+
flex: "0 0 ".concat(size, "px"),
|
|
3591
|
+
opacity: 0,
|
|
3592
|
+
animationDelay: "".concat(delay, "s"),
|
|
3593
|
+
animationDuration: "".concat(duration, "s"),
|
|
3594
|
+
animationFillMode: 'forwards'
|
|
3595
|
+
},
|
|
3596
|
+
width: size,
|
|
3597
|
+
height: size,
|
|
3598
|
+
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
3599
|
+
fill: "none",
|
|
3600
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3601
|
+
}, React__default["default"].createElement("g", {
|
|
3602
|
+
transform: "scale(".concat(scale, ")"),
|
|
3603
|
+
"clip-path": "url(#clip0_5_701)"
|
|
3604
|
+
}, React__default["default"].createElement("rect", {
|
|
3605
|
+
width: "4000",
|
|
3606
|
+
height: "4000",
|
|
3607
|
+
transform: "translate(0 4000) rotate(-90)",
|
|
3608
|
+
fill: "#F8F8F8"
|
|
3609
|
+
}), React__default["default"].createElement("path", {
|
|
3610
|
+
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
3611
|
+
fill: "#E6E6E6"
|
|
3612
|
+
}), React__default["default"].createElement("path", {
|
|
3613
|
+
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
3614
|
+
fill: "#F6E4DD"
|
|
3615
|
+
}), React__default["default"].createElement("path", {
|
|
3616
|
+
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
3617
|
+
fill: "#DCEACA"
|
|
3618
|
+
}), React__default["default"].createElement("path", {
|
|
3619
|
+
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
3620
|
+
fill: "#E6E6E6"
|
|
3621
|
+
}), React__default["default"].createElement("path", {
|
|
3622
|
+
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
3623
|
+
fill: "#DCEACA"
|
|
3624
|
+
}), React__default["default"].createElement("path", {
|
|
3625
|
+
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",
|
|
3626
|
+
fill: "#A2CAEE"
|
|
3627
|
+
}), React__default["default"].createElement("circle", {
|
|
3628
|
+
cx: "958",
|
|
3629
|
+
cy: "3092",
|
|
3630
|
+
r: "95",
|
|
3631
|
+
fill: "#A2CAEE"
|
|
3632
|
+
}), React__default["default"].createElement("circle", {
|
|
3633
|
+
cx: "1127",
|
|
3634
|
+
cy: "3176",
|
|
3635
|
+
r: "56",
|
|
3636
|
+
fill: "#A2CAEE"
|
|
3637
|
+
}), React__default["default"].createElement("path", {
|
|
3638
|
+
"fill-rule": "evenodd",
|
|
3639
|
+
"clip-rule": "evenodd",
|
|
3640
|
+
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
3641
|
+
fill: "white"
|
|
3642
|
+
}), React__default["default"].createElement("path", {
|
|
3643
|
+
"fill-rule": "evenodd",
|
|
3644
|
+
"clip-rule": "evenodd",
|
|
3645
|
+
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",
|
|
3646
|
+
fill: "white"
|
|
3647
|
+
}), React__default["default"].createElement("path", {
|
|
3648
|
+
"fill-rule": "evenodd",
|
|
3649
|
+
"clip-rule": "evenodd",
|
|
3650
|
+
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
3651
|
+
fill: "#FBEDB1"
|
|
3652
|
+
}), React__default["default"].createElement("path", {
|
|
3653
|
+
"fill-rule": "evenodd",
|
|
3654
|
+
"clip-rule": "evenodd",
|
|
3655
|
+
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
3656
|
+
fill: "white"
|
|
3657
|
+
}), React__default["default"].createElement("path", {
|
|
3658
|
+
"fill-rule": "evenodd",
|
|
3659
|
+
"clip-rule": "evenodd",
|
|
3660
|
+
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
3661
|
+
fill: "white"
|
|
3662
|
+
}), React__default["default"].createElement("path", {
|
|
3663
|
+
"fill-rule": "evenodd",
|
|
3664
|
+
"clip-rule": "evenodd",
|
|
3665
|
+
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
3666
|
+
fill: "white"
|
|
3667
|
+
}), React__default["default"].createElement("path", {
|
|
3668
|
+
"fill-rule": "evenodd",
|
|
3669
|
+
"clip-rule": "evenodd",
|
|
3670
|
+
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
3671
|
+
fill: "white"
|
|
3672
|
+
}), React__default["default"].createElement("path", {
|
|
3673
|
+
"fill-rule": "evenodd",
|
|
3674
|
+
"clip-rule": "evenodd",
|
|
3675
|
+
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
3676
|
+
fill: "white"
|
|
3677
|
+
}), React__default["default"].createElement("path", {
|
|
3678
|
+
"fill-rule": "evenodd",
|
|
3679
|
+
"clip-rule": "evenodd",
|
|
3680
|
+
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
3681
|
+
fill: "white"
|
|
3682
|
+
}), React__default["default"].createElement("path", {
|
|
3683
|
+
"fill-rule": "evenodd",
|
|
3684
|
+
"clip-rule": "evenodd",
|
|
3685
|
+
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
3686
|
+
fill: "white"
|
|
3687
|
+
}), React__default["default"].createElement("path", {
|
|
3688
|
+
"fill-rule": "evenodd",
|
|
3689
|
+
"clip-rule": "evenodd",
|
|
3690
|
+
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
3691
|
+
fill: "white"
|
|
3692
|
+
}), React__default["default"].createElement("path", {
|
|
3693
|
+
"fill-rule": "evenodd",
|
|
3694
|
+
"clip-rule": "evenodd",
|
|
3695
|
+
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",
|
|
3696
|
+
fill: "white"
|
|
3697
|
+
}), React__default["default"].createElement("path", {
|
|
3698
|
+
"fill-rule": "evenodd",
|
|
3699
|
+
"clip-rule": "evenodd",
|
|
3700
|
+
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
3701
|
+
fill: "white"
|
|
3702
|
+
}), React__default["default"].createElement("path", {
|
|
3703
|
+
"fill-rule": "evenodd",
|
|
3704
|
+
"clip-rule": "evenodd",
|
|
3705
|
+
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
3706
|
+
fill: "white"
|
|
3707
|
+
}), React__default["default"].createElement("path", {
|
|
3708
|
+
"fill-rule": "evenodd",
|
|
3709
|
+
"clip-rule": "evenodd",
|
|
3710
|
+
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
3711
|
+
fill: "white"
|
|
3712
|
+
}), React__default["default"].createElement("path", {
|
|
3713
|
+
"fill-rule": "evenodd",
|
|
3714
|
+
"clip-rule": "evenodd",
|
|
3715
|
+
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",
|
|
3716
|
+
fill: "#FBEDB1"
|
|
3717
|
+
})), React__default["default"].createElement("defs", null, React__default["default"].createElement("clipPath", {
|
|
3718
|
+
id: "clip0_5_701"
|
|
3719
|
+
}, React__default["default"].createElement("rect", {
|
|
3720
|
+
width: "4000",
|
|
3721
|
+
height: "4000",
|
|
3722
|
+
fill: "white",
|
|
3723
|
+
transform: "translate(0 4000) rotate(-90)"
|
|
3724
|
+
}))));
|
|
3274
3725
|
}
|
|
3275
3726
|
|
|
3276
3727
|
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
3277
|
-
var _a;
|
|
3728
|
+
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
3729
|
+
|
|
3278
3730
|
|
|
3279
3731
|
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
3280
|
-
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1;
|
|
3732
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
3733
|
+
|
|
3281
3734
|
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
3282
|
-
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7));
|
|
3735
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
3283
3736
|
var boundsPos = [];
|
|
3284
3737
|
var tempX1, tempY1, tempX2, tempY2;
|
|
3285
3738
|
|
|
@@ -3304,7 +3757,8 @@
|
|
|
3304
3757
|
size: basePixelSize
|
|
3305
3758
|
});
|
|
3306
3759
|
}
|
|
3307
|
-
}
|
|
3760
|
+
} //좌표마다 검사해서 인접셀 병합 처리
|
|
3761
|
+
|
|
3308
3762
|
|
|
3309
3763
|
var centerList = [];
|
|
3310
3764
|
var totalItemCount = 0;
|
|
@@ -3315,7 +3769,8 @@
|
|
|
3315
3769
|
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
3316
3770
|
var curr = boundsPos[i][k];
|
|
3317
3771
|
if (curr.checked) continue;
|
|
3318
|
-
curr.checked = true;
|
|
3772
|
+
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
3773
|
+
|
|
3319
3774
|
var incList = [];
|
|
3320
3775
|
|
|
3321
3776
|
if (boundsPos[i]) {
|
|
@@ -3387,7 +3842,8 @@
|
|
|
3387
3842
|
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
3388
3843
|
var center = centerList_1[_b];
|
|
3389
3844
|
center.size = sizeFunction(center, status);
|
|
3390
|
-
}
|
|
3845
|
+
} // console.log('centerList', centerList, status);
|
|
3846
|
+
|
|
3391
3847
|
|
|
3392
3848
|
return centerList;
|
|
3393
3849
|
};
|
|
@@ -3450,6 +3906,14 @@
|
|
|
3450
3906
|
|
|
3451
3907
|
throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
|
|
3452
3908
|
};
|
|
3909
|
+
/**
|
|
3910
|
+
* Mint Map 컴포넌트
|
|
3911
|
+
*
|
|
3912
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3913
|
+
*
|
|
3914
|
+
* @returns {JSX.Element} JSX
|
|
3915
|
+
*/
|
|
3916
|
+
|
|
3453
3917
|
|
|
3454
3918
|
function MapControlWrapper(_a) {
|
|
3455
3919
|
var _b = _a.width,
|
|
@@ -3472,26 +3936,40 @@
|
|
|
3472
3936
|
}, children);
|
|
3473
3937
|
}
|
|
3474
3938
|
|
|
3939
|
+
/**
|
|
3940
|
+
* Mint Map 컴포넌트
|
|
3941
|
+
*
|
|
3942
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3943
|
+
*
|
|
3944
|
+
* @returns {JSX.Element} JSX
|
|
3945
|
+
*/
|
|
3946
|
+
|
|
3475
3947
|
function MapPolylineWrapper(_a) {
|
|
3476
3948
|
var children = _a.children,
|
|
3477
|
-
options = tslib.__rest(_a, ["children"]);
|
|
3949
|
+
options = tslib.__rest(_a, ["children"]); //controller
|
|
3950
|
+
|
|
3951
|
+
|
|
3952
|
+
var controller = useMintMapController(); //lifecycle
|
|
3478
3953
|
|
|
3479
|
-
var controller = useMintMapController();
|
|
3480
3954
|
React.useEffect(function () {
|
|
3481
3955
|
return function () {
|
|
3482
3956
|
if (polylineRef.current) {
|
|
3483
|
-
controller.clearDrawable(polylineRef.current);
|
|
3957
|
+
controller.clearDrawable(polylineRef.current); // console.log('polyline cleared')
|
|
3484
3958
|
}
|
|
3485
3959
|
};
|
|
3486
|
-
}, []);
|
|
3960
|
+
}, []); //create/update object
|
|
3961
|
+
|
|
3487
3962
|
var polylineRef = React.useRef();
|
|
3488
3963
|
React.useEffect(function () {
|
|
3964
|
+
//console.log('Polyline useEffect')
|
|
3489
3965
|
if (options) {
|
|
3490
3966
|
if (polylineRef.current) {
|
|
3967
|
+
//console.log('update Polyline', options)
|
|
3491
3968
|
controller.updatePolyline(polylineRef.current, options);
|
|
3492
3969
|
} else {
|
|
3493
3970
|
var polyline = new Polyline(options);
|
|
3494
|
-
polylineRef.current = polyline;
|
|
3971
|
+
polylineRef.current = polyline; //console.log('create Polyline', options)
|
|
3972
|
+
|
|
3495
3973
|
controller.createPolyline(polyline);
|
|
3496
3974
|
}
|
|
3497
3975
|
}
|
|
@@ -3503,10 +3981,19 @@
|
|
|
3503
3981
|
log: function () {
|
|
3504
3982
|
}
|
|
3505
3983
|
};
|
|
3984
|
+
/**
|
|
3985
|
+
* Mint Map 컴포넌트
|
|
3986
|
+
*
|
|
3987
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
3988
|
+
*
|
|
3989
|
+
* @returns {JSX.Element} JSX
|
|
3990
|
+
*/
|
|
3991
|
+
|
|
3506
3992
|
function MapCanvasWrapper(_a) {
|
|
3507
3993
|
var children = _a.children;
|
|
3508
3994
|
tslib.__rest(_a, ["children"]);
|
|
3509
|
-
|
|
3995
|
+
|
|
3996
|
+
var controller = useMintMapController(); //render switch
|
|
3510
3997
|
|
|
3511
3998
|
var _b = React.useState(false),
|
|
3512
3999
|
renderFlag = _b[0],
|
|
@@ -3514,18 +4001,28 @@
|
|
|
3514
4001
|
|
|
3515
4002
|
var invokeRender = React.useCallback(function () {
|
|
3516
4003
|
setRenderFlag(!renderFlag);
|
|
3517
|
-
}, []);
|
|
3518
|
-
|
|
3519
|
-
var
|
|
3520
|
-
|
|
3521
|
-
var
|
|
4004
|
+
}, []); //canvas renderer
|
|
4005
|
+
|
|
4006
|
+
var renderer = React.useRef(); //canvas container ref
|
|
4007
|
+
|
|
4008
|
+
var containerRef = React.useRef(null); //canvas ref
|
|
4009
|
+
|
|
4010
|
+
var canvasRef = React.useRef(null); //canvas context
|
|
4011
|
+
|
|
4012
|
+
var contextRef = React.useRef(); //clear rect
|
|
4013
|
+
|
|
3522
4014
|
var clearRect = React.useCallback(function () {
|
|
3523
4015
|
if (contextRef.current && canvasRef.current) {
|
|
3524
4016
|
contextRef.current.clearRect(canvasRef.current.width * -1, canvasRef.current.height * -1, canvasRef.current.width * 3, canvasRef.current.height * 3);
|
|
3525
4017
|
}
|
|
3526
4018
|
|
|
3527
4019
|
return true;
|
|
3528
|
-
}, []);
|
|
4020
|
+
}, []); //offset values
|
|
4021
|
+
// const offsetProvider = useRef(new Offset(0, 0))
|
|
4022
|
+
// const prevX = useRef(0)
|
|
4023
|
+
// const prevY = useRef(0)
|
|
4024
|
+
//scaling
|
|
4025
|
+
|
|
3529
4026
|
var scaleCanvas = React.useCallback(function (containerRef, canvasElement, canvasContext) {
|
|
3530
4027
|
var devicePixelRatio = window.devicePixelRatio;
|
|
3531
4028
|
var width = containerRef.offsetWidth;
|
|
@@ -3535,7 +4032,16 @@
|
|
|
3535
4032
|
canvasElement.style.width = "".concat(width, "px");
|
|
3536
4033
|
canvasElement.style.height = "".concat(height, "px");
|
|
3537
4034
|
canvasContext.scale(devicePixelRatio, devicePixelRatio);
|
|
3538
|
-
}, []);
|
|
4035
|
+
}, []); //init transform
|
|
4036
|
+
// const initTransform = useCallback(()=>{
|
|
4037
|
+
// offsetProvider.current.x = 0
|
|
4038
|
+
// offsetProvider.current.y = 0
|
|
4039
|
+
// containerRef.current && (containerRef.current.style.transform = `translate(0px, 0px)`)
|
|
4040
|
+
// console.log('initTransform');
|
|
4041
|
+
// return true
|
|
4042
|
+
// }, [])
|
|
4043
|
+
//parse click param
|
|
4044
|
+
|
|
3539
4045
|
var parseClickParamToPosition = React.useCallback(function (mapType, e) {
|
|
3540
4046
|
var latlng = e.latlng || e.latLng;
|
|
3541
4047
|
|
|
@@ -3559,15 +4065,17 @@
|
|
|
3559
4065
|
}
|
|
3560
4066
|
|
|
3561
4067
|
return clickPosition;
|
|
3562
|
-
}, []);
|
|
4068
|
+
}, []); //box includes
|
|
3563
4069
|
|
|
3564
4070
|
var includes = function (point, targetPoint, width, height) {
|
|
4071
|
+
// console.log('includes', point, targetPoint, width, height);
|
|
3565
4072
|
if (point.x >= targetPoint.x && point.x <= targetPoint.x + width && point.y >= targetPoint.y && point.y <= targetPoint.y + height) {
|
|
3566
4073
|
return true;
|
|
3567
4074
|
}
|
|
3568
4075
|
|
|
3569
4076
|
return false;
|
|
3570
|
-
};
|
|
4077
|
+
}; //process mouse event
|
|
4078
|
+
|
|
3571
4079
|
|
|
3572
4080
|
var processMouseEvent = React.useCallback(function (clickedOffset, eventName) {
|
|
3573
4081
|
var items = renderItemsOnView.current;
|
|
@@ -3581,9 +4089,10 @@
|
|
|
3581
4089
|
|
|
3582
4090
|
if (!event_1) {
|
|
3583
4091
|
continue;
|
|
3584
|
-
}
|
|
4092
|
+
} //includes check
|
|
3585
4093
|
|
|
3586
|
-
|
|
4094
|
+
|
|
4095
|
+
var pos = item.position; // console.log('canvas mouseevent check', pos.offset);
|
|
3587
4096
|
|
|
3588
4097
|
if (pos && !pos.offset) {
|
|
3589
4098
|
pos.offset = controller.positionToOffset(pos);
|
|
@@ -3591,61 +4100,92 @@
|
|
|
3591
4100
|
|
|
3592
4101
|
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
3593
4102
|
continue;
|
|
3594
|
-
}
|
|
4103
|
+
} // const propagation =
|
|
4104
|
+
|
|
3595
4105
|
|
|
3596
4106
|
event_1(clickedOffset);
|
|
3597
|
-
hitSet.add(item);
|
|
3598
|
-
|
|
4107
|
+
hitSet.add(item); // if(eventName === 'onMouseOver' || propagation === false){
|
|
4108
|
+
|
|
4109
|
+
break; // }
|
|
3599
4110
|
}
|
|
3600
4111
|
}
|
|
3601
4112
|
|
|
3602
4113
|
return hitSet;
|
|
3603
|
-
}, []);
|
|
4114
|
+
}, []); //initialize
|
|
4115
|
+
|
|
3604
4116
|
React.useEffect(function () {
|
|
3605
4117
|
var resizeObserver;
|
|
3606
4118
|
|
|
3607
4119
|
if (canvasRef.current && containerRef.current) {
|
|
3608
4120
|
resizeObserver = new ResizeObserver(function (entries) {
|
|
3609
4121
|
var elem = entries[0];
|
|
3610
|
-
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current);
|
|
4122
|
+
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current); // initTransform()
|
|
4123
|
+
|
|
3611
4124
|
renderMain();
|
|
3612
4125
|
});
|
|
3613
4126
|
resizeObserver.observe(containerRef.current);
|
|
3614
4127
|
var map = controller.getMap();
|
|
3615
4128
|
|
|
3616
4129
|
if (map) {
|
|
4130
|
+
// const center = controller.getCenter()
|
|
4131
|
+
// center.offset = controller.positionToOffset(center)
|
|
4132
|
+
// if(center.offset){
|
|
4133
|
+
// prevX.current = center.offset.x
|
|
4134
|
+
// prevY.current = center.offset.y
|
|
4135
|
+
// }
|
|
4136
|
+
//naver 전용 이벤트 'zooming' 일때 캔버스 클리어처리
|
|
4137
|
+
//@ts-ignore
|
|
3617
4138
|
map.addListener('zooming', function () {
|
|
3618
4139
|
clearRect();
|
|
3619
|
-
});
|
|
4140
|
+
}); //kakao 전용 이벤트 'zoom_start' 일때 캔버스 클리어처리
|
|
4141
|
+
//@ts-ignore
|
|
4142
|
+
|
|
3620
4143
|
map.addListener('zoom_start', function () {
|
|
3621
4144
|
clearRect();
|
|
3622
|
-
});
|
|
4145
|
+
}); //@ts-ignore
|
|
4146
|
+
|
|
3623
4147
|
map.addListener('center_changed', function () {
|
|
3624
4148
|
|
|
3625
4149
|
if (containerRef.current) {
|
|
4150
|
+
// const pos = controller.getCenter()
|
|
4151
|
+
// pos.offset = controller.positionToOffset(pos)
|
|
4152
|
+
// const deltaX = prevX.current - pos.offset.x
|
|
4153
|
+
// const deltaY = prevY.current - pos.offset.y
|
|
4154
|
+
// offsetProvider.current.x += deltaX
|
|
4155
|
+
// offsetProvider.current.y += deltaY
|
|
4156
|
+
// prevX.current = pos.offset.x
|
|
4157
|
+
// prevY.current = pos.offset.y
|
|
4158
|
+
// containerRef.current.style.transform = `translate(${offsetProvider.current.x}px, ${offsetProvider.current.y}px)`
|
|
3626
4159
|
containerRef.current.style.visibility = 'hidden';
|
|
3627
4160
|
}
|
|
3628
|
-
});
|
|
4161
|
+
}); //@ts-ignore
|
|
4162
|
+
|
|
3629
4163
|
map.addListener('idle', function () {
|
|
3630
4164
|
|
|
3631
4165
|
if (containerRef.current) {
|
|
3632
4166
|
containerRef.current.style.visibility = '';
|
|
3633
4167
|
}
|
|
3634
4168
|
|
|
3635
|
-
clearRect();
|
|
4169
|
+
clearRect(); // contextRef.current?.translate(offsetProvider.current.x, offsetProvider.current.y)
|
|
4170
|
+
// initTransform()
|
|
4171
|
+
|
|
3636
4172
|
invokeRender();
|
|
3637
|
-
});
|
|
4173
|
+
}); //@ts-ignore
|
|
4174
|
+
|
|
3638
4175
|
map.addListener('mousemove', function (e) {
|
|
3639
4176
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3640
|
-
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3641
|
-
|
|
4177
|
+
var clickedOffset = controller.positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
|
|
4178
|
+
|
|
4179
|
+
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver'); //mouse out 처리
|
|
4180
|
+
|
|
3642
4181
|
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3643
4182
|
if (!hitSet.has(item)) {
|
|
3644
4183
|
item.onMouseOut && item.onMouseOut(clickedOffset);
|
|
3645
4184
|
}
|
|
3646
4185
|
});
|
|
3647
4186
|
renderItemsMouseOverStatus.current = hitSet;
|
|
3648
|
-
});
|
|
4187
|
+
}); //@ts-ignore
|
|
4188
|
+
|
|
3649
4189
|
map.addListener('click', function (e) {
|
|
3650
4190
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3651
4191
|
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
@@ -3664,14 +4204,18 @@
|
|
|
3664
4204
|
return function () {
|
|
3665
4205
|
resizeObserver && resizeObserver.disconnect();
|
|
3666
4206
|
};
|
|
3667
|
-
}, []);
|
|
4207
|
+
}, []); //items setting
|
|
4208
|
+
|
|
3668
4209
|
var renderItems = React.useRef([]);
|
|
3669
4210
|
var renderItemsOnView = React.useRef([]);
|
|
3670
4211
|
var renderItemsMouseOverStatus = React.useRef(new Set());
|
|
3671
4212
|
React.useEffect(function () {
|
|
3672
4213
|
renderItems.current = (Array.isArray(children) ? children : children ? [children] : []).map(function (item) {
|
|
3673
4214
|
return item.props;
|
|
3674
|
-
});
|
|
4215
|
+
}); //draw 를 위한 정렬 조건
|
|
4216
|
+
//1. zIndex 가 있는 것들 끼리 정렬처리
|
|
4217
|
+
//2. zIndex 가 없는 것들은 원래 배열 순서대로
|
|
4218
|
+
|
|
3675
4219
|
var zIndexList = [];
|
|
3676
4220
|
var undefinedList = [];
|
|
3677
4221
|
|
|
@@ -3691,16 +4235,19 @@
|
|
|
3691
4235
|
}).forEach(function (item) {
|
|
3692
4236
|
renderItems.current.push(item);
|
|
3693
4237
|
});
|
|
3694
|
-
}, [children]);
|
|
4238
|
+
}, [children]); //rendering main
|
|
4239
|
+
|
|
3695
4240
|
var renderMain = React.useCallback(function () {
|
|
3696
4241
|
var ctx = contextRef.current;
|
|
3697
4242
|
var container = containerRef.current;
|
|
3698
4243
|
|
|
3699
4244
|
if (!ctx || !container || !renderer.current) {
|
|
3700
4245
|
return;
|
|
3701
|
-
}
|
|
4246
|
+
} //all clear
|
|
4247
|
+
|
|
4248
|
+
|
|
4249
|
+
clearRect(); //draw
|
|
3702
4250
|
|
|
3703
|
-
clearRect();
|
|
3704
4251
|
var t = new Date().getTime();
|
|
3705
4252
|
var items = renderItems.current;
|
|
3706
4253
|
renderItemsOnView.current.length = 0;
|
|
@@ -3710,7 +4257,8 @@
|
|
|
3710
4257
|
var item = items_1[_i];
|
|
3711
4258
|
|
|
3712
4259
|
if (item.visible === undefined || item.visible) {
|
|
3713
|
-
var pos = item.position;
|
|
4260
|
+
var pos = item.position; //위치 변환
|
|
4261
|
+
|
|
3714
4262
|
pos.offset = controller.positionToOffset(pos);
|
|
3715
4263
|
|
|
3716
4264
|
if (item.anchor) {
|
|
@@ -3722,7 +4270,8 @@
|
|
|
3722
4270
|
|
|
3723
4271
|
if (pos.offset.x < 0 || pos.offset.x > container.offsetWidth || pos.offset.y < 0 || pos.offset.y > container.offsetHeight) {
|
|
3724
4272
|
continue;
|
|
3725
|
-
}
|
|
4273
|
+
} //그리기
|
|
4274
|
+
|
|
3726
4275
|
|
|
3727
4276
|
item.renderer(renderer.current, pos.offset, item.payload);
|
|
3728
4277
|
renderItemsOnView.current.push(item);
|
|
@@ -3736,7 +4285,8 @@
|
|
|
3736
4285
|
}
|
|
3737
4286
|
});
|
|
3738
4287
|
console$1.log("[render ends] ".concat(new Date().getTime() - t, " ms"));
|
|
3739
|
-
}, []);
|
|
4288
|
+
}, []); //render!!!
|
|
4289
|
+
|
|
3740
4290
|
renderMain();
|
|
3741
4291
|
return React__default["default"].createElement("div", {
|
|
3742
4292
|
ref: containerRef,
|
|
@@ -3755,7 +4305,16 @@
|
|
|
3755
4305
|
}), renderFlag && React__default["default"].createElement(React__default["default"].Fragment, null));
|
|
3756
4306
|
}
|
|
3757
4307
|
|
|
4308
|
+
/**
|
|
4309
|
+
* Mint Map 컴포넌트
|
|
4310
|
+
*
|
|
4311
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
4312
|
+
*
|
|
4313
|
+
* @returns {JSX.Element} JSX
|
|
4314
|
+
*/
|
|
4315
|
+
|
|
3758
4316
|
function MapCanvasMarkerWrapper(_props) {
|
|
4317
|
+
//실제 렌더링처리는 MapCanvasWrapper 에서...
|
|
3759
4318
|
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
3760
4319
|
}
|
|
3761
4320
|
|