@mint-ui/map 0.5.2-beta → 0.5.4-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 (72) 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 -10
  5. package/dist/components/mint-map/MintMap.js +14 -21
  6. package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
  7. package/dist/components/mint-map/core/MintMapController.d.ts +64 -64
  8. package/dist/components/mint-map/core/MintMapController.js +9 -9
  9. package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
  10. package/dist/components/mint-map/core/MintMapCore.js +13 -11
  11. package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
  12. package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +2 -2
  13. package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -17
  14. package/dist/components/mint-map/core/advanced/index.d.ts +3 -3
  15. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -20
  16. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +9 -8
  17. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -23
  18. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +45 -58
  19. package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -8
  20. package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -12
  21. package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +5 -5
  22. package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -10
  23. package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -3
  24. package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -3
  25. package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
  26. package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +2 -2
  27. package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
  28. package/dist/components/mint-map/core/index.d.ts +8 -8
  29. package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
  30. package/dist/components/mint-map/core/provider/index.d.ts +1 -1
  31. package/dist/components/mint-map/core/util/animation.d.ts +16 -16
  32. package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
  33. package/dist/components/mint-map/core/util/{calculate.d.ts → geo.d.ts} +38 -66
  34. package/dist/components/mint-map/core/util/geo.js +159 -0
  35. package/dist/components/mint-map/core/util/index.d.ts +5 -4
  36. package/dist/components/mint-map/core/util/polygon.d.ts +40 -0
  37. package/dist/components/mint-map/core/util/{calculate.js → polygon.js} +13 -159
  38. package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
  39. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -27
  40. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +6 -6
  41. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -11
  42. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +28 -12
  43. package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -18
  44. package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +6 -6
  45. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +42 -32
  46. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +15 -62
  47. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -12
  48. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +7 -6
  49. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -12
  50. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +8 -7
  51. package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
  52. package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -51
  53. package/dist/components/mint-map/google/GoogleMintMapController.js +1 -1
  54. package/dist/components/mint-map/index.d.ts +5 -5
  55. package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -56
  56. package/dist/components/mint-map/kakao/KakaoMintMapController.js +9 -8
  57. package/dist/components/mint-map/naver/NaverMintMapController.d.ts +54 -53
  58. package/dist/components/mint-map/naver/NaverMintMapController.js +16 -6
  59. package/dist/components/mint-map/types/CommonTypes.d.ts +11 -11
  60. package/dist/components/mint-map/types/MapDrawables.d.ts +110 -110
  61. package/dist/components/mint-map/types/MapDrawables.js +10 -10
  62. package/dist/components/mint-map/types/MapEventTypes.d.ts +44 -44
  63. package/dist/components/mint-map/types/MapTypes.d.ts +60 -60
  64. package/dist/components/mint-map/types/MapTypes.js +15 -15
  65. package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -25
  66. package/dist/components/mint-map/types/MintMapProps.d.ts +92 -92
  67. package/dist/components/mint-map/types/index.d.ts +6 -6
  68. package/dist/index.d.ts +7 -7
  69. package/dist/index.es.js +364 -394
  70. package/dist/index.js +4 -3
  71. package/dist/index.umd.js +364 -394
  72. package/package.json +77 -77
