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