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