package/dist/index.umd.js CHANGED
@@ -14,6 +14,160 @@
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 PositionMirror$1 =
18
+ /** @class */
19
+ function () {
20
+ function PositionMirror(lat, lng) {
21
+ this.lat = lat;
22
+ this.lng = lng;
23
+ }
24
+
25
+ return PositionMirror;
26
+ }();
27
+
28
+ var GeoCalulator =
29
+ /** @class */
30
+ function () {
31
+ function GeoCalulator() {}
32
+
33
+ GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
34
+ var dLat = this.deg2rad(pos2.lat - pos1.lat);
35
+ var dLon = this.deg2rad(pos2.lng - pos1.lng);
36
+ 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);
37
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
38
+ var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
39
+
40
+ return d;
41
+ };
42
+
43
+ GeoCalulator.deg2rad = function (deg) {
44
+ return deg * (Math.PI / 180);
45
+ };
46
+
47
+ GeoCalulator.convertMeterToLatitudeValue = function (meter) {
48
+ return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
49
+ };
50
+
51
+ GeoCalulator.convertLatitudeToMeterValue = function (lat) {
52
+ return lat * this.METER_VALUE_PER_LATITUDE;
53
+ };
54
+
55
+ GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
56
+ return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
57
+ };
58
+
59
+ GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
60
+ return lat.toFixed(2);
61
+ };
62
+
63
+ GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
64
+ return this.CACHE_OF_LNG_PER_METER.get(latUnit);
65
+ };
66
+
67
+ GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
68
+ if (this.CACHE_OF_LNG_PER_METER.size > 10) {
69
+ this.CACHE_OF_LNG_PER_METER.clear();
70
+ }
71
+
72
+ this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
73
+ };
74
+
75
+ GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
76
+ // const t = Date.now()
77
+ // Cache check
78
+ var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
79
+ var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
80
+
81
+ if (fromCache !== undefined) {
82
+ // console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
83
+ return fromCache;
84
+ } // Convert latitude and longitude to radians
85
+
86
+
87
+ var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
88
+
89
+ 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
90
+
91
+ var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
92
+
93
+ this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
94
+
95
+ return distance;
96
+ };
97
+
98
+ GeoCalulator.computeNextPositionAndDistances = function (context) {
99
+ var pos1 = context.pos1,
100
+ pos2 = context.pos2,
101
+ prevPos2 = context.prevPos2,
102
+ velocityKmh = context.velocityKmh,
103
+ prevVelocityKmh = context.prevVelocityKmh,
104
+ elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
105
+ //총 가야할 거리 (km)
106
+
107
+ if (pos2 !== prevPos2) {
108
+ //목표가 바뀌면 거리 및 비율 재계산
109
+ context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
110
+ context.currDistance = 0;
111
+ context.prevPos2 = pos2;
112
+ }
113
+
114
+ var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
115
+ //ms 속으로 환산
116
+
117
+ if (velocityKmh !== prevVelocityKmh) {
118
+ //속도가 바뀌면 재계산
119
+ context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
120
+ context.prevVelocityKmh = velocityKmh;
121
+ }
122
+
123
+ var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
124
+ //실제 가는 거리 계산
125
+
126
+ var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
127
+ //목표점까지 이동 후에도 남는 거리
128
+
129
+ context.currDistance = nextDistance;
130
+
131
+ if (totalDistance < context.currDistance) {
132
+ //이동 거리가 현재 목표점을 넘어가는 경우
133
+ context.distanceRemain = context.currDistance - totalDistance;
134
+ context.nextPos = pos2;
135
+ return context;
136
+ } else {
137
+ context.distanceRemain = 0;
138
+ } //각 축으로 나가야할 비율
139
+
140
+
141
+ var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
142
+ //방향값 체크
143
+
144
+ var latCalib = pos2.lat > pos1.lat ? 1 : -1;
145
+ var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
146
+
147
+ var newPos = new PositionMirror$1(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
148
+
149
+ 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)) {
150
+ newPos = pos2;
151
+ } // console.log('newPos', newPos);
152
+ //console.log('==============================================================\n');
153
+
154
+
155
+ context.nextPos = newPos;
156
+ return context;
157
+ };
158
+
159
+ GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
160
+
161
+ GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
162
+ GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
163
+ GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
164
+
165
+ GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
166
+ GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
167
+ GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
168
+ return GeoCalulator;
169
+ }();
170
+
17
171
  var LinePoints =
18
172
  /** @class */
19
173
  function () {
@@ -213,11 +367,7 @@
213
367
 
214
368
  PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
215
369
  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
- });
370
+ return this.simplify(target, tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
221
371
  };
222
372
 
223
373
  PolygonCalculator.simplify = function (points, tolerance) {
@@ -251,12 +401,12 @@
251
401
 
252
402
 
253
403
  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];
404
+ var x = point.x;
405
+ var y = point.y;
406
+ var x1 = lineStart.x;
407
+ var y1 = lineStart.y;
408
+ var x2 = lineEnd.x;
409
+ var y2 = lineEnd.y;
260
410
  var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
261
411
  var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
262
412
  return numerator / denominator;
@@ -293,171 +443,28 @@
293
443
  return area;
294
444
  };
295
445
 
296
- PolygonCalculator.TOLERANCE_NAVER_STYLE = 0.0001;
297
- PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 0.00001;
446
+ PolygonCalculator.TOLERANCE_NAVER_STYLE = 1;
447
+ PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 1;
298
448
  return PolygonCalculator;
299
449
  }();
300
450
 
301
- var GeoCalulator =
302
- /** @class */
303
- function () {
304
- function GeoCalulator() {}
305
-
306
- GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
307
- var dLat = this.deg2rad(pos2.lat - pos1.lat);
308
- var dLon = this.deg2rad(pos2.lng - pos1.lng);
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);
310
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
311
- var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
312
-
313
- return d;
314
- };
315
-
316
- GeoCalulator.deg2rad = function (deg) {
317
- return deg * (Math.PI / 180);
318
- };
319
-
320
- GeoCalulator.convertMeterToLatitudeValue = function (meter) {
321
- return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
322
- };
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
-
371
- GeoCalulator.computeNextPositionAndDistances = function (context) {
372
- var pos1 = context.pos1,
373
- pos2 = context.pos2,
374
- prevPos2 = context.prevPos2,
375
- velocityKmh = context.velocityKmh,
376
- prevVelocityKmh = context.prevVelocityKmh,
377
- elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
378
- //총 가야할 거리 (km)
379
-
380
- if (pos2 !== prevPos2) {
381
- //목표가 바뀌면 거리 및 비율 재계산
382
- context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
383
- context.currDistance = 0;
384
- context.prevPos2 = pos2;
385
- }
386
-
387
- var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
388
- //ms 속으로 환산
389
-
390
- if (velocityKmh !== prevVelocityKmh) {
391
- //속도가 바뀌면 재계산
392
- context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
393
- context.prevVelocityKmh = velocityKmh;
394
- }
395
-
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
-
402
- context.currDistance = nextDistance;
403
-
404
- if (totalDistance < context.currDistance) {
405
- //이동 거리가 현재 목표점을 넘어가는 경우
406
- context.distanceRemain = context.currDistance - totalDistance;
407
- context.nextPos = pos2;
408
- return context;
409
- } else {
410
- context.distanceRemain = 0;
411
- } //각 축으로 나가야할 비율
412
-
413
-
414
- var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
415
- //방향값 체크
416
-
417
- var latCalib = pos2.lat > pos1.lat ? 1 : -1;
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);
421
-
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)) {
423
- newPos = pos2;
424
- } // console.log('newPos', newPos);
425
- //console.log('==============================================================\n');
426
-
427
-
428
- context.nextPos = newPos;
429
- return context;
430
- };
431
-
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();
440
- GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
441
- return GeoCalulator;
442
- }();
443
-
444
- /**
445
- * 좌표값
446
- * @description 위도/경도, DOM 상의 X/Y 좌표
451
+ /**
452
+ * 좌표값
453
+ * @description 위도/경도, DOM 상의 X/Y 좌표
447
454
  */
