@mint-ui/map 0.4.5-beta → 0.5.0-beta

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