@mint-ui/map 0.3.6-beta → 0.3.7-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __awaiter, __generator, __extends, __assign, __rest, __spreadArray } from 'tslib';
1
+ import { __awaiter, __generator, __spreadArray, __extends, __assign, __rest } from 'tslib';
2
2
  import React, { createContext, useContext, useRef, useState, useEffect, useMemo } from 'react';
3
3
  import classNames from 'classnames/bind';
4
4
  import styleInject from 'style-inject';
@@ -386,9 +386,225 @@ var MintMapController = function () {
386
386
  }
387
387
  };
388
388
 
389
+ MintMapController.prototype.getBaseToMapZoom = function (zoomBase) {
390
+ var baseMap = MapZoomInfo.BASE_TO_MAP.get(zoomBase);
391
+
392
+ if (baseMap) {
393
+ var mapZoomInfo = baseMap.get(this.getMapType());
394
+
395
+ if (mapZoomInfo) {
396
+ return mapZoomInfo.level;
397
+ }
398
+ }
399
+
400
+ throw new Error("[getBaseToMapZoom][".concat(zoomBase, "] is not valid zoom level"));
401
+ };
402
+
403
+ MintMapController.prototype.getMapToBaseZoom = function (mapZoom) {
404
+ var baseZoom = MapZoomInfo.MAP_TO_BASE.get(this.getMapType() + mapZoom);
405
+
406
+ if (baseZoom) {
407
+ return baseZoom;
408
+ }
409
+
410
+ throw new Error("[getMapToBaseZoom][".concat(mapZoom, "] is not valid zoom level"));
411
+ };
412
+
389
413
  return MintMapController;
390
414
  }();
391
415
 