448
455
 
449
456
  var Position =
450
457
  /** @class */
451
458
  function () {
452
459
  function Position(lat, lng) {
453
- /**
454
- * 위도
455
- * @description 위도(latitude)
460
+ /**
461
+ * 위도
462
+ * @description 위도(latitude)
456
463
  */
457
464
  this.lat = 0;
458
- /**
459
- * 경도
460
- * @description 경도(longitude)
465
+ /**
466
+ * 경도
467
+ * @description 경도(longitude)
461
468
  */
462
469
 
463
470
  this.lng = 0;
@@ -565,15 +572,15 @@
565
572
 
566
573
  return Bounds;
567
574
  }();
568
- /**
569
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
575
+ /**
576
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
570
577
  */
571
578
 
572
579
  var Offset =
573
580
  /** @class */
574
581
  function () {
575
- /**
576
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
582
+ /**
583
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
577
584
  */
578
585
  function Offset(x, y) {
579
586
  this.x = x;
@@ -630,6 +637,7 @@
630
637
  mapInitialized = _d[0],
631
638
  setMapInitialized = _d[1];
632
639
 
640
+ var currMapInitialized = React.useRef(false);
633
641
  React.useEffect(function () {
634
642
  (function () {
635
643
  return tslib.__awaiter(_this, void 0, void 0, function () {
@@ -642,16 +650,21 @@
642
650
  , 2];
643
651
  return [4
644
652
  /*yield*/
645
- , controller.initializingMap(elementRef.current) //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
646
- ];
653
+ , controller.initializingMap(elementRef.current)];
647
654
 
648
655
  case 1:
649
- map_1 = _a.sent(); //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
656
+ map_1 = _a.sent();
657
+
658
+ if (!currMapInitialized.current) {
659
+ currMapInitialized.current = true; //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
660
+
661
+ setTimeout(function () {
662
+ // console.log('setMapInitialized true');
663
+ setMapInitialized(true);
664
+ onLoad && onLoad(map_1, controller);
665
+ }, 100);
666
+ }
650
667
 
651
- setTimeout(function () {
652
- setMapInitialized(true);
653
- onLoad && onLoad(map_1, controller);
654
- }, 100);
655
668
  _a.label = 2;
656
669
 
657
670
  case 2:
@@ -662,10 +675,6 @@
662
675
  });
663
676
  });
664
677
  })();
665
-
666
- return function () {
667
- controller && controller.destroyMap();
668
- };
669
678
  }, [controller, elementRef]); //줌레벨
670
679
 
671
680
  React.useEffect(function () {
@@ -799,12 +808,12 @@
799
808
  MintMapController.prototype.getRandomFunctionName = function (prefix) {
800
809
  return "".concat(prefix, "_").concat(uuid.v4().replace(/-/g, '_'));
801
810
  };
802
- /**
803
- * URL 빌더 메서드
804
- *
805
- * @param {string} baseUrl: 기본 URL
806
- * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
807
- * @returns {string} URL
811
+ /**
812
+ * URL 빌더 메서드
813
+ *
814
+ * @param {string} baseUrl: 기본 URL
815
+ * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
816
+ * @returns {string} URL
808
817
  */
809
818
 
810
819
 
@@ -817,9 +826,9 @@
817
826
  }).join('&');
818
827
  return "".concat(baseUrl, "?").concat(params);
819
828
  };
820
- /**
821
- * 쓰로틀링 처리
822
- * @returns
829
+ /**
830
+ * 쓰로틀링 처리
831
+ * @returns
823
832
  */
824
833
 
825
834
 
@@ -1380,11 +1389,11 @@
1380
1389
  var map = marker.native.getMap();
1381
1390
 
