@mint-ui/map 0.5.6-beta → 0.5.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/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.js +1 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +1 -0
- 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 +329 -245
- package/dist/index.js +4 -0
- package/dist/index.umd.js +329 -243
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -736,6 +736,309 @@
|
|
|
736
736
|
}));
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
+
var AnimationPlayer =
|
|
740
|
+
/** @class */
|
|
741
|
+
function () {
|
|
742
|
+
function AnimationPlayer(drawFunction, fps) {
|
|
743
|
+
this.prevtime = 0;
|
|
744
|
+
this.elapsedTime = 0;
|
|
745
|
+
this.fps = null;
|
|
746
|
+
this.baseDrawGapTime = null;
|
|
747
|
+
this.deltaTime = 0;
|
|
748
|
+
this.playing = false;
|
|
749
|
+
this.draw = drawFunction;
|
|
750
|
+
this.fps = fps || null;
|
|
751
|
+
|
|
752
|
+
if (fps !== undefined) {
|
|
753
|
+
this.baseDrawGapTime = 1000 / fps;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
this.init();
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
AnimationPlayer.prototype.init = function () {
|
|
760
|
+
this.deltaTime = 0;
|
|
761
|
+
this.prevtime = 0;
|
|
762
|
+
this.elapsedTime = 0;
|
|
763
|
+
this.playing = false;
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
AnimationPlayer.prototype.start = function () {
|
|
767
|
+
this.init();
|
|
768
|
+
this.resume();
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
AnimationPlayer.prototype.stop = function () {
|
|
772
|
+
this.playing = false;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
AnimationPlayer.prototype.resume = function () {
|
|
776
|
+
this.playing = true; //@ts-ignore
|
|
777
|
+
|
|
778
|
+
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
782
|
+
//frame 간 시간 변화
|
|
783
|
+
if (this.prevtime === 0) {
|
|
784
|
+
this.prevtime = timestamp;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
788
|
+
|
|
789
|
+
this.prevtime = timestamp;
|
|
790
|
+
|
|
791
|
+
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
792
|
+
//다음 루프 준비
|
|
793
|
+
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
794
|
+
|
|
795
|
+
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
796
|
+
|
|
797
|
+
this.deltaTime = 0;
|
|
798
|
+
|
|
799
|
+
if (stopFlag) {
|
|
800
|
+
this.stop();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
if (this.playing) {
|
|
805
|
+
//@ts-ignore
|
|
806
|
+
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
return AnimationPlayer;
|
|
811
|
+
}();
|
|
812
|
+
|
|
813
|
+
function waiting(evaluation, timeoutSeconds) {
|
|
814
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
815
|
+
var max;
|
|
816
|
+
return tslib.__generator(this, function (_a) {
|
|
817
|
+
max = (timeoutSeconds || 5) * 1000;
|
|
818
|
+
return [2
|
|
819
|
+
/*return*/
|
|
820
|
+
, new Promise(function (resolve) {
|
|
821
|
+
var start = new Date().getTime();
|
|
822
|
+
var inter = setInterval(function () {
|
|
823
|
+
//타임아웃 체크
|
|
824
|
+
var time = new Date().getTime();
|
|
825
|
+
|
|
826
|
+
if (time - start > max) {
|
|
827
|
+
clearInterval(inter);
|
|
828
|
+
resolve(false);
|
|
829
|
+
return;
|
|
830
|
+
} //평가식 체크
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
if (evaluation()) {
|
|
834
|
+
clearInterval(inter);
|
|
835
|
+
resolve(true);
|
|
836
|
+
}
|
|
837
|
+
}, 100);
|
|
838
|
+
})];
|
|
839
|
+
});
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
844
|
+
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
848
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
849
|
+
|
|
850
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
851
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
852
|
+
var boundsPos = [];
|
|
853
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
854
|
+
|
|
855
|
+
for (var i = 0; i < rowCount; i++) {
|
|
856
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
857
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
858
|
+
var rows = [];
|
|
859
|
+
boundsPos.push(rows);
|
|
860
|
+
|
|
861
|
+
for (var k = 0; k < colCount; k++) {
|
|
862
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
863
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
864
|
+
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
865
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
866
|
+
rows.push({
|
|
867
|
+
bounds: thisBounds,
|
|
868
|
+
checked: false,
|
|
869
|
+
center: false,
|
|
870
|
+
centerPosition: thisBounds.getCenter(),
|
|
871
|
+
incList: [],
|
|
872
|
+
itemList: includedList,
|
|
873
|
+
size: basePixelSize
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
} //좌표마다 검사해서 인접셀 병합 처리
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
var centerList = [];
|
|
880
|
+
var totalItemCount = 0;
|
|
881
|
+
var min;
|
|
882
|
+
var max;
|
|
883
|
+
|
|
884
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
885
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
886
|
+
var curr = boundsPos[i][k];
|
|
887
|
+
if (curr.checked) continue;
|
|
888
|
+
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
889
|
+
|
|
890
|
+
var incList = [];
|
|
891
|
+
|
|
892
|
+
if (boundsPos[i]) {
|
|
893
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
894
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (boundsPos[i - 1]) {
|
|
898
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
899
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
900
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
if (boundsPos[i + 1]) {
|
|
904
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
905
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
906
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
910
|
+
var inc = incList_1[_i];
|
|
911
|
+
if (inc.checked) continue;
|
|
912
|
+
inc.checked = true;
|
|
913
|
+
|
|
914
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
915
|
+
curr.incList.push(inc);
|
|
916
|
+
|
|
917
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
918
|
+
|
|
919
|
+
curr.center = true;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if (curr.center) {
|
|
924
|
+
centerList.push(curr);
|
|
925
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
926
|
+
return item.lat;
|
|
927
|
+
}));
|
|
928
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
929
|
+
return item.lng;
|
|
930
|
+
}));
|
|
931
|
+
curr.centerPosition = new Position(avrLat, avrLng);
|
|
932
|
+
totalItemCount += curr.itemList.length;
|
|
933
|
+
|
|
934
|
+
if (!min || curr.itemList.length < min) {
|
|
935
|
+
min = curr.itemList.length;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
if (!max || curr.itemList.length > max) {
|
|
939
|
+
max = curr.itemList.length;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
var status = {
|
|
946
|
+
total: totalItemCount,
|
|
947
|
+
average: totalItemCount / centerList.length,
|
|
948
|
+
min: min,
|
|
949
|
+
max: max
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
953
|
+
var minSize = basePixelSize / 4;
|
|
954
|
+
var maxSize = basePixelSize;
|
|
955
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
959
|
+
var center = centerList_1[_b];
|
|
960
|
+
center.size = sizeFunction(center, status);
|
|
961
|
+
} // console.log('centerList', centerList, status);
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
return centerList;
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
var calculateAverage = function (nums) {
|
|
968
|
+
var sum = 0;
|
|
969
|
+
|
|
970
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
971
|
+
var num = nums_1[_i];
|
|
972
|
+
sum += num;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
return Number((sum / nums.length).toFixed(7));
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
function log(debug, label) {
|
|
979
|
+
var args = [];
|
|
980
|
+
|
|
981
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
982
|
+
args[_i - 2] = arguments[_i];
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (!debug) return;
|
|
986
|
+
args && console.log.apply(console, tslib.__spreadArray(['[mint-map debug]', label || ''], args, false));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
var MintMapStatus =
|
|
990
|
+
/** @class */
|
|
991
|
+
function () {
|
|
992
|
+
function MintMapStatus() {
|
|
993
|
+
this.marker = 0;
|
|
994
|
+
this.byLabel = new Map();
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
MintMapStatus.prototype.init = function () {
|
|
998
|
+
this.marker = 0;
|
|
999
|
+
this.byLabel.clear();
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
MintMapStatus.prototype.print = function () {
|
|
1003
|
+
var str = "[mint-map status]\n\nmarker : ".concat(this.marker, "\n ");
|
|
1004
|
+
|
|
1005
|
+
if (this.byLabel.size > 0) {
|
|
1006
|
+
str += '\n-------- status detail (by label) ----------';
|
|
1007
|
+
this.byLabel.forEach(function (val, key) {
|
|
1008
|
+
str += "\n(".concat(key, ") : ").concat(val);
|
|
1009
|
+
});
|
|
1010
|
+
str += '\n\n';
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
console.log(str);
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
MintMapStatus.prototype.setMarker = function (inc, label) {
|
|
1017
|
+
this.marker += inc;
|
|
1018
|
+
|
|
1019
|
+
if (label) {
|
|
1020
|
+
var curr = this.byLabel.get(label);
|
|
1021
|
+
var calc = 0;
|
|
1022
|
+
|
|
1023
|
+
if (curr === undefined) {
|
|
1024
|
+
calc = inc;
|
|
1025
|
+
} else {
|
|
1026
|
+
calc = curr + inc;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (calc === 0) {
|
|
1030
|
+
this.byLabel.delete(label);
|
|
1031
|
+
} else {
|
|
1032
|
+
this.byLabel.set(label, calc);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
return MintMapStatus;
|
|
1038
|
+
}();
|
|
1039
|
+
|
|
1040
|
+
var Status = new MintMapStatus();
|
|
1041
|
+
|
|
739
1042
|
var MintMapController =
|
|
740
1043
|
/** @class */
|
|
741
1044
|
function () {
|
|
@@ -898,6 +1201,10 @@
|
|
|
898
1201
|
throw new Error("[getMapToBaseZoom][".concat(mapZoom, "] is not valid zoom level"));
|
|
899
1202
|
};
|
|
900
1203
|
|
|
1204
|
+
MintMapController.prototype.printStatus = function () {
|
|
1205
|
+
Status.print();
|
|
1206
|
+
};
|
|
1207
|
+
|
|
901
1208
|
return MintMapController;
|
|
902
1209
|
}();
|
|
903
1210
|
|
|
@@ -1095,36 +1402,6 @@
|
|
|
1095
1402
|
return MapZoomInfo;
|
|
1096
1403
|
}();
|
|
1097
1404
|
|
|
1098
|
-
function waiting(evaluation, timeoutSeconds) {
|
|
1099
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1100
|
-
var max;
|
|
1101
|
-
return tslib.__generator(this, function (_a) {
|
|
1102
|
-
max = (timeoutSeconds || 5) * 1000;
|
|
1103
|
-
return [2
|
|
1104
|
-
/*return*/
|
|
1105
|
-
, new Promise(function (resolve) {
|
|
1106
|
-
var start = new Date().getTime();
|
|
1107
|
-
var inter = setInterval(function () {
|
|
1108
|
-
//타임아웃 체크
|
|
1109
|
-
var time = new Date().getTime();
|
|
1110
|
-
|
|
1111
|
-
if (time - start > max) {
|
|
1112
|
-
clearInterval(inter);
|
|
1113
|
-
resolve(false);
|
|
1114
|
-
return;
|
|
1115
|
-
} //평가식 체크
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
if (evaluation()) {
|
|
1119
|
-
clearInterval(inter);
|
|
1120
|
-
resolve(true);
|
|
1121
|
-
}
|
|
1122
|
-
}, 100);
|
|
1123
|
-
})];
|
|
1124
|
-
});
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
1405
|
// export type MapEvent = 'bounds_changed'|'center_changed'|'idle'|'zoom_changed'|'zoomstart'
|
|
1129
1406
|
// export type MapUIEvent = 'click'|'dblclick'|''
|
|
1130
1407
|
var MapEvent =
|
|
@@ -1385,8 +1662,7 @@
|
|
|
1385
1662
|
map: this.map,
|
|
1386
1663
|
position: marker.options.position,
|
|
1387
1664
|
visible: marker.options.visible === undefined || marker.options.visible
|
|
1388
|
-
};
|
|
1389
|
-
|
|
1665
|
+
};
|
|
1390
1666
|
marker.element && (options.icon = {
|
|
1391
1667
|
content: marker.element,
|
|
1392
1668
|
anchor: marker.options.anchor
|
|
@@ -1404,6 +1680,8 @@
|
|
|
1404
1680
|
marker.native = naverMarker_1;
|
|
1405
1681
|
}
|
|
1406
1682
|
|
|
1683
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
1684
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
1407
1685
|
((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
|
|
1408
1686
|
if (_this.markerEvents.includes(key)) {
|
|
1409
1687
|
naver.maps.Event.addListener(naverMarker_1, key, handler);
|
|
@@ -1437,7 +1715,9 @@
|
|
|
1437
1715
|
marker.native.setIcon(tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
|
|
1438
1716
|
anchor: options.anchor
|
|
1439
1717
|
}));
|
|
1440
|
-
}
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated'); // const newOption = {
|
|
1441
1721
|
// map:map,
|
|
1442
1722
|
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
1443
1723
|
// visible:options.visible === undefined || options.visible,
|
|
@@ -1451,7 +1731,6 @@
|
|
|
1451
1731
|
// visible:options.visible === undefined || options.visible,
|
|
1452
1732
|
// icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
1453
1733
|
// })
|
|
1454
|
-
|
|
1455
1734
|
}
|
|
1456
1735
|
}
|
|
1457
1736
|
};
|
|
@@ -1509,6 +1788,9 @@
|
|
|
1509
1788
|
} else {
|
|
1510
1789
|
drawable.native.setMap(null);
|
|
1511
1790
|
}
|
|
1791
|
+
|
|
1792
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
1793
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
1512
1794
|
} else {
|
|
1513
1795
|
drawable.native.setMap(null);
|
|
1514
1796
|
}
|
|
@@ -2114,6 +2396,8 @@
|
|
|
2114
2396
|
googleMarker_1 = new google.maps.Marker(options);
|
|
2115
2397
|
}
|
|
2116
2398
|
|
|
2399
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
2400
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
2117
2401
|
marker.native = googleMarker_1;
|
|
2118
2402
|
((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
|
|
2119
2403
|
if (_this.markerEvents.includes(key)) {
|
|
@@ -2152,6 +2436,8 @@
|
|
|
2152
2436
|
marker.native.position = options.position;
|
|
2153
2437
|
}
|
|
2154
2438
|
}
|
|
2439
|
+
|
|
2440
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
|
|
2155
2441
|
}
|
|
2156
2442
|
};
|
|
2157
2443
|
|
|
@@ -2218,6 +2504,8 @@
|
|
|
2218
2504
|
} else if (drawable.native instanceof google.maps.marker.AdvancedMarkerView) {
|
|
2219
2505
|
google.maps.event.clearInstanceListeners(drawable.native);
|
|
2220
2506
|
drawable.native.map = null;
|
|
2507
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
2508
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
2221
2509
|
return true;
|
|
2222
2510
|
}
|
|
2223
2511
|
}
|
|
@@ -2800,6 +3088,8 @@
|
|
|
2800
3088
|
this.updateMarker(marker, marker.options);
|
|
2801
3089
|
} else {
|
|
2802
3090
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
3091
|
+
log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
|
|
3092
|
+
Status.setMarker(1, marker.options.debugLabel);
|
|
2803
3093
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
2804
3094
|
this.removeParentElementsMargin(marker);
|
|
2805
3095
|
marker.native = kakaoMarker_1;
|
|
@@ -2828,6 +3118,7 @@
|
|
|
2828
3118
|
marker.native.setVisible(options.visible);
|
|
2829
3119
|
}
|
|
2830
3120
|
|
|
3121
|
+
log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
|
|
2831
3122
|
this.removeParentElementsMargin(marker);
|
|
2832
3123
|
}
|
|
2833
3124
|
}
|
|
@@ -2900,6 +3191,8 @@
|
|
|
2900
3191
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.releasePoolItem(drawable.native);
|
|
2901
3192
|
} else {
|
|
2902
3193
|
drawable.native.setMap(null);
|
|
3194
|
+
log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
|
|
3195
|
+
Status.setMarker(-1, drawable.options.debugLabel);
|
|
2903
3196
|
}
|
|
2904
3197
|
} else {
|
|
2905
3198
|
drawable.native.setMap(null);
|
|
@@ -3637,80 +3930,6 @@
|
|
|
3637
3930
|
}, children));
|
|
3638
3931
|
}
|
|
3639
3932
|
|
|
3640
|
-
var AnimationPlayer =
|
|
3641
|
-
/** @class */
|
|
3642
|
-
function () {
|
|
3643
|
-
function AnimationPlayer(drawFunction, fps) {
|
|
3644
|
-
this.prevtime = 0;
|
|
3645
|
-
this.elapsedTime = 0;
|
|
3646
|
-
this.fps = null;
|
|
3647
|
-
this.baseDrawGapTime = null;
|
|
3648
|
-
this.deltaTime = 0;
|
|
3649
|
-
this.playing = false;
|
|
3650
|
-
this.draw = drawFunction;
|
|
3651
|
-
this.fps = fps || null;
|
|
3652
|
-
|
|
3653
|
-
if (fps !== undefined) {
|
|
3654
|
-
this.baseDrawGapTime = 1000 / fps;
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
this.init();
|
|
3658
|
-
}
|
|
3659
|
-
|
|
3660
|
-
AnimationPlayer.prototype.init = function () {
|
|
3661
|
-
this.deltaTime = 0;
|
|
3662
|
-
this.prevtime = 0;
|
|
3663
|
-
this.elapsedTime = 0;
|
|
3664
|
-
this.playing = false;
|
|
3665
|
-
};
|
|
3666
|
-
|
|
3667
|
-
AnimationPlayer.prototype.start = function () {
|
|
3668
|
-
this.init();
|
|
3669
|
-
this.resume();
|
|
3670
|
-
};
|
|
3671
|
-
|
|
3672
|
-
AnimationPlayer.prototype.stop = function () {
|
|
3673
|
-
this.playing = false;
|
|
3674
|
-
};
|
|
3675
|
-
|
|
3676
|
-
AnimationPlayer.prototype.resume = function () {
|
|
3677
|
-
this.playing = true; //@ts-ignore
|
|
3678
|
-
|
|
3679
|
-
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
3680
|
-
};
|
|
3681
|
-
|
|
3682
|
-
AnimationPlayer.prototype.makeFrame = function (timestamp) {
|
|
3683
|
-
//frame 간 시간 변화
|
|
3684
|
-
if (this.prevtime === 0) {
|
|
3685
|
-
this.prevtime = timestamp;
|
|
3686
|
-
}
|
|
3687
|
-
|
|
3688
|
-
this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
|
|
3689
|
-
|
|
3690
|
-
this.prevtime = timestamp;
|
|
3691
|
-
|
|
3692
|
-
if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
|
|
3693
|
-
//다음 루프 준비
|
|
3694
|
-
this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
|
|
3695
|
-
|
|
3696
|
-
var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
|
|
3697
|
-
|
|
3698
|
-
this.deltaTime = 0;
|
|
3699
|
-
|
|
3700
|
-
if (stopFlag) {
|
|
3701
|
-
this.stop();
|
|
3702
|
-
}
|
|
3703
|
-
}
|
|
3704
|
-
|
|
3705
|
-
if (this.playing) {
|
|
3706
|
-
//@ts-ignore
|
|
3707
|
-
window.requestAnimationFrame(this.makeFrame.bind(this));
|
|
3708
|
-
}
|
|
3709
|
-
};
|
|
3710
|
-
|
|
3711
|
-
return AnimationPlayer;
|
|
3712
|
-
}();
|
|
3713
|
-
|
|
3714
3933
|
var Drawable =
|
|
3715
3934
|
/** @class */
|
|
3716
3935
|
function () {
|
|
@@ -4101,141 +4320,6 @@
|
|
|
4101
4320
|
return reactDom.createPortal(children, divElement);
|
|
4102
4321
|
}
|
|
4103
4322
|
|
|
4104
|
-
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
4105
|
-
var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
4109
|
-
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
|
|
4110
|
-
|
|
4111
|
-
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
4112
|
-
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
|
|
4113
|
-
var boundsPos = [];
|
|
4114
|
-
var tempX1, tempY1, tempX2, tempY2;
|
|
4115
|
-
|
|
4116
|
-
for (var i = 0; i < rowCount; i++) {
|
|
4117
|
-
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
4118
|
-
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
4119
|
-
var rows = [];
|
|
4120
|
-
boundsPos.push(rows);
|
|
4121
|
-
|
|
4122
|
-
for (var k = 0; k < colCount; k++) {
|
|
4123
|
-
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
4124
|
-
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
4125
|
-
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
4126
|
-
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
4127
|
-
rows.push({
|
|
4128
|
-
bounds: thisBounds,
|
|
4129
|
-
checked: false,
|
|
4130
|
-
center: false,
|
|
4131
|
-
centerPosition: thisBounds.getCenter(),
|
|
4132
|
-
incList: [],
|
|
4133
|
-
itemList: includedList,
|
|
4134
|
-
size: basePixelSize
|
|
4135
|
-
});
|
|
4136
|
-
}
|
|
4137
|
-
} //좌표마다 검사해서 인접셀 병합 처리
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
var centerList = [];
|
|
4141
|
-
var totalItemCount = 0;
|
|
4142
|
-
var min;
|
|
4143
|
-
var max;
|
|
4144
|
-
|
|
4145
|
-
for (var i = 0; i < boundsPos.length; i++) {
|
|
4146
|
-
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
4147
|
-
var curr = boundsPos[i][k];
|
|
4148
|
-
if (curr.checked) continue;
|
|
4149
|
-
curr.checked = true; //현재기준 8방향 객체 모으기
|
|
4150
|
-
|
|
4151
|
-
var incList = [];
|
|
4152
|
-
|
|
4153
|
-
if (boundsPos[i]) {
|
|
4154
|
-
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
4155
|
-
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
4156
|
-
}
|
|
4157
|
-
|
|
4158
|
-
if (boundsPos[i - 1]) {
|
|
4159
|
-
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
4160
|
-
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
4161
|
-
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
4162
|
-
}
|
|
4163
|
-
|
|
4164
|
-
if (boundsPos[i + 1]) {
|
|
4165
|
-
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
4166
|
-
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
4167
|
-
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
4168
|
-
}
|
|
4169
|
-
|
|
4170
|
-
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
4171
|
-
var inc = incList_1[_i];
|
|
4172
|
-
if (inc.checked) continue;
|
|
4173
|
-
inc.checked = true;
|
|
4174
|
-
|
|
4175
|
-
if (inc.itemList && inc.itemList.length > 0) {
|
|
4176
|
-
curr.incList.push(inc);
|
|
4177
|
-
|
|
4178
|
-
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
4179
|
-
|
|
4180
|
-
curr.center = true;
|
|
4181
|
-
}
|
|
4182
|
-
}
|
|
4183
|
-
|
|
4184
|
-
if (curr.center) {
|
|
4185
|
-
centerList.push(curr);
|
|
4186
|
-
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
4187
|
-
return item.lat;
|
|
4188
|
-
}));
|
|
4189
|
-
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
4190
|
-
return item.lng;
|
|
4191
|
-
}));
|
|
4192
|
-
curr.centerPosition = new Position(avrLat, avrLng);
|
|
4193
|
-
totalItemCount += curr.itemList.length;
|
|
4194
|
-
|
|
4195
|
-
if (!min || curr.itemList.length < min) {
|
|
4196
|
-
min = curr.itemList.length;
|
|
4197
|
-
}
|
|
4198
|
-
|
|
4199
|
-
if (!max || curr.itemList.length > max) {
|
|
4200
|
-
max = curr.itemList.length;
|
|
4201
|
-
}
|
|
4202
|
-
}
|
|
4203
|
-
}
|
|
4204
|
-
}
|
|
4205
|
-
|
|
4206
|
-
var status = {
|
|
4207
|
-
total: totalItemCount,
|
|
4208
|
-
average: totalItemCount / centerList.length,
|
|
4209
|
-
min: min,
|
|
4210
|
-
max: max
|
|
4211
|
-
};
|
|
4212
|
-
|
|
4213
|
-
sizeFunction = sizeFunction || function (info, status) {
|
|
4214
|
-
var minSize = basePixelSize / 4;
|
|
4215
|
-
var maxSize = basePixelSize;
|
|
4216
|
-
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
4217
|
-
};
|
|
4218
|
-
|
|
4219
|
-
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
4220
|
-
var center = centerList_1[_b];
|
|
4221
|
-
center.size = sizeFunction(center, status);
|
|
4222
|
-
} // console.log('centerList', centerList, status);
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
return centerList;
|
|
4226
|
-
};
|
|
4227
|
-
|
|
4228
|
-
var calculateAverage = function (nums) {
|
|
4229
|
-
var sum = 0;
|
|
4230
|
-
|
|
4231
|
-
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
4232
|
-
var num = nums_1[_i];
|
|
4233
|
-
sum += num;
|
|
4234
|
-
}
|
|
4235
|
-
|
|
4236
|
-
return Number((sum / nums.length).toFixed(7));
|
|
4237
|
-
};
|
|
4238
|
-
|
|
4239
4323
|
/**
|
|
4240
4324
|
* CircleMarker
|
|
4241
4325
|
*
|
|
@@ -5448,7 +5532,9 @@
|
|
|
5448
5532
|
exports.SVGCircle = SVGCircle;
|
|
5449
5533
|
exports.SVGPolygon = SVGPolygon;
|
|
5450
5534
|
exports.SVGRect = SVGRect;
|
|
5535
|
+
exports.Status = Status;
|
|
5451
5536
|
exports.getClusterInfo = getClusterInfo;
|
|
5537
|
+
exports.log = log;
|
|
5452
5538
|
exports.useMarkerMoving = useMarkerMoving;
|
|
5453
5539
|
exports.useMintMapController = useMintMapController;
|
|
5454
5540
|
exports.waiting = waiting;
|