@mint-ui/map 0.5.6-beta → 0.5.8-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/core/MintMapController.d.ts +1 -0
- package/dist/components/mint-map/core/MintMapController.js +8 -0
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +2 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +5 -2
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +2 -1
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +5 -2
- package/dist/components/mint-map/core/util/index.d.ts +2 -0
- package/dist/components/mint-map/core/util/log.d.ts +1 -0
- package/dist/components/mint-map/core/util/log.js +18 -0
- package/dist/components/mint-map/core/util/status.d.ts +9 -0
- package/dist/components/mint-map/core/util/status.js +58 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +8 -0
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +7 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +11 -4
- package/dist/components/mint-map/types/MapDrawables.d.ts +8 -0
- package/dist/components/mint-map/types/MintMapProps.d.ts +4 -0
- package/dist/index.es.js +337 -249
- package/dist/index.js +4 -0
- package/dist/index.umd.js +337 -247
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter, __generator, __extends, __assign, __rest
|
|
1
|
+
import { __awaiter, __generator, __spreadArray, __extends, __assign, __rest } from 'tslib';
|
|
2
2
|
import React, { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
3
|
import classNames from 'classnames/bind';
|
|
4
4
|
import styleInject from 'style-inject';
|
|
@@ -732,6 +732,309 @@ function MintMapCore(_a) {
|
|
|
732
732
|
}));
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
+
var AnimationPlayer =
|
|
736
|
+
/** @class */
|
|
737
|
+
function () {
|
|
738
|
+
function AnimationPlayer(drawFunction, fps) {
|
|
739
|
+
this.prevtime = 0;
|
|
740
|
+
this.elapsedTime = 0;
|
|
741
|
+
this.fps = null;
|
|
742
|
+
this.baseDrawGapTime = null;
|
|
743
|
+
this.deltaTime = 0;
|
|
744
|
+
this.playing = false;
|
|
745
|
+
this.draw = drawFunction;
|
|
746
|
+
this.fps = fps || null;
|
|
747
|
+
|
|
748
|
+
if (fps !== undefined) {
|
|
749
|
+
this.baseDrawGapTime = 1000 / fps;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
this.init();
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
AnimationPlayer.prototype.init = function () {
|
|
756
|
+
this.deltaTime = 0;
|
|
757
|
+
this.prevtime = 0;
|
|
758
|
+
this.elapsedTime = 0;
|
|
759
|
+
this.playing = false;
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
AnimationPlayer.prototype.start = function () {
|
|
763
|
+
this.init();
|
|
764
|
+
this.resume();
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
AnimationPlayer.prototype.stop = function () {
|
|
768
|
+
this.playing = false;
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
AnimationPlayer.prototype.resume = function () {
|
|
772
|
+
this.playing = true; //@ts-ignore
|
|
773
|
+
|
|
774
|
+
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
778
|
+
//frame 간 시간 변화
|
|
779
|
+
if (this.prevtime === 0) {
|
|
780
|
+
this.prevtime = timestamp;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
784
|
+
|
|
785
|
+
this.prevtime = timestamp;
|
|
786
|
+
|
|
787
|
+
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
788
|
+
//다음 루프 준비
|
|
789
|
+
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
790
|
+
|
|
791
|
+
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
792
|
+
|
|
793
|
+
this.deltaTime = 0;
|
|
794
|
+
|
|
795
|
+
if (stopFlag) {
|
|
796
|
+
this.stop();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (this.playing) {
|
|
801
|
+
//@ts-ignore
|
|
802
|
+
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
return AnimationPlayer;
|
|
807
|
+
}();
|
|
808
|
+
|
|
809
|
+
function waiting(evaluation, timeoutSeconds) {
|
|
810
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
811
|
+
var max;
|
|
812
|
+
return __generator(this, function (_a) {
|
|
813
|
+
max = (timeoutSeconds || 5) * 1000;
|
|
814
|
+
return [2
|
|
815
|
+
/*return*/
|
|
816
|
+
, new Promise(function (resolve) {
|
|
817
|
+
var start = new Date().getTime();
|
|
818
|
+
var inter = setInterval(function () {
|
|
819
|
+
//타임아웃 체크
|
|
820
|
+
var time = new Date().getTime();
|
|
821
|
+
|
|
822
|
+
if (time - start > max) {
|
|
823
|
+
clearInterval(inter);
|
|
824
|
+
resolve(false);
|
|
825
|
+
return;
|
|
826
|
+
} //평가식 체크
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
if (evaluation()) {
|
|
830
|
+
clearInterval(inter);
|
|
831
|
+
resolve(true);
|
|
832
|
+
}
|
|
833
|
+
}, 100);
|
|
834
|
+
})];
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
840
|
+
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
844
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
845
|
+
|
|
846
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
847
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
848
|
+
var boundsPos = [];
|
|
849
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
850
|
+
|
|
851
|
+
for (var i = 0; i < rowCount; i++) {
|
|
852
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
853
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
854
|
+
var rows = [];
|
|
855
|
+
boundsPos.push(rows);
|
|
856
|
+
|
|
857
|
+
for (var k = 0; k < colCount; k++) {
|
|
858
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
859
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
860
|
+
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
861
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
862
|
+
rows.push({
|
|
863
|
+
bounds: thisBounds,
|
|
864
|
+
checked: false,
|
|
865
|
+
center: false,
|
|
866
|
+
centerPosition: thisBounds.getCenter(),
|
|
867
|
+
incList: [],
|
|
868
|
+
itemList: includedList,
|
|
869
|
+
size: basePixelSize
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
} //좌표마다 검사해서 인접셀 병합 처리
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
var centerList = [];
|
|
876
|
+
var totalItemCount = 0;
|
|
877
|
+
var min;
|
|
878
|
+
var max;
|
|
879
|
+
|
|
880
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
881
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
882
|
+
var curr = boundsPos[i][k];
|
|
883
|
+
if (curr.checked) continue;
|
|
884
|
+
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
885
|
+
|
|
886
|
+
var incList = [];
|
|
887
|
+
|
|
888
|
+
if (boundsPos[i]) {
|
|
889
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
890
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
if (boundsPos[i - 1]) {
|
|
894
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
895
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
896
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
if (boundsPos[i + 1]) {
|
|
900
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
901
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
902
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
906
|
+
var inc = incList_1[_i];
|
|
907
|
+
if (inc.checked) continue;
|
|
908
|
+
inc.checked = true;
|
|
909
|
+
|
|
910
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
911
|
+
curr.incList.push(inc);
|
|
912
|
+
|
|
913
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
914
|
+
|
|
915
|
+
curr.center = true;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (curr.center) {
|
|
920
|
+
centerList.push(curr);
|
|
921
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
922
|
+
return item.lat;
|
|
923
|
+
}));
|
|
924
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
925
|
+
return item.lng;
|
|
926
|
+
}));
|
|
927
|
+
curr.centerPosition = new Position(avrLat, avrLng);
|
|
928
|
+
totalItemCount += curr.itemList.length;
|
|
929
|
+
|
|
930
|
+
if (!min || curr.itemList.length < min) {
|
|
931
|
+
min = curr.itemList.length;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
if (!max || curr.itemList.length > max) {
|
|
935
|
+
max = curr.itemList.length;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
var status = {
|
|
942
|
+
total: totalItemCount,
|
|
943
|
+
average: totalItemCount / centerList.length,
|
|
944
|
+
min: min,
|
|
945
|
+
max: max
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
949
|
+
var minSize = basePixelSize / 4;
|
|
950
|
+
var maxSize = basePixelSize;
|
|
951
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
955
|
+
var center = centerList_1[_b];
|
|
956
|
+
center.size = sizeFunction(center, status);
|
|
957
|
+
} // console.log('centerList', centerList, status);
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
return centerList;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
var calculateAverage = function (nums) {
|
|
964
|
+
var sum = 0;
|
|
965
|
+
|
|
966
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
967
|
+
var num = nums_1[_i];
|
|
968
|
+
sum += num;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
return Number((sum / nums.length).toFixed(7));
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
function log(debug, label) {
|
|
975
|
+
var args = [];
|
|
976
|
+
|
|
977
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
978
|
+
args[_i - 2] = arguments[_i];
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
if (!debug) return;
|
|
982
|
+
args && console.log.apply(console, __spreadArray(['[mint-map debug]', label || ''], args, false));
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
var MintMapStatus =
|
|
986
|
+
/** @class */
|
|
987
|
+
function () {
|
|
988
|
+
function MintMapStatus() {
|
|
989
|
+
this.marker = 0;
|
|
990
|
+
this.byLabel = new Map();
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
MintMapStatus.prototype.init = function () {
|
|
994
|
+
this.marker = 0;
|
|
995
|
+
this.byLabel.clear();
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
MintMapStatus.prototype.print = function () {
|
|
999
|
+
var str = "[mint-map status]\n\nmarker : ".concat(this.marker, "\n ");
|
|
1000
|
+
|
|
1001
|
+
if (this.byLabel.size > 0) {
|
|
1002
|
+
str += '\n-------- status detail (by label) ----------';
|
|
1003
|
+
this.byLabel.forEach(function (val, key) {
|
|
1004
|
+
str += "\n(".concat(key, ") : ").concat(val);
|
|
1005
|
+
});
|
|
1006
|
+
str += '\n\n';
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
console.log(str);
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
MintMapStatus.prototype.setMarker = function (inc, label) {
|
|
1013
|
+
this.marker += inc;
|
|
1014
|
+
|
|
1015
|
+
if (label) {
|
|
1016
|
+
var curr = this.byLabel.get(label);
|
|
1017
|
+
var calc = 0;
|
|
1018
|
+
|
|
1019
|
+
if (curr === undefined) {
|
|
1020
|
+
calc = inc;
|
|
1021
|
+
} else {
|
|
1022
|
+
calc = curr + inc;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
if (calc === 0) {
|
|
1026
|
+
this.byLabel.delete(label);
|
|
1027
|
+
} else {
|
|
1028
|
+
this.byLabel.set(label, calc);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
|
|
1033
|
+
return MintMapStatus;
|
|
1034
|
+
}();
|
|
1035
|
+
|
|
1036
|
+
var Status = new MintMapStatus();
|
|
1037
|
+
|
|
735
1038
|
var MintMapController =
|
|
736
1039
|
/** @class */
|
|
737
1040
|
function () {
|
|
@@ -894,6 +1197,10 @@ function () {
|
|
|
894
1197
|
throw new Error("[getMapToBaseZoom][".concat(mapZoom, "] is not valid zoom level"));
|
|
895
1198
|
};
|
|
896
1199
|
|
|
1200
|
+
MintMapController.prototype.printStatus = function () {
|
|
1201
|
+
Status.print();
|
|
1202
|
+
};
|
|
1203
|
+
|
|
897
1204
|
return MintMapController;
|
|
898
1205
|
}();
|
|
899
1206
|
|
|
@@ -1091,36 +1398,6 @@ function () {
|
|
|
1091
1398
|
return MapZoomInfo;
|
|
1092
1399
|
}();
|
|
1093
1400
|
|
|
1094
|
-
function waiting(evaluation, timeoutSeconds) {
|
|
1095
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1096
|
-
var max;
|
|
1097
|
-
return __generator(this, function (_a) {
|
|
1098
|
-
max = (timeoutSeconds || 5) * 1000;
|
|
1099
|
-
return [2
|
|
1100
|
-
/*return*/
|
|
1101
|
-
, new Promise(function (resolve) {
|
|
1102
|
-
var start = new Date().getTime();
|
|
1103
|
-
var inter = setInterval(function () {
|
|
1104
|
-
//타임아웃 체크
|
|
1105
|
-
var time = new Date().getTime();
|
|
1106
|
-
|
|
1107
|
-
if (time - start > max) {
|
|
1108
|
-
clearInterval(inter);
|
|
1109
|
-
resolve(false);
|
|
1110
|
-
return;
|
|
1111
|
-
} //평가식 체크
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
if (evaluation()) {
|
|
1115
|
-
clearInterval(inter);
|
|
1116
|
-
resolve(true);
|
|
1117
|
-
}
|
|
1118
|
-
}, 100);
|
|
1119
|
-
})];
|
|
1120
|
-
});
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
1401
|
// export type MapEvent = 'bounds_changed'|'center_changed'|'idle'|'zoom_changed'|'zoomstart'
|
|
1125
1402
|
// export type MapUIEvent = 'click'|'dblclick'|''
|
|
1126
1403
|
var MapEvent =
|
|
@@ -1381,8 +1658,7 @@ function (_super) {
|
|
|
1381
1658
|
map: this.map,
|
|
1382
1659
|
position: marker.options.position,
|
|
1383
1660
|
visible: marker.options.visible === undefined || marker.options.visible
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1661
|
+
};
|
|
1386
1662
|
marker.element && (options.icon = {
|
|
1387
1663
|
content: marker.element,
|
|
1388
1664
|
anchor: marker.options.anchor
|
|
@@ -1400,6 +1676,8 @@ function (_super) {
|
|
|
1400
1676
|
marker.native = naverMarker_1;
|
|
1401
1677
|
}
|
|
1402
1678
|
|
|
1679
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
1680
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
1403
1681
|
((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
|
|
1404
1682
|
if (_this.markerEvents.includes(key)) {
|
|
1405
1683
|
naver.maps.Event.addListener(naverMarker_1, key, handler);
|
|
@@ -1433,7 +1711,9 @@ function (_super) {
|
|
|
1433
1711
|
marker.native.setIcon(__assign(__assign({}, marker.native.getIcon()), {
|
|
1434
1712
|
anchor: options.anchor
|
|
1435
1713
|
}));
|
|
1436
|
-
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated'); // const newOption = {
|
|
1437
1717
|
// map:map,
|
|
1438
1718
|
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1439
1719
|
// visible:options.visible === undefined || options.visible,
|
|
@@ -1447,7 +1727,6 @@ function (_super) {
|
|
|
1447
1727
|
// visible:options.visible === undefined || options.visible,
|
|
1448
1728
|
// icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
1449
1729
|
// })
|
|
1450
|
-
|
|
1451
1730
|
}
|
|
1452
1731
|
}
|
|
1453
1732
|
};
|
|
@@ -1505,6 +1784,9 @@ function (_super) {
|
|
|
1505
1784
|
} else {
|
|
1506
1785
|
drawable.native.setMap(null);
|
|
1507
1786
|
}
|
|
1787
|
+
|
|
1788
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
1789
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
1508
1790
|
} else {
|
|
1509
1791
|
drawable.native.setMap(null);
|
|
1510
1792
|
}
|
|
@@ -2110,6 +2392,8 @@ function (_super) {
|
|
|
2110
2392
|
googleMarker_1 = new google.maps.Marker(options);
|
|
2111
2393
|
}
|
|
2112
2394
|
|
|
2395
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
2396
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
2113
2397
|
marker.native = googleMarker_1;
|
|
2114
2398
|
((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
|
|
2115
2399
|
if (_this.markerEvents.includes(key)) {
|
|
@@ -2148,6 +2432,8 @@ function (_super) {
|
|
|
2148
2432
|
marker.native.position = options.position;
|
|
2149
2433
|
}
|
|
2150
2434
|
}
|
|
2435
|
+
|
|
2436
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
|
|
2151
2437
|
}
|
|
2152
2438
|
};
|
|
2153
2439
|
|
|
@@ -2214,6 +2500,8 @@ function (_super) {
|
|
|
2214
2500
|
} else if (drawable.native instanceof google.maps.marker.AdvancedMarkerView) {
|
|
2215
2501
|
google.maps.event.clearInstanceListeners(drawable.native);
|
|
2216
2502
|
drawable.native.map = null;
|
|
2503
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
2504
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
2217
2505
|
return true;
|
|
2218
2506
|
}
|
|
2219
2507
|
}
|
|
@@ -2796,6 +3084,8 @@ function (_super) {
|
|
|
2796
3084
|
this.updateMarker(marker, marker.options);
|
|
2797
3085
|
} else {
|
|
2798
3086
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
3087
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
3088
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
2799
3089
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
2800
3090
|
this.removeParentElementsMargin(marker);
|
|
2801
3091
|
marker.native = kakaoMarker_1;
|
|
@@ -2824,6 +3114,7 @@ function (_super) {
|
|
|
2824
3114
|
marker.native.setVisible(options.visible);
|
|
2825
3115
|
}
|
|
2826
3116
|
|
|
3117
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
|
|
2827
3118
|
this.removeParentElementsMargin(marker);
|
|
2828
3119
|
}
|
|
2829
3120
|
}
|
|
@@ -2896,6 +3187,8 @@ function (_super) {
|
|
|
2896
3187
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.releasePoolItem(drawable.native);
|
|
2897
3188
|
} else {
|
|
2898
3189
|
drawable.native.setMap(null);
|
|
3190
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
3191
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
2899
3192
|
}
|
|
2900
3193
|
} else {
|
|
2901
3194
|
drawable.native.setMap(null);
|
|
@@ -3633,80 +3926,6 @@ function SVGRect(_a) {
|
|
|
3633
3926
|
}, children));
|
|
3634
3927
|
}
|
|
3635
3928
|
|
|
3636
|
-
var AnimationPlayer =
|
|
3637
|
-
/** @class */
|
|
3638
|
-
function () {
|
|
3639
|
-
function AnimationPlayer(drawFunction, fps) {
|
|
3640
|
-
this.prevtime = 0;
|
|
3641
|
-
this.elapsedTime = 0;
|
|
3642
|
-
this.fps = null;
|
|
3643
|
-
this.baseDrawGapTime = null;
|
|
3644
|
-
this.deltaTime = 0;
|
|
3645
|
-
this.playing = false;
|
|
3646
|
-
this.draw = drawFunction;
|
|
3647
|
-
this.fps = fps || null;
|
|
3648
|
-
|
|
3649
|
-
if (fps !== undefined) {
|
|
3650
|
-
this.baseDrawGapTime = 1000 / fps;
|
|
3651
|
-
}
|
|
3652
|
-
|
|
3653
|
-
this.init();
|
|
3654
|
-
}
|
|
3655
|
-
|
|
3656
|
-
AnimationPlayer.prototype.init = function () {
|
|
3657
|
-
this.deltaTime = 0;
|
|
3658
|
-
this.prevtime = 0;
|
|
3659
|
-
this.elapsedTime = 0;
|
|
3660
|
-
this.playing = false;
|
|
3661
|
-
};
|
|
3662
|
-
|
|
3663
|
-
AnimationPlayer.prototype.start = function () {
|
|
3664
|
-
this.init();
|
|
3665
|
-
this.resume();
|
|
3666
|
-
};
|
|
3667
|
-
|
|
3668
|
-
AnimationPlayer.prototype.stop = function () {
|
|
3669
|
-
this.playing = false;
|
|
3670
|
-
};
|
|
3671
|
-
|
|
3672
|
-
AnimationPlayer.prototype.resume = function () {
|
|
3673
|
-
this.playing = true; //@ts-ignore
|
|
3674
|
-
|
|
3675
|
-
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
3676
|
-
};
|
|
3677
|
-
|
|
3678
|
-
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
3679
|
-
//frame 간 시간 변화
|
|
3680
|
-
if (this.prevtime === 0) {
|
|
3681
|
-
this.prevtime = timestamp;
|
|
3682
|
-
}
|
|
3683
|
-
|
|
3684
|
-
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
3685
|
-
|
|
3686
|
-
this.prevtime = timestamp;
|
|
3687
|
-
|
|
3688
|
-
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
3689
|
-
//다음 루프 준비
|
|
3690
|
-
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
3691
|
-
|
|
3692
|
-
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
3693
|
-
|
|
3694
|
-
this.deltaTime = 0;
|
|
3695
|
-
|
|
3696
|
-
if (stopFlag) {
|
|
3697
|
-
this.stop();
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
|
-
|
|
3701
|
-
if (this.playing) {
|
|
3702
|
-
//@ts-ignore
|
|
3703
|
-
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
3704
|
-
}
|
|
3705
|
-
};
|
|
3706
|
-
|
|
3707
|
-
return AnimationPlayer;
|
|
3708
|
-
}();
|
|
3709
|
-
|
|
3710
3929
|
var Drawable =
|
|
3711
3930
|
/** @class */
|
|
3712
3931
|
function () {
|
|
@@ -4097,141 +4316,6 @@ function MapMarkerWrapper(_a) {
|
|
|
4097
4316
|
return createPortal(children, divElement);
|
|
4098
4317
|
}
|
|
4099
4318
|
|
|
4100
|
-
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
4101
|
-
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
4105
|
-
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
4106
|
-
|
|
4107
|
-
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
4108
|
-
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
4109
|
-
var boundsPos = [];
|
|
4110
|
-
var tempX1, tempY1, tempX2, tempY2;
|
|
4111
|
-
|
|
4112
|
-
for (var i = 0; i < rowCount; i++) {
|
|
4113
|
-
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
4114
|
-
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
4115
|
-
var rows = [];
|
|
4116
|
-
boundsPos.push(rows);
|
|
4117
|
-
|
|
4118
|
-
for (var k = 0; k < colCount; k++) {
|
|
4119
|
-
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
4120
|
-
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
4121
|
-
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
4122
|
-
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
4123
|
-
rows.push({
|
|
4124
|
-
bounds: thisBounds,
|
|
4125
|
-
checked: false,
|
|
4126
|
-
center: false,
|
|
4127
|
-
centerPosition: thisBounds.getCenter(),
|
|
4128
|
-
incList: [],
|
|
4129
|
-
itemList: includedList,
|
|
4130
|
-
size: basePixelSize
|
|
4131
|
-
});
|
|
4132
|
-
}
|
|
4133
|
-
} //좌표마다 검사해서 인접셀 병합 처리
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
var centerList = [];
|
|
4137
|
-
var totalItemCount = 0;
|
|
4138
|
-
var min;
|
|
4139
|
-
var max;
|
|
4140
|
-
|
|
4141
|
-
for (var i = 0; i < boundsPos.length; i++) {
|
|
4142
|
-
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
4143
|
-
var curr = boundsPos[i][k];
|
|
4144
|
-
if (curr.checked) continue;
|
|
4145
|
-
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
4146
|
-
|
|
4147
|
-
var incList = [];
|
|
4148
|
-
|
|
4149
|
-
if (boundsPos[i]) {
|
|
4150
|
-
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
4151
|
-
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
4152
|
-
}
|
|
4153
|
-
|
|
4154
|
-
if (boundsPos[i - 1]) {
|
|
4155
|
-
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
4156
|
-
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
4157
|
-
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
4158
|
-
}
|
|
4159
|
-
|
|
4160
|
-
if (boundsPos[i + 1]) {
|
|
4161
|
-
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
4162
|
-
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
4163
|
-
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
4164
|
-
}
|
|
4165
|
-
|
|
4166
|
-
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
4167
|
-
var inc = incList_1[_i];
|
|
4168
|
-
if (inc.checked) continue;
|
|
4169
|
-
inc.checked = true;
|
|
4170
|
-
|
|
4171
|
-
if (inc.itemList && inc.itemList.length > 0) {
|
|
4172
|
-
curr.incList.push(inc);
|
|
4173
|
-
|
|
4174
|
-
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
4175
|
-
|
|
4176
|
-
curr.center = true;
|
|
4177
|
-
}
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
if (curr.center) {
|
|
4181
|
-
centerList.push(curr);
|
|
4182
|
-
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
4183
|
-
return item.lat;
|
|
4184
|
-
}));
|
|
4185
|
-
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
4186
|
-
return item.lng;
|
|
4187
|
-
}));
|
|
4188
|
-
curr.centerPosition = new Position(avrLat, avrLng);
|
|
4189
|
-
totalItemCount += curr.itemList.length;
|
|
4190
|
-
|
|
4191
|
-
if (!min || curr.itemList.length < min) {
|
|
4192
|
-
min = curr.itemList.length;
|
|
4193
|
-
}
|
|
4194
|
-
|
|
4195
|
-
if (!max || curr.itemList.length > max) {
|
|
4196
|
-
max = curr.itemList.length;
|
|
4197
|
-
}
|
|
4198
|
-
}
|
|
4199
|
-
}
|
|
4200
|
-
}
|
|
4201
|
-
|
|
4202
|
-
var status = {
|
|
4203
|
-
total: totalItemCount,
|
|
4204
|
-
average: totalItemCount / centerList.length,
|
|
4205
|
-
min: min,
|
|
4206
|
-
max: max
|
|
4207
|
-
};
|
|
4208
|
-
|
|
4209
|
-
sizeFunction = sizeFunction || function (info, status) {
|
|
4210
|
-
var minSize = basePixelSize / 4;
|
|
4211
|
-
var maxSize = basePixelSize;
|
|
4212
|
-
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
4213
|
-
};
|
|
4214
|
-
|
|
4215
|
-
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
4216
|
-
var center = centerList_1[_b];
|
|
4217
|
-
center.size = sizeFunction(center, status);
|
|
4218
|
-
} // console.log('centerList', centerList, status);
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
return centerList;
|
|
4222
|
-
};
|
|
4223
|
-
|
|
4224
|
-
var calculateAverage = function (nums) {
|
|
4225
|
-
var sum = 0;
|
|
4226
|
-
|
|
4227
|
-
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
4228
|
-
var num = nums_1[_i];
|
|
4229
|
-
sum += num;
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
return Number((sum / nums.length).toFixed(7));
|
|
4233
|
-
};
|
|
4234
|
-
|
|
4235
4319
|
/**
|
|
4236
4320
|
* CircleMarker
|
|
4237
4321
|
*
|
|
@@ -4254,7 +4338,8 @@ function CircleMarker(_a) {
|
|
|
4254
4338
|
shapeProperties = _e === void 0 ? {} : _e,
|
|
4255
4339
|
_f = _a.visible,
|
|
4256
4340
|
visible = _f === void 0 ? true : _f,
|
|
4257
|
-
zIndex = _a.zIndex
|
|
4341
|
+
zIndex = _a.zIndex,
|
|
4342
|
+
debugLabel = _a.debugLabel; //controller
|
|
4258
4343
|
|
|
4259
4344
|
var controller = useMintMapController(); //zoom start event
|
|
4260
4345
|
|
|
@@ -4338,7 +4423,8 @@ function CircleMarker(_a) {
|
|
|
4338
4423
|
anchor: anchor,
|
|
4339
4424
|
visible: visible,
|
|
4340
4425
|
disablePointerEvent: true,
|
|
4341
|
-
zIndex: zIndex
|
|
4426
|
+
zIndex: zIndex,
|
|
4427
|
+
debugLabel: debugLabel
|
|
4342
4428
|
}, mapVisible && React.createElement(SVGCircle, {
|
|
4343
4429
|
radius: computedRadius,
|
|
4344
4430
|
background: background,
|
|
@@ -4376,7 +4462,8 @@ function PolygonMarker(_a) {
|
|
|
4376
4462
|
visible = _g === void 0 ? true : _g,
|
|
4377
4463
|
zIndex = _a.zIndex,
|
|
4378
4464
|
_h = _a.mode,
|
|
4379
|
-
mode = _h === void 0 ? 'POLYGON' : _h
|
|
4465
|
+
mode = _h === void 0 ? 'POLYGON' : _h,
|
|
4466
|
+
debugLabel = _a.debugLabel; //controller
|
|
4380
4467
|
|
|
4381
4468
|
var controller = useMintMapController(); //zoom start event
|
|
4382
4469
|
|
|
@@ -4494,7 +4581,8 @@ function PolygonMarker(_a) {
|
|
|
4494
4581
|
position: polygonStart,
|
|
4495
4582
|
visible: visible,
|
|
4496
4583
|
disablePointerEvent: true,
|
|
4497
|
-
zIndex: zIndex
|
|
4584
|
+
zIndex: zIndex,
|
|
4585
|
+
debugLabel: debugLabel
|
|
4498
4586
|
}, mapVisible && React.createElement(SVGPolygon, {
|
|
4499
4587
|
path: offsets,
|
|
4500
4588
|
innerPath: innerOffsets,
|
|
@@ -5411,4 +5499,4 @@ function MapCanvasMarkerWrapper(_props) {
|
|
|
5411
5499
|
return React.createElement(React.Fragment, null);
|
|
5412
5500
|
}
|
|
5413
5501
|
|
|
5414
|
-
export { AnimationPlayer, Bounds, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, getClusterInfo, useMarkerMoving, useMintMapController, waiting };
|
|
5502
|
+
export { AnimationPlayer, Bounds, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, Status, getClusterInfo, log, useMarkerMoving, useMintMapController, waiting };
|