1382
1391
  if (map) {
1383
- /** 중요!!!!
1384
- * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1385
- * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1386
- * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1387
- * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1392
+ /** 중요!!!!
1393
+ * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1394
+ * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1395
+ * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1396
+ * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1388
1397
  */
1389
1398
  //Position
1390
1399
  if (options.position && options.position instanceof Position) {
@@ -1612,7 +1621,7 @@
1612
1621
  case 2:
1613
1622
  options = {
1614
1623
  center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
1615
- zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
1624
+ zoom: ((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || this.getBaseToMapZoom(15),
1616
1625
  draggable: this.mapProps.draggable === false ? false : true,
1617
1626
  scrollWheel: this.mapProps.draggable === false ? false : true,
1618
1627
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
@@ -1638,6 +1647,7 @@
1638
1647
 
1639
1648
  options.minZoom = minZoom;
1640
1649
  options.maxZoom = maxZoom;
1650
+ divElement.innerHTML = '';
1641
1651
  map = new naver.maps.Map(divElement, options);
1642
1652
  this.map = map; //@ts-ignore
1643
1653
 
@@ -1762,6 +1772,15 @@
1762
1772
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
1763
1773
  };
1764
1774
 
1775
+ NaverMintMapController.prototype.positionToOffset = function (position) {
1776
+ if (!this.map) {
1777
+ return new Offset(0, 0);
1778
+ }
1779
+
1780
+ var offset = this.map.getProjection().fromCoordToOffset(new naver.maps.LatLng(position.lat, position.lng));
1781
+ return new Offset(offset.x, offset.y);
1782
+ };
1783
+
1765
1784
  NaverMintMapController.prototype.addEventListener = function (eventName, callback) {
1766
1785
  var _this = this;
1767
1786
 
@@ -2310,7 +2329,7 @@
2310
2329
  center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
2311
2330
  maxZoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.maxZoomLevel,
2312
2331
  minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
2313
- zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
2332
+ zoom: ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel) || this.getBaseToMapZoom(15),
2314
2333
  disableDefaultUI: true,
2315
2334
  gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
2316
2335
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
@@ -2971,7 +2990,7 @@
2971
2990
  case 2:
2972
2991
  options = {
2973
2992
  center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
2974
- level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
2993
+ level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 15),
2975
2994
  draggable: this.mapProps.draggable === false ? false : true,
2976
2995
  scrollWheel: this.mapProps.draggable === false ? false : true,
2977
2996
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
@@ -2991,6 +3010,7 @@
2991
3010
  minZoom = 14;
2992
3011
  }
2993
3012
 
3013
+ divElement.innerHTML = '';
2994
3014
  map = new kakao.maps.Map(divElement, options);
2995
3015
  map.setMaxLevel(minZoom);
2996
3016
  map.setMinLevel(maxZoom);
@@ -3055,13 +3075,13 @@
3055
3075
  };
3056
3076
 
3057
3077
  KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
3058
- /**
3059
- * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3060
- * - 가장 확대된 값 : 1
3061
- * - 가장 축소된 값 : 14
3062
- *
3063
- * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3064
- * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3078
+ /**
3079
+ * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3080
+ * - 가장 확대된 값 : 1
3081
+ * - 가장 축소된 값 : 14
3082
+ *
3083
+ * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3084
+ * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3065
3085
  */
3066
3086
  var mapValue = this.getBaseToMapZoom(value);
3067
3087
 
@@ -3246,12 +3266,12 @@
3246
3266
  lat: 37.5036845,
3247
3267
  lng: 127.0448698
3248
3268
  };
3249
- /**
3250
- * Mint Map 컴포넌트
3251
- *
3252
- * @param {MintMapProps} MintMapProps
3253
- *
3254
- * @returns {JSX.Element} JSX
3269
+ /**
3270
+ * Mint Map 컴포넌트
3271
+ *
3272
+ * @param {MintMapProps} MintMapProps
3273
+ *
3274
+ * @returns {JSX.Element} JSX
3255
3275
  */
3256
3276
 
3257
3277
  function MintMap(_a) {
@@ -3276,9 +3296,15 @@
3276
3296
  var loading = React.useMemo(function () {
3277
3297
  return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(React__default["default"].Fragment, null);
3278
3298
  }, [mapLoadingComponent]);
3299
+ var prevController = React.useRef();
3279
3300
  React.useEffect(function () {
3280
3301
  if (mapType && mapType.length > 0) {
3281
3302
  setController(undefined);
3303
+
3304
+ if (prevController.current) {
3305
+ prevController.current.destroyMap();
3306
+ }
3307
+
3282
3308
  var newController_1 = mapType === 'naver' ? new NaverMintMapController(tslib.__assign(tslib.__assign({
3283
3309
  mapType: mapType
3284
3310
  }, props), {
@@ -3292,24 +3318,11 @@
3292
3318
  }, props), {
3293
3319
  base: base
3294
3320
  })) : null;
3321
+ newController_1 && (prevController.current = newController_1);
3295
3322
 
3296
3323
  if (newController_1) {
3297
3324
  newController_1.loadMapApi().then(function () {
3298
- setController(newController_1); // fade in 로직은 일단 스킵
3299
- // if(dissolveEffectWhenLoaded && loadingRef.current){
3300
- // const elemStyle = loadingRef.current.style
3301
- // elemStyle.background = 'white'
3302
- // elemStyle.opacity = '0'
3303
- // elemStyle.animationDuration = '0.1s'
3304
- // loadingRef.current.addEventListener('animationend', ()=>{
3305
- // setController(newController as MintMapController)
3306
- // }, {
3307
- // once:true
3308
- // })
3309
- // loadingRef.current.classList.add(cn('ani-fade-in'))
3310
- // }else{
3311
- // setController(newController as MintMapController)
3312
- // }
3325
+ setController(newController_1);
3313
3326
  });
3314
3327
  } else {
3315
3328
  throw new Error("Not Supported Map type ".concat(mapType));
@@ -3455,10 +3468,10 @@
3455
3468
  var width = maxX - minX;
3456
3469
  var height = maxY - minY;
3457
3470
  return {
3458
- containerLeft: Math.floor(minX),
3459
- containerTop: Math.floor(minY),
3460
- containerWidth: Math.floor(width),
3461
- containerHeight: Math.floor(height)
3471
+ containerLeft: minX,
3472
+ containerTop: minY,
3473
+ containerWidth: width,
3474
+ containerHeight: height
3462
3475
  };
3463
3476
  }, []);
3464
3477
  var getD = React.useCallback(function (_a) {
@@ -3532,7 +3545,7 @@
3532
3545
  height: height,
3533
3546
  fill: mode === 'POLYLINE' ? 'none' : background,
3534
3547
  stroke: mode === 'POLYLINE' ? 'black' : 'green',
3535
- strokeLinejoin: "round",
3548
+ strokeLinejoin: "miter",
3536
3549
  strokeLinecap: "butt",
3537
3550
  d: d
3538
3551
  }, shapeProperties))), React__default["default"].createElement("div", {
@@ -3681,8 +3694,8 @@
3681
3694
  /** @class */
3682
3695
  function (_super) {
3683
3696
  tslib.__extends(Marker, _super);
3684
- /**
3685
- * 지도에 표시할 마커정보
3697
+ /**
3698
+ * 지도에 표시할 마커정보
3686
3699
  */
3687
3700
 
3688
3701
 
@@ -3700,8 +3713,8 @@
3700
3713
  /** @class */
3701
3714
  function (_super) {
3702
3715
  tslib.__extends(Polyline, _super);
3703
- /**
3704
- * 지도에 표시할 폴리곤정보
3716
+ /**
3717
+ * 지도에 표시할 폴리곤정보
3705
3718
  */
3706
3719
 
3707
3720
 
@@ -3719,8 +3732,8 @@
3719
3732
  /** @class */
3720
3733
  function (_super) {
3721
3734
  tslib.__extends(Polygon, _super);
3722
- /**
3723
- * 지도에 표시할 폴리곤정보
3735
+ /**
3736
+ * 지도에 표시할 폴리곤정보
3724
3737
  */
3725
3738
 
3726
3739
 
@@ -3730,8 +3743,8 @@
3730
3743
  _this.options = options;
3731
3744
  return _this;
3732
3745
  }
3733
- /**
3734
- * 폴리곤의 중점을 구한다.
3746
+ /**
3747
+ * 폴리곤의 중점을 구한다.
3735
3748
  */
3736
3749
 
3737
3750
 
@@ -3901,19 +3914,19 @@
3901
3914
  divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
3902
3915
  }
3903
3916
  };
3904
- /**
3905
- * Mint Map 컴포넌트
3906
- *
3907
- * @param {MapControlWrapperProps} MapControlWrapperProps
3908
- *
3909
- * @returns {JSX.Element} JSX
3917
+ /**
3918
+ * Mint Map 컴포넌트
3919
+ *
3920
+ * @param {MapControlWrapperProps} MapControlWrapperProps
3921
+ *
3922
+ * @returns {JSX.Element} JSX
3910
3923
  */
3911
3924
 
3912
3925
 
3913
3926
  function MapMarkerWrapper(_a) {
3914
- var startAnimationClassName = _a.startAnimationClassName,
3915
- endAnimationClassName = _a.endAnimationClassName,
3916
- _b = _a.topOnClick,
3927
+ _a.startAnimationClassName;
3928
+ _a.endAnimationClassName;
3929
+ var _b = _a.topOnClick,
3917
3930
  topOnClick = _b === void 0 ? false : _b,
3918
3931
  _c = _a.topOnHover,
3919
3932
  topOnHover = _c === void 0 ? false : _c,
@@ -3927,9 +3940,7 @@
3927
3940
  var controller = useMintMapController(); //element
3928
3941
 
3929
3942
  var divRef = React.useRef(document.createElement('div'));
3930
- var divElement = divRef.current; //element clone for animation
3931
-
3932
- var divCloneRef = React.useRef(); //marker
3943
+ var divElement = divRef.current; //marker
3933
3944
 
3934
3945
  var markerRef = React.useRef(); //moving animation
3935
3946
 
@@ -4004,32 +4015,12 @@
4004
4015
  divElement.addEventListener('click', onClickHandler);
4005
4016
  divElement.addEventListener('mouseover', onMouseOverHandler);
4006
4017
  return function () {
4007
- //** kakao 는 viewport 안에 있는 마커만 렌더링하므로,
4008
- //마커 해제가 되더라도 애니메이션 이벤트가 일어나지 않아서 해지된 마커가 잠시 보이는 현상이 있음
4009
- //그래서 kakao 일때는 endAnimationClassName 영향을 받지 않도록 처리함
4010
- if (divCloneRef.current && endAnimationClassName && controller.getMapType() !== 'kakao') {
4011
- divCloneRef.current.classList.add(endAnimationClassName);
4012
-
4013
- var aniListener_1 = function () {
4014
- //console.log('animationend!!!', divCloneRef.current);
4015
- divCloneRef.current && divCloneRef.current.removeEventListener('animationend', aniListener_1);
4016
-
4017
- if (markerRef.current) {
4018
- controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
4019
- }
4020
-
4021
- divCloneRef.current = undefined;
4022
- };
4023
-
4024
- divCloneRef.current.addEventListener('animationend', aniListener_1);
4025
- divElement.append(divCloneRef.current);
4026
- } else {
4027
- divElement.removeEventListener('click', onClickHandler);
4028
- divElement.removeEventListener('mouseover', onMouseOverHandler);
4018
+ divElement.removeEventListener('click', onClickHandler);
4019
+ divElement.removeEventListener('mouseover', onMouseOverHandler);
4029
4020
 
4030
- if (markerRef.current) {
4031
- controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
4032
- }
4021
+ if (markerRef.current) {
4022
+ controller.clearDrawable(markerRef.current);
4023
+ markerRef.current = undefined; // console.log('drawable cleared')
4033
4024
  }
4034
4025
  };
4035
4026
  }, []); //create / update object
@@ -4074,31 +4065,6 @@
4074
4065
  setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
4075
4066
  marker: markerRef.current
4076
4067
  }));
