@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.es.js CHANGED
@@ -10,6 +10,160 @@ var css_248z$2 = ".MintMap-module_loading-point-container__znk6l {\n display: f
10
10
  var styles$2 = {"loading-point-container":"MintMap-module_loading-point-container__znk6l","ani-blink":"MintMap-module_ani-blink__K89JK","blink":"MintMap-module_blink__mqfeV","ani-fade-in":"MintMap-module_ani-fade-in__lpHuy","fade-in":"MintMap-module_fade-in__jHpv1","ani-fade-out":"MintMap-module_ani-fade-out__5-esw","fade-out":"MintMap-module_fade-out__CIjGe","ani-expansion":"MintMap-module_ani-expansion__S2vOZ","expansion":"MintMap-module_expansion__WMo5-"};
11
11
  styleInject(css_248z$2);
12
12
 
13
+ var PositionMirror$1 =
14
+ /** @class */
15
+ function () {
16
+ function PositionMirror(lat, lng) {
17
+ this.lat = lat;
18
+ this.lng = lng;
19
+ }
20
+
21
+ return PositionMirror;
22
+ }();
23
+
24
+ var GeoCalulator =
25
+ /** @class */
26
+ function () {
27
+ function GeoCalulator() {}
28
+
29
+ GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
30
+ var dLat = this.deg2rad(pos2.lat - pos1.lat);
31
+ var dLon = this.deg2rad(pos2.lng - pos1.lng);
32
+ 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);
33
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
34
+ var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
35
+
36
+ return d;
37
+ };
38
+
39
+ GeoCalulator.deg2rad = function (deg) {
40
+ return deg * (Math.PI / 180);
41
+ };
42
+
43
+ GeoCalulator.convertMeterToLatitudeValue = function (meter) {
44
+ return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
45
+ };
46
+
47
+ GeoCalulator.convertLatitudeToMeterValue = function (lat) {
48
+ return lat * this.METER_VALUE_PER_LATITUDE;
49
+ };
50
+
51
+ GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
52
+ return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
53
+ };
54
+
55
+ GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
56
+ return lat.toFixed(2);
57
+ };
58
+
59
+ GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
60
+ return this.CACHE_OF_LNG_PER_METER.get(latUnit);
61
+ };
62
+
63
+ GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
64
+ if (this.CACHE_OF_LNG_PER_METER.size > 10) {
65
+ this.CACHE_OF_LNG_PER_METER.clear();
66
+ }
67
+
68
+ this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
69
+ };
70
+
71
+ GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
72
+ // const t = Date.now()
73
+ // Cache check
74
+ var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
75
+ var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
76
+
77
+ if (fromCache !== undefined) {
78
+ // console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
79
+ return fromCache;
80
+ } // Convert latitude and longitude to radians
81
+
82
+
83
+ var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
84
+
85
+ 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
86
+
87
+ var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
88
+
89
+ this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
90
+
91
+ return distance;
92
+ };
93
+
94
+ GeoCalulator.computeNextPositionAndDistances = function (context) {
95
+ var pos1 = context.pos1,
96
+ pos2 = context.pos2,
97
+ prevPos2 = context.prevPos2,
98
+ velocityKmh = context.velocityKmh,
99
+ prevVelocityKmh = context.prevVelocityKmh,
100
+ elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
101
+ //총 가야할 거리 (km)
102
+
103
+ if (pos2 !== prevPos2) {
104
+ //목표가 바뀌면 거리 및 비율 재계산
105
+ context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
106
+ context.currDistance = 0;
107
+ context.prevPos2 = pos2;
108
+ }
109
+
110
+ var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
111
+ //ms 속으로 환산
112
+
113
+ if (velocityKmh !== prevVelocityKmh) {
114
+ //속도가 바뀌면 재계산
115
+ context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
116
+ context.prevVelocityKmh = velocityKmh;
117
+ }
118
+
119
+ var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
120
+ //실제 가는 거리 계산
121
+
122
+ var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
123
+ //목표점까지 이동 후에도 남는 거리
124
+
125
+ context.currDistance = nextDistance;
126
+
127
+ if (totalDistance < context.currDistance) {
128
+ //이동 거리가 현재 목표점을 넘어가는 경우
129
+ context.distanceRemain = context.currDistance - totalDistance;
130
+ context.nextPos = pos2;
131
+ return context;
132
+ } else {
133
+ context.distanceRemain = 0;
134
+ } //각 축으로 나가야할 비율
135
+
136
+
137
+ var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
138
+ //방향값 체크
139
+
140
+ var latCalib = pos2.lat > pos1.lat ? 1 : -1;
141
+ var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
142
+
143
+ var newPos = new PositionMirror$1(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
144
+
145
+ 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)) {
146
+ newPos = pos2;
147
+ } // console.log('newPos', newPos);
148
+ //console.log('==============================================================\n');
149
+
150
+
151
+ context.nextPos = newPos;
152
+ return context;
153
+ };
154
+
155
+ GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
156
+
157
+ GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
158
+ GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
159
+ GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
160
+
161
+ GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
162
+ GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
163
+ GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
164
+ return GeoCalulator;
165
+ }();
166
+
13
167
  var LinePoints =
14
168
  /** @class */
