@mint-ui/map 0.5.5-beta → 0.5.6-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) 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 +6 -6
  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/advanced/MapBuildingProjection.d.ts +15 -15
  11. package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -17
  12. package/dist/components/mint-map/core/advanced/index.d.ts +3 -3
  13. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -20
  14. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +6 -6
  15. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +26 -23
  16. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +6 -6
  17. package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -8
  18. package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -12
  19. package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -10
  20. package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -3
  21. package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -3
  22. package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
  23. package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
  24. package/dist/components/mint-map/core/index.d.ts +8 -8
  25. package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
  26. package/dist/components/mint-map/core/provider/index.d.ts +1 -1
  27. package/dist/components/mint-map/core/util/animation.d.ts +16 -16
  28. package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
  29. package/dist/components/mint-map/core/util/geo.d.ts +38 -38
  30. package/dist/components/mint-map/core/util/index.d.ts +5 -5
  31. package/dist/components/mint-map/core/util/polygon.d.ts +42 -40
  32. package/dist/components/mint-map/core/util/polygon.js +37 -8
  33. package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
  34. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -27
  35. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +6 -6
  36. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -11
  37. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +6 -6
  38. package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -18
  39. package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +6 -6
  40. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +42 -42
  41. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +6 -6
  42. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -12
  43. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +6 -6
  44. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -12
  45. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +6 -6
  46. package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
  47. package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -51
  48. package/dist/components/mint-map/index.d.ts +5 -5
  49. package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -56
  50. package/dist/components/mint-map/kakao/KakaoMintMapController.js +7 -7
  51. package/dist/components/mint-map/naver/NaverMintMapController.d.ts +54 -54
  52. package/dist/components/mint-map/naver/NaverMintMapController.js +5 -5
  53. package/dist/components/mint-map/types/CommonTypes.d.ts +11 -11
  54. package/dist/components/mint-map/types/MapDrawables.d.ts +110 -110
  55. package/dist/components/mint-map/types/MapDrawables.js +8 -8
  56. package/dist/components/mint-map/types/MapEventTypes.d.ts +44 -44
  57. package/dist/components/mint-map/types/MapTypes.d.ts +60 -60
  58. package/dist/components/mint-map/types/MapTypes.js +13 -13
  59. package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -25
  60. package/dist/components/mint-map/types/MintMapProps.d.ts +92 -92
  61. package/dist/components/mint-map/types/index.d.ts +6 -6
  62. package/dist/index.d.ts +7 -7
  63. package/dist/index.es.js +133 -104
  64. package/dist/index.umd.js +133 -104
  65. package/package.json +77 -77
package/dist/index.es.js CHANGED
@@ -361,9 +361,30 @@ function () {
361
361
  return false;
362
362
  };
363
363
 