4077
- } //start animation
4078
-
4079
-
4080
- if (startAnimationClassName) {
4081
- divElement.style.visibility = 'hidden';
4082
- setTimeout(function () {
4083
- var _a, _b;
4084
-
4085
- divCloneRef.current = divElement.firstElementChild;
4086
- divElement.style.visibility = 'visible';
4087
- (_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.add(startAnimationClassName);
4088
-
4089
- var aniListener = function () {
4090
- var _a, _b;
4091
-
4092
- (_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.remove(startAnimationClassName);
4093
- (_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.removeEventListener('animationend', aniListener);
4094
- };
4095
-
4096
- (_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.addEventListener('animationend', aniListener);
4097
- });
4098
- } else {
4099
- setTimeout(function () {
4100
- divCloneRef.current = divElement.firstElementChild;
4101
- });
4102
4068
  }
4103
4069
  }
4104
4070
  }
@@ -4241,12 +4207,12 @@
4241
4207
  return Number((sum / nums.length).toFixed(7));
4242
4208
  };
4243
4209
 
4244
- /**
4245
- * CircleMarker
4246
- *
4247
- * @param {CircleMarkerProps} CircleMarkerProps
4248
- *
4249
- * @returns {JSX.Element} JSX
4210
+ /**
4211
+ * CircleMarker
4212
+ *
4213
+ * @param {CircleMarkerProps} CircleMarkerProps
4214
+ *
4215
+ * @returns {JSX.Element} JSX
4250
4216
  */
4251
4217
 
4252
4218
  function CircleMarker(_a) {
@@ -4358,12 +4324,12 @@
4358
4324
  }, children)));