15
169
  function () {
@@ -209,11 +363,7 @@ function () {
209
363
 
210
364
  PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
211
365
  var target = lastRepeated ? polygon.slice(0, polygon.length - 1) : polygon;
212
- return this.simplify(target.map(function (position) {
213
- return [position.lng, position.lat];
214
- }), tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE).map(function (point) {
215
- return new PositionMirror(point[1], point[0]);
216
- });
366
+ return this.simplify(target, tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
217
367
  };
218
368
 
219
369
  PolygonCalculator.simplify = function (points, tolerance) {
@@ -247,12 +397,12 @@ function () {
247
397
 
248
398
 
249
399
  PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd) {
250
- var x = point[0];
251
- var y = point[1];
252
- var x1 = lineStart[0];
253
- var y1 = lineStart[1];
254
- var x2 = lineEnd[0];
255
- var y2 = lineEnd[1];
400
+ var x = point.x;
401
+ var y = point.y;
402
+ var x1 = lineStart.x;
403
+ var y1 = lineStart.y;
404
+ var x2 = lineEnd.x;
405
+ var y2 = lineEnd.y;
256
406
  var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
257
407
  var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
258
408
  return numerator / denominator;
@@ -289,171 +439,28 @@ function () {
289
439
  return area;
290
440
  };
291
441
 
292
- PolygonCalculator.TOLERANCE_NAVER_STYLE = 0.0001;
293
- PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 0.00001;
442
+ PolygonCalculator.TOLERANCE_NAVER_STYLE = 1;
443
+ PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 1;
294
444
  return PolygonCalculator;
295
445
  }();
296
446
 
297
- var GeoCalulator =
298
- /** @class */
299
- function () {
300
- function GeoCalulator() {}
301
-
302
- GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
303
- var dLat = this.deg2rad(pos2.lat - pos1.lat);
304
- var dLon = this.deg2rad(pos2.lng - pos1.lng);
305
- var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(pos1.lat)) * Math.cos(this.deg2rad(pos2.lat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
306
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
307
- var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
308
-
309
- return d;
310
- };
311
-
312
- GeoCalulator.deg2rad = function (deg) {
313
- return deg * (Math.PI / 180);
314
- };
315
-
316
- GeoCalulator.convertMeterToLatitudeValue = function (meter) {
317
- return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
318
- };
319
-
320
- GeoCalulator.convertLatitudeToMeterValue = function (lat) {
321
- return lat * this.METER_VALUE_PER_LATITUDE;
322
- };
323
-
324
- GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
325
- return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
326
- };
327
-
328
- GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
329
- return lat.toFixed(2);
330
- };
331
-
332
- GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
333
- return this.CACHE_OF_LNG_PER_METER.get(latUnit);
334
- };
335
-
336
- GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
337
- if (this.CACHE_OF_LNG_PER_METER.size > 10) {
338
- this.CACHE_OF_LNG_PER_METER.clear();
339
- }
340
-
341
- this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
342
- };
343
-
344
- GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
345
- // const t = Date.now()
346
- // Cache check
347
- var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
348
- var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
349
-
350
- if (fromCache !== undefined) {
351
- // console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
352
- return fromCache;
353
- } // Convert latitude and longitude to radians
354
-
355
-
356
- var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
357
-
358
- var radius = this.EARTH_EQUATORIAL_RADIUS * Math.sqrt(1 - Math.pow(this.EARTH_ECCENTRICITY * Math.sin(latRad), 2)); // Calculate the length of one degree of longitude in meters
359
-
360
- var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
361
-
362
- this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
363
-
364
- return distance;
365
- };
366
-
367
- GeoCalulator.computeNextPositionAndDistances = function (context) {
368
- var pos1 = context.pos1,
369
- pos2 = context.pos2,
370
- prevPos2 = context.prevPos2,
371
- velocityKmh = context.velocityKmh,
372
- prevVelocityKmh = context.prevVelocityKmh,
373
- elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
374
- //총 가야할 거리 (km)
375
-
376
- if (pos2 !== prevPos2) {
377
- //목표가 바뀌면 거리 및 비율 재계산
378
- context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
379
- context.currDistance = 0;
380
- context.prevPos2 = pos2;
381
- }
382
-
383
- var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
384
- //ms 속으로 환산
385
-
386
- if (velocityKmh !== prevVelocityKmh) {
387
- //속도가 바뀌면 재계산
388
- context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
389
- context.prevVelocityKmh = velocityKmh;
390
- }
391
-
392
- var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
393
- //실제 가는 거리 계산
394
-
395
- var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
396
- //목표점까지 이동 후에도 남는 거리
397
-
398
- context.currDistance = nextDistance;
399
-
400
- if (totalDistance < context.currDistance) {
401
- //이동 거리가 현재 목표점을 넘어가는 경우
402
- context.distanceRemain = context.currDistance - totalDistance;
403
- context.nextPos = pos2;
404
- return context;
405
- } else {
406
- context.distanceRemain = 0;
407
- } //각 축으로 나가야할 비율
408
-
409
-
410
- var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
411
- //방향값 체크
412
-
413
- var latCalib = pos2.lat > pos1.lat ? 1 : -1;
414
- var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
415
-
416
- var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
417
-
418
- if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
419
- newPos = pos2;
420
- } // console.log('newPos', newPos);
421
- //console.log('==============================================================\n');
422
-
423
-
424
- context.nextPos = newPos;
425
- return context;
426
- };
427
-
428
- GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
429
-
430
- GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
431
- GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
432
- GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
433
-
434
- GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
435
- GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
436
- GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
437
- return GeoCalulator;
438
- }();
439
-
440
- /**
441
- * 좌표값
442
- * @description 위도/경도, DOM 상의 X/Y 좌표
447
+ /**
448
+ * 좌표값
449
+ * @description 위도/경도, DOM 상의 X/Y 좌표
443
450
  */