364
- PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
365
- var target = lastRepeated ? polygon.slice(0, polygon.length - 1) : polygon;
366
- return this.simplify(target, tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
364
+ PolygonCalculator.simplifyPoints = function (polygon, tolerance, _lastRepeated) {
365
+ return this.simplify(this.pathCleaning(polygon), tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
366
+ };
367
+
368
+ PolygonCalculator.pathCleaning = function (polygon) {
369
+ if (polygon.length < 3) {
370
+ return polygon;
371
+ }
372
+
373
+ var main = polygon[0];
374
+ var delCount = 0;
375
+
376
+ for (var i = polygon.length - 1; i >= 0; i--) {
377
+ if (main.equals(polygon[i])) {
378
+ delCount += 1;
379
+ } else {
380
+ break;
381
+ }
382
+ }
383
+
384
+ delCount > 0 && polygon.splice(polygon.length - delCount, delCount);
385
+ var out = [];
386
+ out.push.apply(out, polygon);
387
+ return out;
367
388
  };
368
389
 
369
390
  PolygonCalculator.simplify = function (points, tolerance) {
@@ -374,8 +395,10 @@ function () {
374
395
  var dMax = 0;
375
396
  var index = 0; // Find the point with the maximum distance from the line segment
376
397
 
398
+ var denominator = this.perpendicularDistanceDenominator(points[0], points[points.length - 1]);
399
+
377
400
  for (var i = 1; i < points.length - 1; i++) {
378
- var d = this.perpendicularDistance(points[i], points[0], points[points.length - 1]);
401
+ var d = this.perpendicularDistance(points[i], points[0], points[points.length - 1], denominator);
379
402
 
380
403
  if (d > dMax) {
381
404
  dMax = d;
@@ -393,19 +416,25 @@ function () {
393
416
  // If the maximum distance is less than or equal to the tolerance, return the endpoints
394
417
  return [points[0], points[points.length - 1]];
395
418
  }
419
+ };
420
+
421
+ PolygonCalculator.perpendicularDistanceDenominator = function (lineStart, lineEnd) {
422
+ var x1 = lineStart.x,
423
+ y1 = lineStart.y;
424
+ var x2 = lineEnd.x,
425
+ y2 = lineEnd.y;
426
+ return Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
396
427
  }; // Calculate the perpendicular distance from a point to a line segment
397
428
 
398
429
 
399
- PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd) {
430
+ PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd, denominator) {
400
431
  var x = point.x;
401
432
  var y = point.y;
402
433
  var x1 = lineStart.x;
403
434
  var y1 = lineStart.y;
404
435
  var x2 = lineEnd.x;
405
436
  var y2 = lineEnd.y;
406
- var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
407
- var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
408
- return numerator / denominator;
437
+ return Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1) / denominator;
409
438
  };
410
439
 
411
440
  PolygonCalculator.calculatePolygonSize = function (polygon, innerPolygons) {
@@ -444,23 +473,23 @@ function () {
444
473
  return PolygonCalculator;
445
474
  }();
446
475
 
447
- /**
448
- * 좌표값
449
- * @description 위도/경도, DOM 상의 X/Y 좌표
476
+ /**
477
+ * 좌표값
478
+ * @description 위도/경도, DOM 상의 X/Y 좌표
450
479
  */
451
480
 
452
481
  var Position =
453
482
  /** @class */
454
483
  function () {
455
484
  function Position(lat, lng) {
456
- /**
457
- * 위도
458
- * @description 위도(latitude)
485
+ /**
486
+ * 위도
487
+ * @description 위도(latitude)
459
488
  */
460
489
  this.lat = 0;
461
- /**
462
- * 경도
463
- * @description 경도(longitude)
490
+ /**
491
+ * 경도
492
+ * @description 경도(longitude)
464
493
  */
465
494
 
466
495
  this.lng = 0;
@@ -568,15 +597,15 @@ function () {
568
597
 
569
598
  return Bounds;
570
599
  }();
571
- /**
572
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
600
+ /**
601
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
573
602
  */
574
603
 
575
604
  var Offset =
576
605
  /** @class */
577
606
  function () {
578
- /**
579
- * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
607
+ /**
608
+ * DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
580
609
  */
581
610
  function Offset(x, y) {
582
611
  this.x = x;
@@ -804,12 +833,12 @@ function () {
804
833
  MintMapController.prototype.getRandomFunctionName = function (prefix) {
805
834
  return "".concat(prefix, "_").concat(v4().replace(/-/g, '_'));
806
835
  };
807
- /**
808
- * URL 빌더 메서드
809
- *
810
- * @param {string} baseUrl: 기본 URL
811
- * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
812
- * @returns {string} URL
836
+ /**
837
+ * URL 빌더 메서드
838
+ *
839
+ * @param {string} baseUrl: 기본 URL
840
+ * @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
841
+ * @returns {string} URL
813
842
  */
814
843
 
815
844
 
@@ -822,9 +851,9 @@ function () {
822
851
  }).join('&');
823
852
  return "".concat(baseUrl, "?").concat(params);
824
853
  };
825
- /**
826
- * 쓰로틀링 처리
827
- * @returns
854
+ /**
855
+ * 쓰로틀링 처리
856
+ * @returns
828
857
  */
829
858
 
830
859
 
@@ -1385,11 +1414,11 @@ function (_super) {
1385
1414
  var map = marker.native.getMap();
1386
1415
 
1387
1416
  if (map) {
1388
- /** 중요!!!!
1389
- * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1390
- * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1391
- * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1392
- * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1417
+ /** 중요!!!!
1418
+ * naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
1419
+ * setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
1420
+ * (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
1421
+ * 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
1393
1422
  */
1394
1423
  //Position
1395
1424
  if (options.position && options.position instanceof Position) {
@@ -3071,13 +3100,13 @@ function (_super) {
3071
3100
  };
3072
3101
 
3073
3102
  KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
3074
- /**
3075
- * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3076
- * - 가장 확대된 값 : 1
3077
- * - 가장 축소된 값 : 14
3078
- *
3079
- * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3080
- * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3103
+ /**
3104
+ * 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
3105
+ * - 가장 확대된 값 : 1
3106
+ * - 가장 축소된 값 : 14
3107
+ *
3108
+ * 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
3109
+ * 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
3081
3110
  */
3082
3111
  var mapValue = this.getBaseToMapZoom(value);
3083
3112
 
@@ -3262,12 +3291,12 @@ var DEFAULT_CENTER = {
3262
3291
  lat: 37.5036845,
3263
3292
  lng: 127.0448698
3264
3293
  };
3265
- /**
3266
- * Mint Map 컴포넌트
3267
- *
3268
- * @param {MintMapProps} MintMapProps
3269
- *
3270
- * @returns {JSX.Element} JSX
3294
+ /**
3295
+ * Mint Map 컴포넌트
3296
+ *
3297
+ * @param {MintMapProps} MintMapProps
3298
+ *
3299
+ * @returns {JSX.Element} JSX
3271
3300
  */
3272
3301
 
3273
3302
  function MintMap(_a) {
@@ -3690,8 +3719,8 @@ var Marker =
3690
3719
  /** @class */
3691
3720
  function (_super) {
3692
3721
  __extends(Marker, _super);
3693
- /**
3694
- * 지도에 표시할 마커정보
3722
+ /**
3723
+ * 지도에 표시할 마커정보
3695
3724
  */
3696
3725
 
3697
3726
 
@@ -3709,8 +3738,8 @@ var Polyline =
3709
3738
  /** @class */
3710
3739
  function (_super) {
3711
3740
  __extends(Polyline, _super);
3712
- /**
3713
- * 지도에 표시할 폴리곤정보
3741
+ /**
3742
+ * 지도에 표시할 폴리곤정보
3714
3743
  */
3715
3744
 
3716
3745
 
@@ -3728,8 +3757,8 @@ var Polygon =
3728
3757
  /** @class */
3729
3758
  function (_super) {
3730
3759
  __extends(Polygon, _super);
3731
- /**
3732
- * 지도에 표시할 폴리곤정보
3760
+ /**
3761
+ * 지도에 표시할 폴리곤정보
3733
3762
  */
3734
3763
 
3735
3764
 
@@ -3739,8 +3768,8 @@ function (_super) {
3739
3768
  _this.options = options;
3740
3769
  return _this;
3741
3770
  }
3742
- /**
3743
- * 폴리곤의 중점을 구한다.
3771
+ /**
3772
+ * 폴리곤의 중점을 구한다.
3744
3773
  */
3745
3774
 
3746
3775
 
@@ -3910,12 +3939,12 @@ var offsetCalibration = function (mapType, divElement, options) {
3910
3939
  divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
3911
3940
  }
3912
3941
  };
3913
- /**
3914
- * Mint Map 컴포넌트
3915
- *
3916
- * @param {MapControlWrapperProps} MapControlWrapperProps
3917
- *
3918
- * @returns {JSX.Element} JSX
3942
+ /**
3943
+ * Mint Map 컴포넌트
3944
+ *
3945
+ * @param {MapControlWrapperProps} MapControlWrapperProps
3946
+ *
3947
+ * @returns {JSX.Element} JSX
3919
3948
  */
3920
3949
 
3921
3950
 
@@ -4203,12 +4232,12 @@ var calculateAverage = function (nums) {
4203
4232
  return Number((sum / nums.length).toFixed(7));
4204
4233
  };
4205
4234
 
4206
- /**
4207
- * CircleMarker
4208
- *
4209
- * @param {CircleMarkerProps} CircleMarkerProps
4210
- *
4211
- * @returns {JSX.Element} JSX
4235
+ /**
4236
+ * CircleMarker
4237
+ *
4238
+ * @param {CircleMarkerProps} CircleMarkerProps
4239
+ *
4240
+ * @returns {JSX.Element} JSX
4212
4241
  */
4213
4242
 
4214
4243
  function CircleMarker(_a) {
@@ -4320,12 +4349,12 @@ function CircleMarker(_a) {
4320
4349
  }, children)));
4321
4350
  }
4322
4351
 
4323
- /**
4324
- *PolygonMarker
4325
- *
4326
- * @param {PolygonMarkerProps} PolygonMarkerProps
4327
- *
4328
- * @returns {JSX.Element} JSX
4352
+ /**
4353
+ *PolygonMarker
4354
+ *
4355
+ * @param {PolygonMarkerProps} PolygonMarkerProps
4356
+ *
4357
+ * @returns {JSX.Element} JSX
4329
4358
  */
4330
4359
 
4331
4360
  function PolygonMarker(_a) {
@@ -4476,12 +4505,12 @@ function PolygonMarker(_a) {
4476
4505
  }, children)));
4477
4506
  }
4478
4507
 
4479
- /**
4480
- * Mint Map 컴포넌트
4481
- *
4482
- * @param {MapControlWrapperProps} MapControlWrapperProps
4483
- *
4484
- * @returns {JSX.Element} JSX
4508
+ /**
4509
+ * Mint Map 컴포넌트
4510
+ *
4511
+ * @param {MapControlWrapperProps} MapControlWrapperProps
4512
+ *
4513
+ * @returns {JSX.Element} JSX
4485
4514
  */
4486
4515
 
4487
4516
  function MapPolygonWrapper(_a) {
@@ -4969,12 +4998,12 @@ var getAlignPosition = function (value, align) {
4969
4998
 
4970
4999
  throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
4971
5000
  };
4972
- /**
4973
- * Mint Map 컴포넌트
4974
- *
4975
- * @param {MapControlWrapperProps} MapControlWrapperProps
4976
- *
4977
- * @returns {JSX.Element} JSX
5001
+ /**
5002
+ * Mint Map 컴포넌트
5003
+ *
5004
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5005
+ *
5006
+ * @returns {JSX.Element} JSX
4978
5007
  */
4979
5008
 
4980
5009
 
@@ -4999,12 +5028,12 @@ function MapControlWrapper(_a) {
4999
5028
  }, children);
5000
5029
  }
5001
5030
 
5002
- /**
5003
- * Mint Map 컴포넌트
5004
- *
5005
- * @param {MapControlWrapperProps} MapControlWrapperProps
5006
- *
5007
- * @returns {JSX.Element} JSX
5031
+ /**
5032
+ * Mint Map 컴포넌트
5033
+ *
5034
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5035
+ *
5036
+ * @returns {JSX.Element} JSX
5008
5037
  */
5009
5038
 
5010
5039
  function MapPolylineWrapper(_a) {
@@ -5045,12 +5074,12 @@ var console$1 = {
5045
5074
  log: function () {
5046
5075
  }
5047
5076
  };
5048
- /**
5049
- * Mint Map 컴포넌트
5050
- *
5051
- * @param {MapControlWrapperProps} MapControlWrapperProps
5052
- *
5053
- * @returns {JSX.Element} JSX
5077
+ /**
5078
+ * Mint Map 컴포넌트
5079
+ *
5080
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5081
+ *
5082
+ * @returns {JSX.Element} JSX
5054
5083
  */
5055
5084
 
5056
5085
  function MapCanvasWrapper(_a) {
@@ -5369,12 +5398,12 @@ function MapCanvasWrapper(_a) {
5369
5398
  }), renderFlag && React.createElement(React.Fragment, null));
5370
5399
  }
5371
5400
 
5372
- /**
5373
- * Mint Map 컴포넌트
5374
- *
5375
- * @param {MapControlWrapperProps} MapControlWrapperProps
5376
- *
5377
- * @returns {JSX.Element} JSX
5401
+ /**
5402
+ * Mint Map 컴포넌트
5403
+ *
5404
+ * @param {MapControlWrapperProps} MapControlWrapperProps
5405
+ *
5406
+ * @returns {JSX.Element} JSX
5378
5407
  */
5379
5408
 
5380
5409
  function MapCanvasMarkerWrapper(_props) {