4359
4325
  }
4360
4326
 
4361
- /**
4362
- *PolygonMarker
4363
- *
4364
- * @param {PolygonMarkerProps} PolygonMarkerProps
4365
- *
4366
- * @returns {JSX.Element} JSX
4327
+ /**
4328
+ *PolygonMarker
4329
+ *
4330
+ * @param {PolygonMarkerProps} PolygonMarkerProps
4331
+ *
4332
+ * @returns {JSX.Element} JSX
4367
4333
  */
4368
4334
 
4369
4335
  function PolygonMarker(_a) {
@@ -4426,11 +4392,9 @@
4426
4392
 
4427
4393
  var _l = React.useState([]),
4428
4394
  innerOffsets = _l[0],
4429
- setInnerOffsets = _l[1]; //offset cache
4395
+ setInnerOffsets = _l[1]; //polygon props ref
4430
4396
 
4431
4397
 
4432
- var offsetCache = React.useRef(new Map()); //polygon props ref
4433
-
4434
4398
  var polygonPropsRef = React.useRef({
4435
4399
  position: position,
4436
4400
  innerPositions: innerPositions,
@@ -4441,7 +4405,6 @@
4441
4405
 
4442
4406
  React.useEffect(function () {
4443
4407
  // console.log('polygon changed');
4444
- offsetCache.current.clear();
4445
4408
  polygonPropsRef.current = {
4446
4409
  position: position,
4447
4410
  innerPositions: innerPositions,
@@ -4463,53 +4426,42 @@
4463
4426
  innerPositions = _a.innerPositions,
4464
4427
  simplifyPath = _a.simplifyPath,
4465
4428
  simplifyTolerance = _a.simplifyTolerance,
4466
- lastReapeated = _a.lastReapeated;
4467
- var prevCache = offsetCache.current.get(zoomLevel.current);
4468
-
4469
- if (prevCache) {
4470
- var offsets_1 = [];
4471
- offsets_1.push.apply(offsets_1, prevCache.offsets);
4472
- setOffsets(offsets_1);
4473
- var innerOffsets_1 = [];
4474
- innerOffsets_1.push.apply(innerOffsets_1, prevCache.innerOffsets);
4475
- setInnerOffsets(innerOffsets_1);
4476
- setPolygonStart(prevCache.start);
4477
- } else {
4478
- // path
4479
- var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(position, simplifyTolerance, lastReapeated) : position;
4480
- var offsets_2 = simplified.map(function (pos) {
4481
- var off = controller.positionToOffset(pos);
4482
- return new Offset(Math.floor(off.x), Math.floor(off.y));
4483
- });
4484
- setOffsets(offsets_2); //inner path
4429
+ lastReapeated = _a.lastReapeated; // path
4485
4430
 
4486
- var innerPath = [];
4431
+ var maxLat = undefined;
4432
+ var minLng = undefined;
4433
+ var offsets = position.map(function (pos) {
4434
+ if (maxLat === undefined || maxLat < pos.lat) {
4435
+ maxLat = pos.lat;
4436
+ }
4487
4437
 
4488
- if (innerPositions) {
4489
- for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
4490
- var innerPosition = innerPositions_1[_i];
4491
- var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(innerPosition, simplifyTolerance, lastReapeated) : innerPosition;
4492
- var offsets_3 = simplified_1.map(function (pos) {
4493
- var off = controller.positionToOffset(pos);
4494
- return new Offset(Math.floor(off.x), Math.floor(off.y));
4495
- });
4496
- innerPath.push(offsets_3);
4497
- }
4438
+ if (minLng === undefined || minLng > pos.lng) {
4439
+ minLng = pos.lng;
4440
+ }
4498
4441
 
4499
- setInnerOffsets(innerPath);
4500
- } //start point
4442
+ return controller.positionToOffset(pos);
4443
+ });
4444
+ var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(offsets, simplifyTolerance, lastReapeated) : offsets;
4445
+ setOffsets(simplified); //inner path
4501
4446
 
4447
+ var innerPath = [];
4502
4448
 
4503
- var regionInfo = PolygonCalculator.getRegionInfo(simplified);
4504
- var startPosition = regionInfo.maxLat && regionInfo.minLng ? new Position(regionInfo.maxLat, regionInfo.minLng) : undefined;
4505
- setPolygonStart(startPosition); //cache set
4449
+ if (innerPositions) {
4450
+ for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
4451
+ var innerPosition = innerPositions_1[_i];
4452
+ var offsets_1 = innerPosition.map(function (pos) {
4453
+ return controller.positionToOffset(pos);
4454
+ });
4455
+ var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(offsets_1, simplifyTolerance, lastReapeated) : offsets_1;
4456
+ innerPath.push(simplified_1);
4457
+ }
4506
4458
 
4507
- offsetCache.current.set(zoomLevel.current, {
4508
- start: startPosition,
4509
- offsets: offsets_2,
4510
- innerOffsets: innerPath
4511
- });
4512
- }
4459
+ setInnerOffsets(innerPath);
4460
+ } //start point
4461
+
4462
+
4463
+ var startPosition = maxLat && minLng ? new Position(maxLat, minLng) : undefined;
4464
+ setPolygonStart(startPosition);
4513
4465
  }, []);
4514
4466
  return React__default["default"].createElement(React__default["default"].Fragment, null, polygonStart && React__default["default"].createElement(MapMarkerWrapper, {
4515
4467
  position: polygonStart,
@@ -4526,12 +4478,12 @@
4526
4478
  }, children)));
4527
4479
  }