444
451
 
445
452
  var Position =
446
453
  /** @class */
447
454
  function () {
448
455
  function Position(lat, lng) {
449
- /**
450
- * 위도
451
- * @description 위도(latitude)
456
+ /**
457
+ * 위도
458
+ * @description 위도(latitude)
452
459
  */
453
460
  this.lat = 0;
454
- /**
455
- * 경도
456
- * @description 경도(longitude)
461
+ /**
462
+ * 경도
463
+ * @description 경도(longitude)
457
464
  */
458
465
 
459
466
  this.lng = 0;
@@ -561,15 +568,15 @@ function () {
561
568
 
562
569
  return Bounds;
563
570
  }();
564
- /**
565
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
571
+ /**
572
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
566
573
  */
567
574
 
568
575
  var Offset =
569
576
  /** @class */
570
577
  function () {
571
- /**
572
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
578
+ /**
579
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
573
580
  */
574
581
  function Offset(x, y) {
575
582
  this.x = x;
@@ -626,6 +633,7 @@ function MintMapCore(_a) {
626
633
  mapInitialized = _d[0],
627
634
  setMapInitialized = _d[1];
628
635
 
636
+ var currMapInitialized = useRef(false);
629
637
  useEffect(function () {
630
638
  (function () {
631
639
  return __awaiter(_this, void 0, void 0, function () {
@@ -638,16 +646,21 @@ function MintMapCore(_a) {
638
646
  , 2];
639
647
  return [4
640
648
  /*yield*/
641
- , controller.initializingMap(elementRef.current) //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
642
- ];
649
+ , controller.initializingMap(elementRef.current)];
643
650
 
644
651
  case 1:
645
- map_1 = _a.sent(); //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
652
+ map_1 = _a.sent();
653
+
654
+ if (!currMapInitialized.current) {
655
+ currMapInitialized.current = true; //onload callback (setTimeout 으로 맵이 초기화 될 텀을 준다. 특히 google map..)
656
+
657
+ setTimeout(function () {
658
+ // console.log('setMapInitialized true');
659
+ setMapInitialized(true);
660
+ onLoad && onLoad(map_1, controller);
661
+ }, 100);
662
+ }
646
663
 
647
- setTimeout(function () {
648
- setMapInitialized(true);
649
- onLoad && onLoad(map_1, controller);
650
- }, 100);
651
664
  _a.label = 2;
652
665
 
653
666
  case 2:
@@ -658,10 +671,6 @@ function MintMapCore(_a) {
658
671
  });
659
672
  });
660
673
  })();
661
-
662
- return function () {
663
- controller && controller.destroyMap();
664
- };
665
674
  }, [controller, elementRef]); //줌레벨
666
675
 
667
676
  useEffect(function () {
@@ -795,12 +804,12 @@ function () {
795
804
  MintMapController.prototype.getRandomFunctionName = function (prefix) {
796
805
  return "".concat(prefix, "_").concat(v4().replace(/-/g, '_'));
797
806
  };
798
- /**
799
- * URL 빌더 메서드
800
- *
801
- * @param {string} baseUrl: 기본 URL
802
- * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
803
- * @returns {string} URL
807
+ /**
808
+ * URL 빌더 메서드
809
+ *
810
+ * @param {string} baseUrl: 기본 URL
811
+ * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
812
+ * @returns {string} URL
804
813
  */
805
814
 
806
815
 
@@ -813,9 +822,9 @@ function () {
813
822
  }).join('&');
814
823
  return "".concat(baseUrl, "?").concat(params);
815
824
  };
816
- /**
817
- * 쓰로틀링 처리
818
- * @returns
825
+ /**
826
+ * 쓰로틀링 처리
827
+ * @returns
819
828
  */
820
829
 
821
830
 
@@ -1376,11 +1385,11 @@ function (_super) {
1376
1385
  var map = marker.native.getMap();
1377
1386
 
1378
1387
  if (map) {
1379
- /** 중요!!!!
1380
- * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1381
- * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1382
- * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1383
- * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1388
+ /** 중요!!!!
1389
+ * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1390
+ * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1391
+ * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1392
+ * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1384
1393
  */
1385
1394
  //Position
1386
1395
  if (options.position && options.position instanceof Position) {
@@ -1608,7 +1617,7 @@ function (_super) {
1608
1617
  case 2:
1609
1618
  options = {
1610
1619
  center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
1611
- zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
1620
+ zoom: ((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || this.getBaseToMapZoom(15),
1612
1621
  draggable: this.mapProps.draggable === false ? false : true,
1613
1622
  scrollWheel: this.mapProps.draggable === false ? false : true,
1614
1623
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
@@ -1634,6 +1643,7 @@ function (_super) {
1634
1643
 
1635
1644
  options.minZoom = minZoom;
1636
1645
  options.maxZoom = maxZoom;
1646
+ divElement.innerHTML = '';
1637
1647
  map = new naver.maps.Map(divElement, options);
1638
1648
  this.map = map; //@ts-ignore
1639
1649
 
@@ -1758,6 +1768,15 @@ function (_super) {
1758
1768
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
1759
1769
  };
1760
1770
 
1771
+ NaverMintMapController.prototype.positionToOffset = function (position) {
1772
+ if (!this.map) {
1773
+ return new Offset(0, 0);
1774
+ }
1775
+
1776
+ var offset = this.map.getProjection().fromCoordToOffset(new naver.maps.LatLng(position.lat, position.lng));
1777
+ return new Offset(offset.x, offset.y);
1778
+ };
1779
+
1761
1780
  NaverMintMapController.prototype.addEventListener = function (eventName, callback) {
1762
1781
  var _this = this;
1763
1782
 
@@ -2306,7 +2325,7 @@ function (_super) {
2306
2325
  center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
2307
2326
  maxZoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.maxZoomLevel,
2308
2327
  minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
2309
- zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
2328
+ zoom: ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel) || this.getBaseToMapZoom(15),
2310
2329
  disableDefaultUI: true,
2311
2330
  gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
2312
2331
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
@@ -2967,7 +2986,7 @@ function (_super) {
2967
2986
  case 2:
2968
2987
  options = {
2969
2988
  center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
2970
- level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
2989
+ level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 15),
2971
2990
  draggable: this.mapProps.draggable === false ? false : true,
2972
2991
  scrollWheel: this.mapProps.draggable === false ? false : true,
2973
2992
  keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
@@ -2987,6 +3006,7 @@ function (_super) {
2987
3006
  minZoom = 14;
2988
3007
  }
2989
3008
 
3009
+ divElement.innerHTML = '';
2990
3010
  map = new kakao.maps.Map(divElement, options);
2991
3011
  map.setMaxLevel(minZoom);
2992
3012
  map.setMinLevel(maxZoom);
@@ -3051,13 +3071,13 @@ function (_super) {
3051
3071
  };
3052
3072
 
3053
3073
  KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
3054
- /**
3055
- * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3056
- * - 가장 확대된 값 : 1
3057
- * - 가장 축소된 값 : 14
3058
- *
3059
- * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3060
- * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3074
+ /**
3075
+ * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3076
+ * - 가장 확대된 값 : 1
3077
+ * - 가장 축소된 값 : 14
3078
+ *
3079
+ * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3080
+ * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3061
3081
  */
3062
3082
  var mapValue = this.getBaseToMapZoom(value);
3063
3083
 
@@ -3242,12 +3262,12 @@ var DEFAULT_CENTER = {
3242
3262
  lat: 37.5036845,
3243
3263
  lng: 127.0448698
3244
3264
  };
3245
- /**
3246
- * Mint Map 컴포넌트
3247
- *
3248
- * @param {MintMapProps} MintMapProps
3249
- *
3250
- * @returns {JSX.Element} JSX
3265
+ /**
3266
+ * Mint Map 컴포넌트
3267
+ *
3268
+ * @param {MintMapProps} MintMapProps
3269
+ *
3270
+ * @returns {JSX.Element} JSX
3251
3271
  */
3252
3272
 
3253
3273
  function MintMap(_a) {
@@ -3272,9 +3292,15 @@ function MintMap(_a) {
3272
3292
  var loading = useMemo(function () {
3273
3293
  return mapLoadingComponent ? mapLoadingComponent() : React.createElement(React.Fragment, null);
3274
3294
  }, [mapLoadingComponent]);
3295
+ var prevController = useRef();
3275
3296
  useEffect(function () {
3276
3297
  if (mapType && mapType.length > 0) {
3277
3298
  setController(undefined);
3299
+
3300
+ if (prevController.current) {
3301
+ prevController.current.destroyMap();
3302
+ }
3303
+
3278
3304
  var newController_1 = mapType === 'naver' ? new NaverMintMapController(__assign(__assign({
3279
3305
  mapType: mapType
3280
3306
  }, props), {
@@ -3288,24 +3314,11 @@ function MintMap(_a) {
3288
3314
  }, props), {
3289
3315
  base: base
3290
3316
  })) : null;
3317
+ newController_1 && (prevController.current = newController_1);
3291
3318
 
3292
3319
  if (newController_1) {
3293
3320
  newController_1.loadMapApi().then(function () {
3294
- setController(newController_1); // fade in 로직은 일단 스킵
3295
- // if(dissolveEffectWhenLoaded && loadingRef.current){
3296
- // const elemStyle = loadingRef.current.style
3297
- // elemStyle.background = 'white'
3298
- // elemStyle.opacity = '0'
3299
- // elemStyle.animationDuration = '0.1s'
3300
- // loadingRef.current.addEventListener('animationend', ()=>{
3301
- // setController(newController as MintMapController)
3302
- // }, {
3303
- // once:true
3304
- // })
3305
- // loadingRef.current.classList.add(cn('ani-fade-in'))
3306
- // }else{
3307
- // setController(newController as MintMapController)
3308
- // }
3321
+ setController(newController_1);
3309
3322
  });
3310
3323
  } else {
3311
3324
  throw new Error("Not Supported Map type ".concat(mapType));
@@ -3451,10 +3464,10 @@ function SVGPolygon(_a) {
3451
3464
  var width = maxX - minX;
3452
3465
  var height = maxY - minY;
3453
3466
  return {
3454
- containerLeft: Math.floor(minX),
3455
- containerTop: Math.floor(minY),
3456
- containerWidth: Math.floor(width),
3457
- containerHeight: Math.floor(height)
3467
+ containerLeft: minX,
3468
+ containerTop: minY,
3469
+ containerWidth: width,
3470
+ containerHeight: height
3458
3471
  };
3459
3472
  }, []);
3460
3473
  var getD = useCallback(function (_a) {
@@ -3528,7 +3541,7 @@ function SVGPolygon(_a) {
3528
3541
  height: height,
3529
3542
  fill: mode === 'POLYLINE' ? 'none' : background,
3530
3543
  stroke: mode === 'POLYLINE' ? 'black' : 'green',
3531
- strokeLinejoin: "round",
3544
+ strokeLinejoin: "miter",
3532
3545
  strokeLinecap: "butt",
3533
3546
  d: d
3534
3547
  }, shapeProperties))), React.createElement("div", {
@@ -3677,8 +3690,8 @@ var Marker =
3677
3690
  /** @class */
3678
3691
  function (_super) {
3679
3692
  __extends(Marker, _super);
3680
- /**
3681
- * 지도에 표시할 마커정보
3693
+ /**
3694
+ * 지도에 표시할 마커정보
3682
3695
  */
3683
3696
 
3684
3697
 
@@ -3696,8 +3709,8 @@ var Polyline =
3696
3709
  /** @class */
3697
3710
  function (_super) {
3698
3711
  __extends(Polyline, _super);
3699
- /**
3700
- * 지도에 표시할 폴리곤정보
3712
+ /**
3713
+ * 지도에 표시할 폴리곤정보
3701
3714
  */
3702
3715
 
3703
3716
 
@@ -3715,8 +3728,8 @@ var Polygon =
3715
3728
  /** @class */
3716
3729
  function (_super) {
3717
3730
  __extends(Polygon, _super);
3718
- /**
3719
- * 지도에 표시할 폴리곤정보
3731
+ /**
3732
+ * 지도에 표시할 폴리곤정보
3720
3733
  */
3721
3734
 
3722
3735
 
@@ -3726,8 +3739,8 @@ function (_super) {
3726
3739
  _this.options = options;
3727
3740
  return _this;
3728
3741
  }
3729
- /**
3730
- * 폴리곤의 중점을 구한다.
3742
+ /**
3743
+ * 폴리곤의 중점을 구한다.
3731
3744
  */
3732
3745
 
3733
3746
 
@@ -3897,19 +3910,19 @@ var offsetCalibration = function (mapType, divElement, options) {
3897
3910
  divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
3898
3911
  }
3899
3912
  };
3900
- /**
3901
- * Mint Map 컴포넌트
3902
- *
3903
- * @param {MapControlWrapperProps} MapControlWrapperProps
3904
- *
3905
- * @returns {JSX.Element} JSX
3913
+ /**
3914
+ * Mint Map 컴포넌트
3915
+ *
3916
+ * @param {MapControlWrapperProps} MapControlWrapperProps
3917
+ *
3918
+ * @returns {JSX.Element} JSX
3906
3919
  */
3907
3920
 
3908
3921
 
3909
3922
  function MapMarkerWrapper(_a) {
3910
- var startAnimationClassName = _a.startAnimationClassName,
3911
- endAnimationClassName = _a.endAnimationClassName,
3912
- _b = _a.topOnClick,
3923
+ _a.startAnimationClassName;
3924
+ _a.endAnimationClassName;
3925
+ var _b = _a.topOnClick,
3913
3926
  topOnClick = _b === void 0 ? false : _b,
3914
3927
  _c = _a.topOnHover,
3915
3928
  topOnHover = _c === void 0 ? false : _c,
@@ -3923,9 +3936,7 @@ function MapMarkerWrapper(_a) {
3923
3936
  var controller = useMintMapController(); //element
3924
3937
 
3925
3938
  var divRef = useRef(document.createElement('div'));
3926
- var divElement = divRef.current; //element clone for animation
3927
-
3928
- var divCloneRef = useRef(); //marker
3939
+ var divElement = divRef.current; //marker
3929
3940
 
3930
3941
  var markerRef = useRef(); //moving animation
3931
3942
 
@@ -4000,32 +4011,12 @@ function MapMarkerWrapper(_a) {
4000
4011
  divElement.addEventListener('click', onClickHandler);
4001
4012
  divElement.addEventListener('mouseover', onMouseOverHandler);
4002
4013
  return function () {
4003
- //** kakao 는 viewport 안에 있는 마커만 렌더링하므로,
4004
- //마커 해제가 되더라도 애니메이션 이벤트가 일어나지 않아서 해지된 마커가 잠시 보이는 현상이 있음
4005
- //그래서 kakao 일때는 endAnimationClassName 영향을 받지 않도록 처리함
4006
- if (divCloneRef.current && endAnimationClassName && controller.getMapType() !== 'kakao') {
4007
- divCloneRef.current.classList.add(endAnimationClassName);
4008
-
4009
- var aniListener_1 = function () {
4010
- //console.log('animationend!!!', divCloneRef.current);
4011
- divCloneRef.current && divCloneRef.current.removeEventListener('animationend', aniListener_1);
4012
-
4013
- if (markerRef.current) {
4014
- controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
4015
- }
4016
-
4017
- divCloneRef.current = undefined;
4018
- };
4019
-
4020
- divCloneRef.current.addEventListener('animationend', aniListener_1);
4021
- divElement.append(divCloneRef.current);
4022
- } else {
4023
- divElement.removeEventListener('click', onClickHandler);
4024
- divElement.removeEventListener('mouseover', onMouseOverHandler);
4014
+ divElement.removeEventListener('click', onClickHandler);
4015
+ divElement.removeEventListener('mouseover', onMouseOverHandler);
4025
4016
 
4026
- if (markerRef.current) {
4027
- controller.clearDrawable(markerRef.current); // console.log('drawable cleared')
4028
- }
4017
+ if (markerRef.current) {
4018
+ controller.clearDrawable(markerRef.current);
4019
+ markerRef.current = undefined; // console.log('drawable cleared')
4029
4020
  }
4030
4021
  };
4031
4022
  }, []); //create / update object
@@ -4070,31 +4061,6 @@ function MapMarkerWrapper(_a) {
4070
4061
  setMovingState(__assign(__assign({}, movingAnimation), {
4071
4062
  marker: markerRef.current
4072
4063
  }));
4073
- } //start animation
4074
-
4075
-
4076
- if (startAnimationClassName) {
4077
- divElement.style.visibility = 'hidden';
4078
- setTimeout(function () {
4079
- var _a, _b;
4080
-
4081
- divCloneRef.current = divElement.firstElementChild;
4082
- divElement.style.visibility = 'visible';
4083
- (_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.add(startAnimationClassName);
4084
-
4085
- var aniListener = function () {
4086
- var _a, _b;
4087
-
4088
- (_a = divElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.classList.remove(startAnimationClassName);
4089
- (_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.removeEventListener('animationend', aniListener);
4090
- };
4091
-
4092
- (_b = divElement.firstElementChild) === null || _b === void 0 ? void 0 : _b.addEventListener('animationend', aniListener);
4093
- });
4094
- } else {
4095
- setTimeout(function () {
4096
- divCloneRef.current = divElement.firstElementChild;
4097
- });
4098
4064
  }
4099
4065
  }
4100
4066
  }
@@ -4237,12 +4203,12 @@ var calculateAverage = function (nums) {
4237
4203
  return Number((sum / nums.length).toFixed(7));
4238
4204
  };
4239
4205
 
4240
- /**
4241
- * CircleMarker
4242
- *
4243
- * @param {CircleMarkerProps} CircleMarkerProps
4244
- *
4245
- * @returns {JSX.Element} JSX
4206
+ /**
4207
+ * CircleMarker
4208
+ *
4209
+ * @param {CircleMarkerProps} CircleMarkerProps
4210
+ *
4211
+ * @returns {JSX.Element} JSX
4246
4212
  */
4247
4213
 
4248
4214
  function CircleMarker(_a) {
@@ -4354,12 +4320,12 @@ function CircleMarker(_a) {
4354
4320
  }, children)));
4355
4321
  }
4356
4322
 
4357
- /**
4358
- *PolygonMarker
4359
- *
4360
- * @param {PolygonMarkerProps} PolygonMarkerProps
4361
- *
4362
- * @returns {JSX.Element} JSX
4323
+ /**
4324
+ *PolygonMarker
4325
+ *
4326
+ * @param {PolygonMarkerProps} PolygonMarkerProps
4327
+ *
4328
+ * @returns {JSX.Element} JSX
4363
4329
  */
4364
4330
 
4365
4331
  function PolygonMarker(_a) {
@@ -4422,11 +4388,9 @@ function PolygonMarker(_a) {
4422
4388
 
4423
4389
  var _l = useState([]),
4424
4390
  innerOffsets = _l[0],
4425
- setInnerOffsets = _l[1]; //offset cache
4391
+ setInnerOffsets = _l[1]; //polygon props ref
4426
4392
 
4427
4393
 
4428
- var offsetCache = useRef(new Map()); //polygon props ref
4429
-
4430
4394
  var polygonPropsRef = useRef({
4431
4395
  position: position,
4432
4396
  innerPositions: innerPositions,
@@ -4437,7 +4401,6 @@ function PolygonMarker(_a) {
4437
4401
 
4438
4402
  useEffect(function () {
4439
4403
  // console.log('polygon changed');
4440
- offsetCache.current.clear();
4441
4404
  polygonPropsRef.current = {
4442
4405
  position: position,
4443
4406
  innerPositions: innerPositions,
@@ -4459,53 +4422,42 @@ function PolygonMarker(_a) {
4459
4422
  innerPositions = _a.innerPositions,
4460
4423
  simplifyPath = _a.simplifyPath,
4461
4424
  simplifyTolerance = _a.simplifyTolerance,
4462
- lastReapeated = _a.lastReapeated;
4463
- var prevCache = offsetCache.current.get(zoomLevel.current);
4464
-
4465
- if (prevCache) {
4466
- var offsets_1 = [];
4467
- offsets_1.push.apply(offsets_1, prevCache.offsets);
4468
- setOffsets(offsets_1);
4469
- var innerOffsets_1 = [];
4470
- innerOffsets_1.push.apply(innerOffsets_1, prevCache.innerOffsets);
4471
- setInnerOffsets(innerOffsets_1);
4472
- setPolygonStart(prevCache.start);
4473
- } else {
4474
- // path
4475
- var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(position, simplifyTolerance, lastReapeated) : position;
4476
- var offsets_2 = simplified.map(function (pos) {
4477
- var off = controller.positionToOffset(pos);
4478
- return new Offset(Math.floor(off.x), Math.floor(off.y));
4479
- });
4480
- setOffsets(offsets_2); //inner path
4425
+ lastReapeated = _a.lastReapeated; // path
4481
4426
 
4482
- var innerPath = [];
4427
+ var maxLat = undefined;
4428
+ var minLng = undefined;
4429
+ var offsets = position.map(function (pos) {
4430
+ if (maxLat === undefined || maxLat < pos.lat) {
4431
+ maxLat = pos.lat;
4432
+ }
4483
4433
 
4484
- if (innerPositions) {
4485
- for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
4486
- var innerPosition = innerPositions_1[_i];
4487
- var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(innerPosition, simplifyTolerance, lastReapeated) : innerPosition;
4488
- var offsets_3 = simplified_1.map(function (pos) {
4489
- var off = controller.positionToOffset(pos);
4490
- return new Offset(Math.floor(off.x), Math.floor(off.y));
4491
- });
4492
- innerPath.push(offsets_3);
4493
- }
4434
+ if (minLng === undefined || minLng > pos.lng) {
4435
+ minLng = pos.lng;
4436
+ }
4494
4437
 
4495
- setInnerOffsets(innerPath);
4496
- } //start point
4438
+ return controller.positionToOffset(pos);
4439
+ });
4440
+ var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(offsets, simplifyTolerance, lastReapeated) : offsets;
4441
+ setOffsets(simplified); //inner path
4497
4442
 
4443
+ var innerPath = [];
4498
4444
 
4499
- var regionInfo = PolygonCalculator.getRegionInfo(simplified);
4500
- var startPosition = regionInfo.maxLat && regionInfo.minLng ? new Position(regionInfo.maxLat, regionInfo.minLng) : undefined;
4501
- setPolygonStart(startPosition); //cache set
4445
+ if (innerPositions) {
4446
+ for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
4447
+ var innerPosition = innerPositions_1[_i];
4448
+ var offsets_1 = innerPosition.map(function (pos) {
4449
+ return controller.positionToOffset(pos);
4450
+ });
4451
+ var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(offsets_1, simplifyTolerance, lastReapeated) : offsets_1;
4452
+ innerPath.push(simplified_1);
4453
+ }
4502
4454
 
4503
- offsetCache.current.set(zoomLevel.current, {
4504
- start: startPosition,
4505
- offsets: offsets_2,
4506
- innerOffsets: innerPath
4507
- });
4508
- }
4455
+ setInnerOffsets(innerPath);
4456
+ } //start point
4457
+
4458
+
4459
+ var startPosition = maxLat && minLng ? new Position(maxLat, minLng) : undefined;
4460
+ setPolygonStart(startPosition);
4509
4461
  }, []);
4510
4462
  return React.createElement(React.Fragment, null, polygonStart && React.createElement(MapMarkerWrapper, {
4511
4463
  position: polygonStart,
@@ -4522,12 +4474,12 @@ function PolygonMarker(_a) {
4522
4474
  }, children)));
4523
4475
  }
4524
4476
 
4525
- /**
4526
- * Mint Map 컴포넌트
4527
- *
4528
- * @param {MapControlWrapperProps} MapControlWrapperProps
4529
- *
4530
- * @returns {JSX.Element} JSX
4477
+ /**
4478
+ * Mint Map 컴포넌트
4479
+ *
4480
+ * @param {MapControlWrapperProps} MapControlWrapperProps
4481
+ *
4482
+ * @returns {JSX.Element} JSX
4531
4483
  */
4532
4484
 
4533
4485
  function MapPolygonWrapper(_a) {
@@ -4542,6 +4494,7 @@ function MapPolygonWrapper(_a) {
4542
4494
  if (polygonRef.current) {
4543
4495
  // console.log('polygon cleared')
4544
4496
  controller.clearDrawable(polygonRef.current);
4497
+ polygonRef.current = undefined;
4545
4498
  }
4546
4499
  };
4547
4500
  }, []); //create/update object
@@ -5014,12 +4967,12 @@ var getAlignPosition = function (value, align) {
5014
4967
 
5015
4968
  throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
5016
4969
  };
5017
- /**
5018
- * Mint Map 컴포넌트
5019
- *
5020
- * @param {MapControlWrapperProps} MapControlWrapperProps
5021
- *
5022
- * @returns {JSX.Element} JSX
4970
+ /**
4971
+ * Mint Map 컴포넌트
4972
+ *
4973
+ * @param {MapControlWrapperProps} MapControlWrapperProps
4974
+ *
4975
+ * @returns {JSX.Element} JSX
5023
4976
  */
5024
4977
 
5025
4978
 
@@ -5044,12 +4997,12 @@ function MapControlWrapper(_a) {
5044
4997
  }, children);
5045
4998
  }
5046
4999
 
5047
- /**
5048
- * Mint Map 컴포넌트
5049
- *
5050
- * @param {MapControlWrapperProps} MapControlWrapperProps
5051
- *
5052
- * @returns {JSX.Element} JSX
5000
+ /**
5001
+ * Mint Map 컴포넌트
5002
+ *
5003
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5004
+ *
5005
+ * @returns {JSX.Element} JSX
5053
5006
  */
5054
5007
 
5055
5008
  function MapPolylineWrapper(_a) {
@@ -5062,7 +5015,8 @@ function MapPolylineWrapper(_a) {
5062
5015
  useEffect(function () {
5063
5016
  return function () {
5064
5017
  if (polylineRef.current) {
5065
- controller.clearDrawable(polylineRef.current); // console.log('polyline cleared')
5018
+ controller.clearDrawable(polylineRef.current);
5019
+ polylineRef.current = undefined; // console.log('polyline cleared')
5066
5020
  }
5067
5021
  };
5068
5022
  }, []); //create/update object
@@ -5089,12 +5043,12 @@ var console$1 = {
5089
5043
  log: function () {
5090
5044
  }
5091
5045
  };
5092
- /**
5093
- * Mint Map 컴포넌트
5094
- *
5095
- * @param {MapControlWrapperProps} MapControlWrapperProps
5096
- *
5097
- * @returns {JSX.Element} JSX
5046
+ /**
5047
+ * Mint Map 컴포넌트
5048
+ *
5049
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5050
+ *
5051
+ * @returns {JSX.Element} JSX
5098
5052
  */
5099
5053
 
5100
5054
  function MapCanvasWrapper(_a) {
@@ -5203,7 +5157,7 @@ function MapCanvasWrapper(_a) {
5203
5157
  var pos = item.position; // console.log('canvas mouseevent check', pos.offset);
5204
5158
 
5205
5159
  if (pos && !pos.offset) {
5206
- pos.offset = controller.positionToOffset(pos);
5160
+ pos.offset = positionToOffset(pos);
5207
5161
  }
5208
5162
 
5209
5163
  if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
@@ -5236,7 +5190,7 @@ function MapCanvasWrapper(_a) {
5236
5190
 
5237
5191
  if (map) {
5238
5192
  // const center = controller.getCenter()
5239
- // center.offset = controller.positionToOffset(center)
5193
+ // center.offset = positionToOffset(center)
5240
5194
  // if(center.offset){
5241
5195
  // prevX.current = center.offset.x
5242
5196
  // prevY.current = center.offset.y
@@ -5256,7 +5210,7 @@ function MapCanvasWrapper(_a) {
5256
5210
 
5257
5211
  if (containerRef.current) {
5258
5212
  // const pos = controller.getCenter()
5259
- // pos.offset = controller.positionToOffset(pos)
5213
+ // pos.offset = positionToOffset(pos)
5260
5214
  // const deltaX = prevX.current - pos.offset.x
5261
5215
  // const deltaY = prevY.current - pos.offset.y
5262
5216
  // offsetProvider.current.x += deltaX
@@ -5282,7 +5236,7 @@ function MapCanvasWrapper(_a) {
5282
5236
 
5283
5237
  map.addListener('mousemove', function (e) {
5284
5238
  var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
5285
- var clickedOffset = controller.positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
5239
+ var clickedOffset = positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
5286
5240
 
5287
5241
  var hitSet = processMouseEvent(clickedOffset, 'onMouseOver'); //mouse out 처리
5288
5242
 
@@ -5296,7 +5250,7 @@ function MapCanvasWrapper(_a) {
5296
5250
 
5297
5251
  map.addListener('click', function (e) {
5298
5252
  var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
5299
- var clickedOffset = controller.positionToOffset(clickPosition);
5253
+ var clickedOffset = positionToOffset(clickPosition);
5300
5254
  processMouseEvent(clickedOffset, 'onClick');
5301
5255
  });
5302
5256
  }
@@ -5367,7 +5321,7 @@ function MapCanvasWrapper(_a) {
5367
5321
  if (item.visible === undefined || item.visible) {
5368
5322
  var pos = item.position; //위치 변환
5369
5323
 
5370
- pos.offset = controller.positionToOffset(pos);
5324
+ pos.offset = positionToOffset(pos);
5371
5325
 
5372
5326
  if (item.anchor) {
5373
5327
  pos.offset.x += item.anchor.x;
@@ -5396,6 +5350,22 @@ function MapCanvasWrapper(_a) {
5396
5350
  }, []); //render!!!
5397
5351
 
5398
5352
  renderMain();
5353
+
5354
+ var positionToOffset = useCallback(function (position) {
5355
+ var div = controller.mapDivElement;
5356
+ var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
5357
+ var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
5358
+ var bounds = controller.getCurrBounds();
5359
+ var maxLng = bounds.ne.lng;
5360
+ var minLng = bounds.sw.lng;
5361
+ var lng = Math.abs(maxLng - minLng);
5362
+ var x = w * (position.lng - minLng) / lng;
5363
+ var maxLat = bounds.ne.lat;
5364
+ var minLat = bounds.sw.lat;
5365
+ var lat = Math.abs(maxLat - minLat);
5366
+ var y = h * (maxLat - position.lat) / lat;
5367
+ return new Offset(x, y);
5368
+ }, []);
5399
5369
  return React.createElement("div", {
5400
5370
  ref: containerRef,
5401
5371
  style: {
@@ -5413,12 +5383,12 @@ function MapCanvasWrapper(_a) {
5413
5383
  }), renderFlag && React.createElement(React.Fragment, null));
5414
5384
  }
5415
5385
 
5416
- /**
5417
- * Mint Map 컴포넌트
5418
- *
5419
- * @param {MapControlWrapperProps} MapControlWrapperProps
5420
- *
5421
- * @returns {JSX.Element} JSX
5386
+ /**
5387
+ * Mint Map 컴포넌트
5388
+ *
5389
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5390
+ *
5391
+ * @returns {JSX.Element} JSX
5422
5392
  */
5423
5393
 
5424
5394
  function MapCanvasMarkerWrapper(_props) {