416
+ var MapZoomInfo = function () {
417
+ function MapZoomInfo() {}
418
+
419
+ MapZoomInfo.BASE_TO_MAP = new Map([[1, new Map([['google', {
420
+ level: 1
421
+ }], ['naver', {
422
+ level: 6
423
+ }], ['kakao', {
424
+ level: 14
425
+ }]])], [2, new Map([['google', {
426
+ level: 2,
427
+ distance: 2000,
428
+ unit: 'km'
429
+ }], ['naver', {
430
+ level: 6
431
+ }], ['kakao', {
432
+ level: 14
433
+ }]])], [3, new Map([['google', {
434
+ level: 3,
435
+ distance: 1000,
436
+ unit: 'km'
437
+ }], ['naver', {
438
+ level: 6
439
+ }], ['kakao', {
440
+ level: 14
441
+ }]])], [4, new Map([['google', {
442
+ level: 4,
443
+ distance: 500,
444
+ unit: 'km'
445
+ }], ['naver', {
446
+ level: 6
447
+ }], ['kakao', {
448
+ level: 14
449
+ }]])], [5, new Map([['google', {
450
+ level: 5,
451
+ distance: 200,
452
+ unit: 'km'
453
+ }], ['naver', {
454
+ level: 6
455
+ }], ['kakao', {
456
+ level: 14
457
+ }]])], [6, new Map([['google', {
458
+ level: 6,
459
+ distance: 100,
460
+ unit: 'km'
461
+ }], ['naver', {
462
+ level: 6
463
+ }], ['kakao', {
464
+ level: 14
465
+ }]])], [7, new Map([['google', {
466
+ level: 7,
467
+ distance: 50,
468
+ unit: 'km'
469
+ }], ['naver', {
470
+ level: 7
471
+ }], ['kakao', {
472
+ level: 13
473
+ }]])], [8, new Map([['google', {
474
+ level: 8,
475
+ distance: 20,
476
+ unit: 'km'
477
+ }], ['naver', {
478
+ level: 8
479
+ }], ['kakao', {
480
+ level: 12
481
+ }]])], [9, new Map([['google', {
482
+ level: 9,
483
+ distance: 10,
484
+ unit: 'km'
485
+ }], ['naver', {
486
+ level: 9
487
+ }], ['kakao', {
488
+ level: 11
489
+ }]])], [10, new Map([['google', {
490
+ level: 10,
491
+ distance: 5,
492
+ unit: 'km'
493
+ }], ['naver', {
494
+ level: 10
495
+ }], ['kakao', {
496
+ level: 10
497
+ }]])], [11, new Map([['google', {
498
+ level: 11,
499
+ distance: 2,
500
+ unit: 'km'
501
+ }], ['naver', {
502
+ level: 11
503
+ }], ['kakao', {
504
+ level: 9
505
+ }]])], [12, new Map([['google', {
506
+ level: 12,
507
+ distance: 1,
508
+ unit: 'km'
509
+ }], ['naver', {
510
+ level: 12
511
+ }], ['kakao', {
512
+ level: 8
513
+ }]])], [13, new Map([['google', {
514
+ level: 13,
515
+ distance: 500,
516
+ unit: 'm'
517
+ }], ['naver', {
518
+ level: 13
519
+ }], ['kakao', {
520
+ level: 7
521
+ }]])], [14, new Map([['google', {
522
+ level: 14,
523
+ distance: 500,
524
+ unit: 'm'
525
+ }], ['naver', {
526
+ level: 14
527
+ }], ['kakao', {
528
+ level: 6
529
+ }]])], [15, new Map([['google', {
530
+ level: 15,
531
+ distance: 500,
532
+ unit: 'm'
533
+ }], ['naver', {
534
+ level: 15
535
+ }], ['kakao', {
536
+ level: 5
537
+ }]])], [16, new Map([['google', {
538
+ level: 16,
539
+ distance: 500,
540
+ unit: 'm'
541
+ }], ['naver', {
542
+ level: 16
543
+ }], ['kakao', {
544
+ level: 4
545
+ }]])], [17, new Map([['google', {
546
+ level: 17,
547
+ distance: 500,
548
+ unit: 'm'
549
+ }], ['naver', {
550
+ level: 17
551
+ }], ['kakao', {
552
+ level: 3
553
+ }]])], [18, new Map([['google', {
554
+ level: 18,
555
+ distance: 500,
556
+ unit: 'm'
557
+ }], ['naver', {
558
+ level: 18
559
+ }], ['kakao', {
560
+ level: 2
561
+ }]])], [19, new Map([['google', {
562
+ level: 19,
563
+ distance: 500,
564
+ unit: 'm'
565
+ }], ['naver', {
566
+ level: 19
567
+ }], ['kakao', {
568
+ level: 1
569
+ }]])], [20, new Map([['google', {
570
+ level: 20,
571
+ distance: 500,
572
+ unit: 'm'
573
+ }], ['naver', {
574
+ level: 20
575
+ }], ['kakao', {
576
+ level: 1
577
+ }]])], [21, new Map([['google', {
578
+ level: 21,
579
+ distance: 500,
580
+ unit: 'm'
581
+ }], ['naver', {
582
+ level: 21
583
+ }], ['kakao', {
584
+ level: 1
585
+ }]])], [22, new Map([['google', {
586
+ level: 22,
587
+ distance: 500,
588
+ unit: 'm'
589
+ }], ['naver', {
590
+ level: 21
591
+ }], ['kakao', {
592
+ level: 1
593
+ }]])]]);
594
+ MapZoomInfo.MAP_TO_BASE = new Map(__spreadArray([], Array.from(MapZoomInfo.BASE_TO_MAP.entries()).map(function (item) {
595
+ var base = item[0];
596
+ var mapZoom = item[1];
597
+ var result = [];
598
+ mapZoom.forEach(function (value, key) {
599
+ result.push([key + value.level, base]);
600
+ });
601
+ return result;
602
+ }).flatMap(function (a) {
603
+ return a;
604
+ }), true));
605
+ return MapZoomInfo;
606
+ }();
607
+
392
608
  function waiting(evaluation, timeoutSeconds) {
393
609
  return __awaiter(this, void 0, void 0, function () {
394
610
  var max;
@@ -1413,6 +1629,509 @@ var GoogleMintMapController = function (_super) {
1413
1629
  return GoogleMintMapController;
1414
1630
  }(MintMapController);
1415
1631
 
1632
+ var KakaoMintMapController = function (_super) {
1633
+ __extends(KakaoMintMapController, _super);
1634
+
1635
+ function KakaoMintMapController(props) {
1636
+ var _this = _super.call(this, props) || this;
1637
+
1638
+ _this.type = 'kakao';
1639
+ _this.map = null;
1640
+ _this.scriptUrl = 'https://dapi.kakao.com/v2/maps/sdk.js';
1641
+ _this.scriptModules = ['services', 'clusterer'];
1642
+ _this.polylineEvents = ['mouseover', 'mouseout'];
1643
+ _this.polygonEvents = ['mouseover', 'mouseout'];
1644
+ _this.markerEvents = ['click', 'mouseover', 'mouseout'];
1645
+ _this.dragStartPoint = [0, 0];
1646
+ _this.dragged = false;
1647
+ console.log("".concat(_this.type, " controller loadded"));
1648
+ return _this;
1649
+ }
1650
+
1651
+ KakaoMintMapController.prototype.initMarkerPool = function () {
1652
+ var _this = this;
1653
+
1654
+ if (!this.mapProps.markerCache) return;
1655
+ this.markerPool = new ObjectPool().setFactory(function () {
1656
+ return new kakao.maps.CustomOverlay({
1657
+ position: _this.positionToLatLng(new Position(0, 0)),
1658
+ map: _this.map || undefined
1659
+ });
1660
+ }).setClear(function (item) {
1661
+ item.setMap(null);
1662
+ }).createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000).setCheckLiveTimeInterval(1000);
1663
+ };
1664
+
1665
+ KakaoMintMapController.prototype.createPolyline = function (polyline) {
1666
+ var _this = this;
1667
+
1668
+ var _a = polyline.options,
1669
+ position = _a.position,
1670
+ _b = _a.lineColor,
1671
+ lineColor = _b === void 0 ? 'blue' : _b,
1672
+ _c = _a.lineSize,
1673
+ lineSize = _c === void 0 ? 1 : _c,
1674
+ _d = _a.lineOpacity,
1675
+ lineOpacity = _d === void 0 ? 1 : _d;
1676
+ _a.visible;
1677
+ _a.editable;
1678
+ var event = _a.event;
1679
+
1680
+ if (this.map && Array.isArray(position)) {
1681
+ var path = position.map(function (elem) {
1682
+ return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
1683
+ });
1684
+ var pol_1 = new kakao.maps.Polyline({
1685
+ map: this.map,
1686
+ path: path,
1687
+ strokeColor: lineColor,
1688
+ strokeWeight: lineSize,
1689
+ strokeOpacity: lineOpacity
1690
+ });
1691
+ polyline.native = pol_1;
1692
+ event && event.forEach(function (handler, key) {
1693
+ if (_this.polylineEvents.includes(key)) {
1694
+ kakao.maps.event.addListener(pol_1, key, handler);
1695
+ }
1696
+ });
1697
+ }
1698
+ };
1699
+
1700
+ KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
1701
+ var _this = this;
1702
+
1703
+ if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
1704
+ var path = void 0;
1705
+
1706
+ if (Array.isArray(options.position)) {
1707
+ path = options.position.map(function (elem) {
1708
+ return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
1709
+ });
1710
+ }
1711
+
1712
+ polyline.native.setOptions({
1713
+ path: path || polyline.native.getPath(),
1714
+ strokeColor: options.lineColor,
1715
+ strokeWeight: options.lineSize,
1716
+ strokeOpacity: options.lineOpacity
1717
+ });
1718
+ }
1719
+ };
1720
+
1721
+ KakaoMintMapController.prototype.createPolygon = function (polygon) {
1722
+ var _this = this;
1723
+
1724
+ var _a = polygon.options,
1725
+ position = _a.position,
1726
+ innerPositions = _a.innerPositions,
1727
+ _b = _a.lineColor,
1728
+ lineColor = _b === void 0 ? 'green' : _b,
1729
+ _c = _a.lineSize,
1730
+ lineSize = _c === void 0 ? 1 : _c,
1731
+ _d = _a.lineOpacity,
1732
+ lineOpacity = _d === void 0 ? 1 : _d,
1733
+ _e = _a.fillColor,
1734
+ fillColor = _e === void 0 ? 'lightgreen' : _e,
1735
+ _f = _a.fillOpacity,
1736
+ fillOpacity = _f === void 0 ? 0.5 : _f;
1737
+ _a.visible;
1738
+ _a.editable;
1739
+ var event = _a.event;
1740
+
1741
+ if (this.map && Array.isArray(position)) {
1742
+ var outLine = position.map(function (elem) {
1743
+ return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
1744
+ });
1745
+ var path = [outLine];
1746
+ innerPositions && path.push(innerPositions.map(function (inner) {
1747
+ return _this.positionToLatLng(inner);
1748
+ }));
1749
+ var pol_2 = new kakao.maps.Polygon({
1750
+ map: this.map,
1751
+ path: path,
1752
+ strokeColor: lineColor,
1753
+ strokeWeight: lineSize,
1754
+ strokeOpacity: lineOpacity,
1755
+ fillColor: fillColor,
1756
+ fillOpacity: fillOpacity
1757
+ });
1758
+ polygon.native = pol_2;
1759
+ event && event.forEach(function (handler, key) {
1760
+ if (_this.polygonEvents.includes(key)) {
1761
+ kakao.maps.event.addListener(pol_2, key, handler);
1762
+ }
1763
+ });
1764
+ }
1765
+ };
1766
+
1767
+ KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
1768
+ var _this = this;
1769
+
1770
+ if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
1771
+ var paths = void 0;
1772
+
1773
+ if (Array.isArray(options.position)) {
1774
+ var outLine = options.position.map(function (elem) {
1775
+ return _this.positionToLatLng(Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem);
1776
+ });
1777
+ paths = [outLine];
1778
+ options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
1779
+ return _this.positionToLatLng(inner);
1780
+ }));
1781
+ }
1782
+
1783
+ polygon.native.setOptions({
1784
+ path: paths || polygon.native.getPath(),
1785
+ strokeColor: options.lineColor,
1786
+ strokeWeight: options.lineSize,
1787
+ strokeOpacity: options.lineOpacity,
1788
+ fillColor: options.fillColor,
1789
+ fillOpacity: options.fillOpacity
1790
+ });
1791
+ }
1792
+ };
1793
+
1794
+ KakaoMintMapController.prototype.createMarker = function (marker) {
1795
+ var _this = this;
1796
+
1797
+ var _a;
1798
+
1799
+ if (this.map) {
1800
+ var options = {
1801
+ map: this.map,
1802
+ position: this.positionToLatLng(marker.options.position)
1803
+ };
1804
+ marker.element && (options.content = marker.element);
1805
+ var kakaoMarker_1;
1806
+
1807
+ if (this.mapProps.markerCache && this.markerPool) {
1808
+ kakaoMarker_1 = this.markerPool.getPoolItem();
1809
+ kakaoMarker_1.setVisible(true);
1810
+ options.content && kakaoMarker_1.setContent(options.content);
1811
+ marker.native = kakaoMarker_1;
1812
+ this.updateMarker(marker, marker.options);
1813
+ } else {
1814
+ kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
1815
+ marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
1816
+ marker.native = kakaoMarker_1;
1817
+ }
1818
+
1819
+ ((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
1820
+ if (_this.markerEvents.includes(key)) {
1821
+ kakao.maps.event.addListener(kakaoMarker_1, key, handler);
1822
+ }
1823
+ });
1824
+ }
1825
+ };
1826
+
1827
+ KakaoMintMapController.prototype.updateMarker = function (marker, options) {
1828
+ if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
1829
+ var map = marker.native.getMap();
1830
+
1831
+ if (map) {
1832
+ if (options.position && options.position instanceof Position) {
1833
+ marker.native.setPosition(this.positionToLatLng(options.position));
1834
+ }
1835
+
1836
+ if (options.visible !== undefined) {
1837
+ marker.native.setVisible(options.visible);
1838
+ }
1839
+ }
1840
+ }
1841
+ };
1842
+
1843
+ KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
1844
+ if (increment === void 0) {
1845
+ increment = 0;
1846
+ }
1847
+
1848
+ if (this.map) {
1849
+ var targetPane = parent;
1850
+ var max = 0;
1851
+
1852
+ for (var i = 0; i < targetPane.childElementCount; i++) {
1853
+ var elem = targetPane.children[i];
1854
+
1855
+ if (elem instanceof HTMLElement) {
1856
+ var index = Number(elem.style.zIndex);
1857
+
1858
+ if (!isNaN(index) && index > max) {
1859
+ max = index;
1860
+ }
1861
+ }
1862
+ }
1863
+
1864
+ this.markerMaxZIndex = max + increment;
1865
+ return this.markerMaxZIndex;
1866
+ } else {
1867
+ return this.markerMaxZIndex || 1;
1868
+ }
1869
+ };
1870
+
1871
+ KakaoMintMapController.prototype.setMarkerZIndex = function (marker, zIndex) {
1872
+ if (this.map && marker.element && marker.element instanceof HTMLElement) {
1873
+ var parent_1 = marker.element.parentElement;
1874
+
1875
+ if (parent_1) {
1876
+ parent_1.style.zIndex = String(zIndex);
1877
+ }
1878
+ }
1879
+ };
1880
+
1881
+ KakaoMintMapController.prototype.markerToTheTop = function (marker) {
1882
+ if (this.map && marker.element && marker.element instanceof HTMLElement) {
1883
+ var parent_2 = marker.element.parentElement;
1884
+
1885
+ if (parent_2) {
1886
+ this.setMarkerZIndex(marker, this.getMaxZIndex(1, parent_2));
1887
+ }
1888
+ }
1889
+ };
1890
+
1891
+ KakaoMintMapController.prototype.clearDrawable = function (drawable) {
1892
+ var _this = this;
1893
+
1894
+ var _a, _b;
1895
+
1896
+ if (drawable && drawable.native && (drawable.native instanceof kakao.maps.CustomOverlay || drawable.native instanceof kakao.maps.Polyline || drawable.native instanceof kakao.maps.Polygon)) {
1897
+ if (drawable.native instanceof kakao.maps.CustomOverlay) {
1898
+ if (this.mapProps.markerCache && this.markerPool) {
1899
+ drawable.native.setVisible(false);
1900
+ (_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.releasePoolItem(drawable.native);
1901
+ } else {
1902
+ drawable.native.setMap(null);
1903
+ }
1904
+ } else {
1905
+ drawable.native.setMap(null);
1906
+ }
1907
+
1908
+ ((_b = drawable.options) === null || _b === void 0 ? void 0 : _b.event) && drawable.options.event.forEach(function (handler, key) {
1909
+ if (_this.markerEvents.includes(key)) {
1910
+ kakao.maps.event.removeListener(drawable.native, key, handler);
1911
+ }
1912
+ });
1913
+ return true;
1914
+ }
1915
+
1916
+ return false;
1917
+ };
1918
+
1919
+ KakaoMintMapController.prototype.isMapDragged = function () {
1920
+ return this.dragged;
1921
+ };
1922
+
1923
+ KakaoMintMapController.prototype.setMapDragged = function (value) {
1924
+ this.dragged = false;
1925
+ };
1926
+
1927
+ KakaoMintMapController.prototype.loadMapApi = function () {
1928
+ return __awaiter(this, void 0, void 0, function () {
1929
+ var _this = this;
1930
+
1931
+ return __generator(this, function (_a) {
1932
+ return [2, new Promise(function (resolve) {
1933
+ return __awaiter(_this, void 0, void 0, function () {
1934
+ var params, ok;
1935
+ return __generator(this, function (_a) {
1936
+ switch (_a.label) {
1937
+ case 0:
1938
+ params = {
1939
+ appkey: this.mapProps.mapKey,
1940
+ libraries: this.scriptModules.join(','),
1941
+ autoload: false
1942
+ };
1943
+ return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakaoscript')];
1944
+
1945
+ case 1:
1946
+ _a.sent();
1947
+
1948
+ window.kakao.maps.load();
1949
+ return [4, waiting(function () {
1950
+ return window.kakao.maps.Map ? true : false;
1951
+ })];
1952
+
1953
+ case 2:
1954
+ ok = _a.sent();
1955
+
1956
+ if (!ok) {
1957
+ throw new Error('kakao script api load failed!!');
1958
+ }
1959
+
1960
+ this.mapApiLoaded = true;
1961
+ resolve(true);
1962
+ console.log("".concat(this.type, " map script loaded"));
1963
+ return [2];
1964
+ }
1965
+ });
1966
+ });
1967
+ })];
1968
+ });
1969
+ });
1970
+ };
1971
+
1972
+ KakaoMintMapController.prototype.initializingMap = function (divElement) {
1973
+ return __awaiter(this, void 0, void 0, function () {
1974
+ var _this = this;
1975
+
1976
+ return __generator(this, function (_a) {
1977
+ return [2, new Promise(function (resolve) {
1978
+ return __awaiter(_this, void 0, void 0, function () {
1979
+ var options, maxZoom, minZoom, map;
1980
+
1981
+ var _this = this;
1982
+
1983
+ var _a, _b, _c, _d;
1984
+
1985
+ return __generator(this, function (_e) {
1986
+ switch (_e.label) {
1987
+ case 0:
1988
+ if (this.mapInitialized && this.map) {
1989
+ if (this.map.getElement() === divElement) {
1990
+ resolve(this.map);
1991
+ return [2];
1992
+ } else {
1993
+ this.map.destroy();
1994
+ }
1995
+ }
1996
+
1997
+ if (!!this.mapApiLoaded) return [3, 2];
1998
+ return [4, this.loadMapApi()];
1999
+
2000
+ case 1:
2001
+ _e.sent();
2002
+
2003
+ _e.label = 2;
2004
+
2005
+ case 2:
2006
+ options = {
2007
+ center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
2008
+ level: this.getBaseToMapZoom((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel),
2009
+ draggable: this.mapProps.draggable === false ? false : true,
2010
+ scrollWheel: this.mapProps.draggable === false ? false : true,
2011
+ keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
2012
+ };
2013
+ maxZoom = 1;
2014
+ minZoom = 14;
2015
+
2016
+ if ((_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.maxZoomLevel) {
2017
+ maxZoom = this.getSafeZoomValue(this.mapProps.base.maxZoomLevel);
2018
+ }
2019
+
2020
+ if ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.minZoomLevel) {
2021
+ minZoom = this.getSafeZoomValue(this.mapProps.base.minZoomLevel);
2022
+ }
2023
+
2024
+ if (minZoom < maxZoom) {
2025
+ minZoom = 14;
2026
+ }
2027
+
2028
+ map = new kakao.maps.Map(divElement, options);
2029
+ map.setMaxLevel(minZoom);
2030
+ map.setMinLevel(maxZoom);
2031
+ this.map = map;
2032
+ map.addListener('idle', function (e) {
2033
+ _this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
2034
+ });
2035
+ map.addListener('zoom_changed', function () {
2036
+ _this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
2037
+ });
2038
+ map.addListener('click', function (e) {
2039
+ if (!_this.mapProps.onClick) return;
2040
+ var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
2041
+ pos.offset = new Offset(e.point.x, e.point.y);
2042
+
2043
+ _this.mapProps.onClick(pos);
2044
+ });
2045
+ map.addListener('mousemove', function (e) {
2046
+ if (!_this.mapProps.onMouseMove) return;
2047
+ var pos = new Position(e.latLng.getLat(), e.latLng.getLng());
2048
+ pos.offset = new Offset(e.point.x, e.point.y);
2049
+
2050
+ _this.mapProps.onMouseMove(pos);
2051
+ });
2052
+ this.mapInitialized = true;
2053
+ this.initMarkerPool();
2054
+ console.log("".concat(this.type, " map script initialized"), divElement);
2055
+ resolve(map);
2056
+ return [2];
2057
+ }
2058
+ });
2059
+ });
2060
+ })];
2061
+ });
2062
+ });
2063
+ };
2064
+
2065
+ KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
2066
+ var mapValue = this.getBaseToMapZoom(value);
2067
+
2068
+ if (mapValue > 14) {
2069
+ return 14;
2070
+ } else if (mapValue < 1) {
2071
+ return 1;
2072
+ }
2073
+
2074
+ return mapValue;
2075
+ };
2076
+
2077
+ KakaoMintMapController.prototype.destroyMap = function () {
2078
+ var _a;
2079
+
2080
+ try {
2081
+ (_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
2082
+ } catch (e) {
2083
+ console.log('kakao map destroy error', e);
2084
+ }
2085
+
2086
+ console.log("".concat(this.type, " map destroyed"));
2087
+ };
2088
+
2089
+ KakaoMintMapController.prototype.getCurrBounds = function () {
2090
+ if (!this.map) {
2091
+ throw new Error('Map is not initialized!!');
2092
+ }
2093
+
2094
+ var bounds = this.map.getBounds();
2095
+ return Bounds.fromNESW(this.latLngToPosition(bounds.getNorthEast()), this.latLngToPosition(bounds.getSouthWest()));
2096
+ };
2097
+
2098
+ KakaoMintMapController.prototype.panningTo = function (targetCenter) {
2099
+ var _a;
2100
+
2101
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.panTo(this.positionToLatLng(targetCenter));
2102
+ };
2103
+
2104
+ KakaoMintMapController.prototype.getZoomLevel = function () {
2105
+ return this.map ? this.getMapToBaseZoom(this.map.getLevel()) : 13;
2106
+ };
2107
+
2108
+ KakaoMintMapController.prototype.setZoomLevel = function (zoom) {
2109
+ var _a;
2110
+
2111
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.setLevel(this.getBaseToMapZoom(zoom));
2112
+ };
2113
+
2114
+ KakaoMintMapController.prototype.getCenter = function () {
2115
+ return this.getCurrBounds().getCenter();
2116
+ };
2117
+
2118
+ KakaoMintMapController.prototype.setCenter = function (position) {
2119
+ var _a;
2120
+
2121
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(this.positionToLatLng(position));
2122
+ };
2123
+
2124
+ KakaoMintMapController.prototype.positionToLatLng = function (pos) {
2125
+ return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : undefined;
2126
+ };
2127
+
2128
+ KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
2129
+ return latLng ? new Position(latLng.getLat(), latLng.getLng()) : undefined;
2130
+ };
2131
+
2132
+ return KakaoMintMapController;
2133
+ }(MintMapController);
2134
+
1416
2135
  var Position = function () {
1417
2136
  function Position(lat, lng) {
1418
2137
  this.lat = 0;
@@ -1619,6 +2338,10 @@ function MintMap(_a) {
1619
2338
  mapType: mapType
1620
2339
  }, props), {
1621
2340
  base: base
2341
+ })) : mapType === 'kakao' ? new KakaoMintMapController(__assign(__assign({
2342
+ mapType: mapType
2343
+ }, props), {
2344
+ base: base
1622
2345
  })) : null;
1623
2346
 
1624
2347
  if (newController_1) {
@@ -1888,6 +2611,8 @@ function useMarkerMoving(_a) {
1888
2611
  var offsetCalibration = function (mapType, divElement, options) {
1889
2612
  if (mapType === 'google') {
1890
2613
  divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
2614
+ } else if (mapType === 'kakao') {
2615
+ divElement.style.transform = "translate(50%, 50%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
1891
2616
  }
1892
2617
  };
1893
2618
 
@@ -1969,7 +2694,7 @@ function MapMarkerWrapper(_a) {
1969
2694
  divElement.addEventListener('click', onClickHandler);
1970
2695
  divElement.addEventListener('mouseover', onMouseOverHandler);
1971
2696
  return function () {
1972
- if (divCloneRef.current && endAnimationClassName) {
2697
+ if (divCloneRef.current && endAnimationClassName && controller.getMapType() !== 'kakao') {
1973
2698
  divCloneRef.current.classList.add(endAnimationClassName);
1974
2699
 
1975
2700
  var aniListener_1 = function () {