4528
4480
 
4529
- /**
4530
- * Mint Map 컴포넌트
4531
- *
4532
- * @param {MapControlWrapperProps} MapControlWrapperProps
4533
- *
4534
- * @returns {JSX.Element} JSX
4481
+ /**
4482
+ * Mint Map 컴포넌트
4483
+ *
4484
+ * @param {MapControlWrapperProps} MapControlWrapperProps
4485
+ *
4486
+ * @returns {JSX.Element} JSX
4535
4487
  */
4536
4488
 
4537
4489
  function MapPolygonWrapper(_a) {
@@ -4546,6 +4498,7 @@
4546
4498
  if (polygonRef.current) {
4547
4499
  // console.log('polygon cleared')
4548
4500
  controller.clearDrawable(polygonRef.current);
4501
+ polygonRef.current = undefined;
4549
4502
  }
4550
4503
  };
4551
4504
  }, []); //create/update object
@@ -5018,12 +4971,12 @@
5018
4971
 
5019
4972
  throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
5020
4973
  };
5021
- /**
5022
- * Mint Map 컴포넌트
5023
- *
5024
- * @param {MapControlWrapperProps} MapControlWrapperProps
5025
- *
5026
- * @returns {JSX.Element} JSX
4974
+ /**
4975
+ * Mint Map 컴포넌트
4976
+ *
4977
+ * @param {MapControlWrapperProps} MapControlWrapperProps
4978
+ *
4979
+ * @returns {JSX.Element} JSX
5027
4980
  */
5028
4981
 
5029
4982
 
@@ -5048,12 +5001,12 @@
5048
5001
  }, children);
5049
5002
  }
5050
5003
 
5051
- /**
5052
- * Mint Map 컴포넌트
5053
- *
5054
- * @param {MapControlWrapperProps} MapControlWrapperProps
5055
- *
5056
- * @returns {JSX.Element} JSX
5004
+ /**
5005
+ * Mint Map 컴포넌트
5006
+ *
5007
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5008
+ *
5009
+ * @returns {JSX.Element} JSX
5057
5010
  */
5058
5011
 
5059
5012
  function MapPolylineWrapper(_a) {
@@ -5066,7 +5019,8 @@
5066
5019
  React.useEffect(function () {
5067
5020
  return function () {
5068
5021
  if (polylineRef.current) {
5069
- controller.clearDrawable(polylineRef.current); // console.log('polyline cleared')
5022
+ controller.clearDrawable(polylineRef.current);
5023
+ polylineRef.current = undefined; // console.log('polyline cleared')
5070
5024
  }
5071
5025
  };
5072
5026
  }, []); //create/update object
@@ -5093,12 +5047,12 @@
5093
5047
  log: function () {
5094
5048
  }
5095
5049
  };
5096
- /**
5097
- * Mint Map 컴포넌트
5098
- *
5099
- * @param {MapControlWrapperProps} MapControlWrapperProps
5100
- *
5101
- * @returns {JSX.Element} JSX
5050
+ /**
5051
+ * Mint Map 컴포넌트
5052
+ *
5053
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5054
+ *
5055
+ * @returns {JSX.Element} JSX
5102
5056
  */
5103
5057
 
5104
5058
  function MapCanvasWrapper(_a) {
@@ -5207,7 +5161,7 @@
5207
5161
  var pos = item.position; // console.log('canvas mouseevent check', pos.offset);
5208
5162
 
5209
5163
  if (pos && !pos.offset) {
5210
- pos.offset = controller.positionToOffset(pos);
5164
+ pos.offset = positionToOffset(pos);
5211
5165
  }
5212
5166
 
5213
5167
  if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
@@ -5240,7 +5194,7 @@
5240
5194
 
5241
5195
  if (map) {
5242
5196
  // const center = controller.getCenter()
5243
- // center.offset = controller.positionToOffset(center)
5197
+ // center.offset = positionToOffset(center)
5244
5198
  // if(center.offset){
5245
5199
  // prevX.current = center.offset.x
5246
5200
  // prevY.current = center.offset.y
@@ -5260,7 +5214,7 @@
5260
5214
 
5261
5215
  if (containerRef.current) {
5262
5216
  // const pos = controller.getCenter()
5263
- // pos.offset = controller.positionToOffset(pos)
5217
+ // pos.offset = positionToOffset(pos)
5264
5218
  // const deltaX = prevX.current - pos.offset.x
5265
5219
  // const deltaY = prevY.current - pos.offset.y
5266
5220
  // offsetProvider.current.x += deltaX
@@ -5286,7 +5240,7 @@
5286
5240
 
5287
5241
  map.addListener('mousemove', function (e) {
5288
5242
  var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
5289
- var clickedOffset = controller.positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
5243
+ var clickedOffset = positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
5290
5244
 
5291
5245
  var hitSet = processMouseEvent(clickedOffset, 'onMouseOver'); //mouse out 처리
5292
5246
 
@@ -5300,7 +5254,7 @@
5300
5254
 
5301
5255
  map.addListener('click', function (e) {
5302
5256
  var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
5303
- var clickedOffset = controller.positionToOffset(clickPosition);
5257
+ var clickedOffset = positionToOffset(clickPosition);
5304
5258
  processMouseEvent(clickedOffset, 'onClick');
5305
5259
  });
5306
5260
  }
@@ -5371,7 +5325,7 @@
5371
5325
  if (item.visible === undefined || item.visible) {
5372
5326
  var pos = item.position; //위치 변환
5373
5327
 
5374
- pos.offset = controller.positionToOffset(pos);
5328
+ pos.offset = positionToOffset(pos);
5375
5329
 
5376
5330
  if (item.anchor) {
5377
5331
  pos.offset.x += item.anchor.x;
@@ -5400,6 +5354,22 @@
5400
5354
  }, []); //render!!!
5401
5355
 
5402
5356
  renderMain();
5357
+
5358
+ var positionToOffset = React.useCallback(function (position) {
5359
+ var div = controller.mapDivElement;
5360
+ var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
5361
+ var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
5362
+ var bounds = controller.getCurrBounds();
5363
+ var maxLng = bounds.ne.lng;
5364
+ var minLng = bounds.sw.lng;
5365
+ var lng = Math.abs(maxLng - minLng);
5366
+ var x = w * (position.lng - minLng) / lng;
5367
+ var maxLat = bounds.ne.lat;
5368
+ var minLat = bounds.sw.lat;
5369
+ var lat = Math.abs(maxLat - minLat);
5370
+ var y = h * (maxLat - position.lat) / lat;
5371
+ return new Offset(x, y);
5372
+ }, []);
5403
5373
  return React__default["default"].createElement("div", {
5404
5374
  ref: containerRef,
5405
5375
  style: {
@@ -5417,12 +5387,12 @@
5417
5387
  }), renderFlag && React__default["default"].createElement(React__default["default"].Fragment, null));
5418
5388
  }
5419
5389
 
5420
- /**
5421
- * Mint Map 컴포넌트
5422
- *
5423
- * @param {MapControlWrapperProps} MapControlWrapperProps
5424
- *
5425
- * @returns {JSX.Element} JSX
5390
+ /**
5391
+ * Mint Map 컴포넌트
5392
+ *
5393
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5394
+ *
5395
+ * @returns {JSX.Element} JSX
5426
5396
  */
5427
5397
 
5428
5398
  function MapCanvasMarkerWrapper(_props) {