@mint-ui/map 0.4.4-beta → 0.4.6-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.eslintrc.js +109 -109
  2. package/LICENSE +21 -21
  3. package/README.md +73 -73
  4. package/dist/components/mint-map/MintMap.d.ts +10 -117
  5. package/dist/components/mint-map/MintMap.js +24 -421
  6. package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
  7. package/dist/components/mint-map/core/MintMapCanvasRenderer.js +3 -1
  8. package/dist/components/mint-map/core/MintMapController.d.ts +58 -44
  9. package/dist/components/mint-map/core/MintMapController.js +49 -15
  10. package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
  11. package/dist/components/mint-map/core/MintMapCore.js +22 -10
  12. package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
  13. package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +11 -7
  14. package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -0
  15. package/dist/components/mint-map/core/advanced/MapLoadingComponents.js +257 -0
  16. package/dist/components/mint-map/core/advanced/index.d.ts +2 -1
  17. package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
  18. package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +17 -8
  19. package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
  20. package/dist/components/mint-map/core/index.d.ts +8 -8
  21. package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
  22. package/dist/components/mint-map/core/provider/index.d.ts +1 -1
  23. package/dist/components/mint-map/core/util/animation.d.ts +16 -16
  24. package/dist/components/mint-map/core/util/animation.js +14 -5
  25. package/dist/components/mint-map/core/util/calculate.d.ts +39 -34
  26. package/dist/components/mint-map/core/util/calculate.js +65 -26
  27. package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
  28. package/dist/components/mint-map/core/util/cluster.js +14 -9
  29. package/dist/components/mint-map/core/util/index.d.ts +4 -4
  30. package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
  31. package/dist/components/mint-map/core/util/waiting.js +6 -2
  32. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
  33. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
  34. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
  35. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
  36. package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
  37. package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
  38. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +31 -23
  39. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +54 -25
  40. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
  41. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
  42. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
  43. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
  44. package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
  45. package/dist/components/mint-map/google/GoogleMintMapController.d.ts +42 -39
  46. package/dist/components/mint-map/google/GoogleMintMapController.js +91 -45
  47. package/dist/components/mint-map/index.d.ts +5 -4
  48. package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +48 -44
  49. package/dist/components/mint-map/kakao/KakaoMintMapController.js +147 -65
  50. package/dist/components/mint-map/naver/NaverMintMapController.d.ts +45 -42
  51. package/dist/components/mint-map/naver/NaverMintMapController.js +136 -49
  52. package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
  53. package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
  54. package/dist/components/mint-map/types/MapDrawables.js +92 -0
  55. package/dist/components/mint-map/types/MapTypes.d.ts +59 -0
  56. package/dist/components/mint-map/types/MapTypes.js +151 -0
  57. package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
  58. package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
  59. package/dist/components/mint-map/types/index.d.ts +5 -0
  60. package/dist/index.d.ts +7 -1
  61. package/dist/index.es.js +1506 -947
  62. package/dist/index.js +12 -9
  63. package/dist/index.umd.js +1506 -947
  64. package/package.json +77 -77
  65. package/test.ts +0 -7
@@ -1 +1 @@
1
- export * from "./MarkerMovingHook";
1
+ export * from "./MarkerMovingHook";
@@ -1,8 +1,8 @@
1
- export * from "./MintMapCore";
2
- export * from "./MintMapController";
3
- export * from './MintMapCanvasRenderer';
4
- export * from "./advanced";
5
- export * from "./hooks";
6
- export * from "./provider";
7
- export * from './util';
8
- export * from './wrapper';
1
+ export * from "./MintMapCore";
2
+ export * from "./MintMapController";
3
+ export * from './MintMapCanvasRenderer';
4
+ export * from "./advanced";
5
+ export * from "./hooks";
6
+ export * from "./provider";
7
+ export * from './util';
8
+ export * from './wrapper';
@@ -1,8 +1,8 @@
1
- import { PropsWithChildren } from "react";
2
- import { MintMapController } from "../MintMapController";
3
- interface MintMapProviderProps {
4
- controller: MintMapController;
5
- }
6
- export declare function MintMapProvider({ controller, children }: PropsWithChildren<MintMapProviderProps>): JSX.Element;
7
- export declare function useMintMapController(): MintMapController;
8
- export {};
1
+ import { PropsWithChildren } from "react";
2
+ import { MintMapController } from "../MintMapController";
3
+ interface MintMapProviderProps {
4
+ controller: MintMapController;
5
+ }
6
+ export declare function MintMapProvider({ controller, children }: PropsWithChildren<MintMapProviderProps>): JSX.Element;
7
+ export declare function useMintMapController(): MintMapController;
8
+ export {};
@@ -1 +1 @@
1
- export * from "./MintMapProvider";
1
+ export * from "./MintMapProvider";
@@ -1,16 +1,16 @@
1
- export declare type DrawFunction = (frameGapTime: number, elapsedTime: number) => boolean | undefined;
2
- export declare class AnimationPlayer {
3
- prevtime: number;
4
- elapsedTime: number;
5
- fps: number | null;
6
- baseDrawGapTime: number | null;
7
- private deltaTime;
8
- private playing;
9
- draw: DrawFunction;
10
- constructor(drawFunction: DrawFunction, fps?: number);
11
- init(): void;
12
- start(): void;
13
- stop(): void;
14
- resume(): void;
15
- makeFrame(timestamp: number): void;
16
- }
1
+ export declare type DrawFunction = (frameGapTime: number, elapsedTime: number) => boolean | undefined;
2
+ export declare class AnimationPlayer {
3
+ prevtime: number;
4
+ elapsedTime: number;
5
+ fps: number | null;
6
+ baseDrawGapTime: number | null;
7
+ private deltaTime;
8
+ private playing;
9
+ draw: DrawFunction;
10
+ constructor(drawFunction: DrawFunction, fps?: number);
11
+ init(): void;
12
+ start(): void;
13
+ stop(): void;
14
+ resume(): void;
15
+ makeFrame(timestamp: number): void;
16
+ }
@@ -2,7 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var AnimationPlayer = function () {
5
+ var AnimationPlayer =
6
+ /** @class */
7
+ function () {
6
8
  function AnimationPlayer(drawFunction, fps) {
7
9
  this.prevtime = 0;
8
10
  this.elapsedTime = 0;
@@ -37,21 +39,27 @@ var AnimationPlayer = function () {
37
39
  };
38
40
 
39
41
  AnimationPlayer.prototype.resume = function () {
40
- this.playing = true;
42
+ this.playing = true; //@ts-ignore
43
+
41
44
  window.requestAnimationFrame(this.makeFrame.bind(this));
42
45
  };
43
46
 
44
47
  AnimationPlayer.prototype.makeFrame = function (timestamp) {
48
+ //frame 간 시간 변화
45
49
  if (this.prevtime === 0) {
46
50
  this.prevtime = timestamp;
47
51
  }
48
52
 
49
- this.deltaTime += timestamp - this.prevtime;
53
+ this.deltaTime += timestamp - this.prevtime; //정해진 시간이 없거나, 정해진 시간이 지났으면 draw 호출
54
+
50
55
  this.prevtime = timestamp;
51
56
 
52
57
  if (!this.baseDrawGapTime || this.baseDrawGapTime <= this.deltaTime) {
53
- this.elapsedTime += this.deltaTime;
54
- var stopFlag = this.draw(this.deltaTime, this.elapsedTime);
58
+ //다음 루프 준비
59
+ this.elapsedTime += this.deltaTime; //draw 콜백에서 stop 신호오면 멈춤
60
+
61
+ var stopFlag = this.draw(this.deltaTime, this.elapsedTime); //delta 초기화
62
+
55
63
  this.deltaTime = 0;
56
64
 
57
65
  if (stopFlag) {
@@ -60,6 +68,7 @@ var AnimationPlayer = function () {
60
68
  }
61
69
 
62
70
  if (this.playing) {
71
+ //@ts-ignore
63
72
  window.requestAnimationFrame(this.makeFrame.bind(this));
64
73
  }
65
74
  };
@@ -1,34 +1,39 @@
1
- import { Position } from "../../MintMap";
2
- export declare class PolygonCalculator {
3
- static getCenter(positions: Position[]): Position;
4
- static intersects(positions1: Position[], positions2: Position[]): boolean;
5
- static getIncludedPositions(polygon: Position[], position: Position | Position[]): Position[];
6
- private static convertPolygonToLinePoints;
7
- private static convertPositionToPoints;
8
- private static getCrossPoint;
9
- private static toFixedPosition;
10
- private static getCrossPointAll;
11
- private static findCrossPoint;
12
- }
13
- export interface NextPositionContext {
14
- pos1: Position;
15
- pos2: Position;
16
- velocityKmh: number;
17
- elapsedTimeMs: number;
18
- totalDistance: number;
19
- currDistance: number;
20
- distanceRemain: number;
21
- prevPos2: Position;
22
- prevVelocityKmh: number;
23
- vPerMs: number;
24
- nextPos: Position;
25
- }
26
- export declare class GeoCalulator {
27
- private static readonly EARTH_RADIUS;
28
- private static readonly LATITUDE_POSITION_VALUE_PER_METER;
29
- static computeDistanceKiloMeter(pos1: Position, pos2: Position): number;
30
- private static deg2rad;
31
- static convertMeterToLatitudeValue(meter: number): number;
32
- private static readonly MS_FROM_HOUR;
33
- static computeNextPositionAndDistances(context: NextPositionContext): NextPositionContext;
34
- }
1
+ declare class PositionMirror {
2
+ lat: number;
3
+ lng: number;
4
+ constructor(lat: number, lng: number);
5
+ }
6
+ export declare class PolygonCalculator {
7
+ static getCenter(positions: PositionMirror[]): PositionMirror;
8
+ static intersects(positions1: PositionMirror[], positions2: PositionMirror[]): boolean;
9
+ static getIncludedPositions(polygon: PositionMirror[], position: PositionMirror | PositionMirror[]): PositionMirror[];
10
+ private static convertPolygonToLinePoints;
11
+ private static convertPositionToPoints;
12
+ private static getCrossPoint;
13
+ private static toFixedPosition;
14
+ private static getCrossPointAll;
15
+ private static findCrossPoint;
16
+ }
17
+ export interface NextPositionContext {
18
+ pos1: PositionMirror;
19
+ pos2: PositionMirror;
20
+ velocityKmh: number;
21
+ elapsedTimeMs: number;
22
+ totalDistance: number;
23
+ currDistance: number;
24
+ distanceRemain: number;
25
+ prevPos2: PositionMirror;
26
+ prevVelocityKmh: number;
27
+ vPerMs: number;
28
+ nextPos: PositionMirror;
29
+ }
30
+ export declare class GeoCalulator {
31
+ private static readonly EARTH_RADIUS;
32
+ private static readonly LATITUDE_POSITION_VALUE_PER_METER;
33
+ static computeDistanceKiloMeter(pos1: PositionMirror, pos2: PositionMirror): number;
34
+ private static deg2rad;
35
+ static convertMeterToLatitudeValue(meter: number): number;
36
+ private static readonly MS_FROM_HOUR;
37
+ static computeNextPositionAndDistances(context: NextPositionContext): NextPositionContext;
38
+ }
39
+ export {};
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var MintMap = require('../../MintMap.js');
6
-
7
- var LinePoints = function () {
5
+ var LinePoints =
6
+ /** @class */
7
+ function () {
8
8
  function LinePoints(x1, y1, x2, y2) {
9
9
  this.x1 = x1;
10
10
  this.y1 = y1;
@@ -15,7 +15,20 @@ var LinePoints = function () {
15
15
  return LinePoints;
16
16
  }();
17
17
 
18
- var PolygonCalculator = function () {
18
+ var PositionMirror =
19
+ /** @class */
20
+ function () {
21
+ function PositionMirror(lat, lng) {
22
+ this.lat = lat;
23
+ this.lng = lng;
24
+ }
25
+
26
+ return PositionMirror;
27
+ }();
28
+
29
+ var PolygonCalculator =
30
+ /** @class */
31
+ function () {
19
32
  function PolygonCalculator() {}
20
33
 
21
34
  PolygonCalculator.getCenter = function (positions) {
@@ -39,10 +52,11 @@ var PolygonCalculator = function () {
39
52
  if (minY === undefined || pos.lng < minY) {
40
53
  minY = pos.lng;
41
54
  }
42
- }
55
+ } //console.log('center min max => ', maxX, minX, maxY, minY)
56
+
43
57
 
44
58
  if (maxX && minX && maxY && minY) {
45
- return new MintMap.Position(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
59
+ return new PositionMirror(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
46
60
  }
47
61
 
48
62
  throw new Error('Calculate Center Error!!!');
@@ -75,9 +89,10 @@ var PolygonCalculator = function () {
75
89
  var lines = this.convertPolygonToLinePoints(polygon);
76
90
 
77
91
  for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
78
- var target = targets_1[_i];
79
- var tempLine = this.convertPositionToPoints(target, new MintMap.Position(target.lat, maxX));
80
- var crossPoints = this.getCrossPointAll(lines, tempLine);
92
+ var target = targets_1[_i]; //x 축으로 긴 직선과 폴리곤 path 와의 교차 수 비교
93
+
94
+ var tempLine = this.convertPositionToPoints(target, new PositionMirror(target.lat, maxX));
95
+ var crossPoints = this.getCrossPointAll(lines, tempLine); // console.log('crossPoints',crossPoints);
81
96
 
82
97
  if (crossPoints.length > 0 && crossPoints.length % 2 != 0) {
83
98
  result.push(target);
@@ -99,16 +114,20 @@ var PolygonCalculator = function () {
99
114
 
100
115
  PolygonCalculator.convertPositionToPoints = function (pos1, pos2) {
101
116
  return new LinePoints(pos1.lng, pos1.lat, pos2.lng, pos2.lat);
102
- };
117
+ }; //두 직선의 교점 구하기
118
+
103
119
 
104
120
  PolygonCalculator.getCrossPoint = function (sr, tr) {
105
- var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2);
121
+ var p1 = (sr.x1 - sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 - tr.x2); //분모로 사용됨
122
+ // p1 ==0 이면 평행선 또는 일치 이므로 제외(분모)
106
123
 
107
124
  if (p1 != 0) {
108
125
  var x = ((sr.x1 * sr.y2 - sr.y1 * sr.x2) * (tr.x1 - tr.x2) - (sr.x1 - sr.x2) * (tr.x1 * tr.y2 - tr.y1 * tr.x2)) / p1;
109
126
  var y = ((sr.x1 * sr.y2 - sr.y1 * sr.x2) * (tr.y1 - tr.y2) - (sr.y1 - sr.y2) * (tr.x1 * tr.y2 - tr.y1 * tr.x2)) / p1;
110
127
 
111
- if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0 && this.toFixedPosition((x - tr.x1) * (x - tr.x2)) <= 0 && this.toFixedPosition((y - tr.y1) * (y - tr.y2)) <= 0) {
128
+ if (this.toFixedPosition((x - sr.x1) * (x - sr.x2)) <= 0 && this.toFixedPosition((y - sr.y1) * (y - sr.y2)) <= 0 //교점이 1선분 위에 있고
129
+ && this.toFixedPosition((x - tr.x1) * (x - tr.x2)) <= 0 && this.toFixedPosition((y - tr.y1) * (y - tr.y2)) <= 0 //교점이 2선분 위에 있을경우
130
+ ) {
112
131
  return {
113
132
  x: x,
114
133
  y: y
@@ -138,7 +157,7 @@ var PolygonCalculator = function () {
138
157
 
139
158
  PolygonCalculator.findCrossPoint = function (sr, tr) {
140
159
  for (var _i = 0, sr_2 = sr; _i < sr_2.length; _i++) {
141
- var tmp = sr_2[_i];
160
+ var tmp = sr_2[_i]; //교점이 있으면 true
142
161
 
143
162
  if (this.getCrossPoint(tmp, tr)) {
144
163
  return true;
@@ -151,7 +170,9 @@ var PolygonCalculator = function () {
151
170
  return PolygonCalculator;
152
171
  }();
153
172
 
154
- var GeoCalulator = function () {
173
+ var GeoCalulator =
174
+ /** @class */
175
+ function () {
155
176
  function GeoCalulator() {}
156
177
 
157
178
  GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
@@ -159,7 +180,8 @@ var GeoCalulator = function () {
159
180
  var dLon = this.deg2rad(pos2.lng - pos1.lng);
160
181
  var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(pos1.lat)) * Math.cos(this.deg2rad(pos2.lat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
161
182
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
162
- var d = this.EARTH_RADIUS * c;
183
+ var d = this.EARTH_RADIUS * c; // Distance in km
184
+
163
185
  return d;
164
186
  };
165
187
 
@@ -177,48 +199,65 @@ var GeoCalulator = function () {
177
199
  prevPos2 = context.prevPos2,
178
200
  velocityKmh = context.velocityKmh,
179
201
  prevVelocityKmh = context.prevVelocityKmh,
180
- elapsedTimeMs = context.elapsedTimeMs;
202
+ elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
203
+ //총 가야할 거리 (km)
181
204
 
182
205
  if (pos2 !== prevPos2) {
206
+ //목표가 바뀌면 거리 및 비율 재계산
183
207
  context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
184
208
  context.currDistance = 0;
185
209
  context.prevPos2 = pos2;
186
210
  }
187
211
 
188
- var totalDistance = context.totalDistance;
212
+ var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
213
+ //ms 속으로 환산
189
214
 
190
215
  if (velocityKmh !== prevVelocityKmh) {
216
+ //속도가 바뀌면 재계산
191
217
  context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
192
218
  context.prevVelocityKmh = velocityKmh;
193
219
  }
194
220
 
195
- var vPerMs = context.vPerMs;
196
- var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs;
221
+ var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
222
+ //실제 가는 거리 계산
223
+
224
+ var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
225
+ //목표점까지 이동 후에도 남는 거리
226
+
197
227
  context.currDistance = nextDistance;
198
228
 
199
229
  if (totalDistance < context.currDistance) {
230
+ //이동 거리가 현재 목표점을 넘어가는 경우
200
231
  context.distanceRemain = context.currDistance - totalDistance;
201
232
  context.nextPos = pos2;
202
233
  return context;
203
234
  } else {
204
235
  context.distanceRemain = 0;
205
- }
236
+ } //각 축으로 나가야할 비율
237
+
238
+
239
+ var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
240
+ //방향값 체크
206
241
 
207
- var ratio = nextDistance / totalDistance;
208
242
  var latCalib = pos2.lat > pos1.lat ? 1 : -1;
209
- var lngCalib = pos2.lng > pos1.lng ? 1 : -1;
210
- var newPos = new MintMap.Position(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
243
+ var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
244
+
245
+ var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
211
246
 
212
247
  if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
213
248
  newPos = pos2;
214
- }
249
+ } // console.log('newPos', newPos);
250
+ //console.log('==============================================================\n');
251
+
215
252
 
216
253
  context.nextPos = newPos;
217
254
  return context;
218
255
  };
219
256
 
220
- GeoCalulator.EARTH_RADIUS = 6371;
221
- GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / (110 * 1000);
257
+ GeoCalulator.EARTH_RADIUS = 6371; //in km (6,371.230 km)
258
+
259
+ GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / (110 * 1000); //위도 기준 1도는 110km
260
+
222
261
  GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
223
262
  return GeoCalulator;
224
263
  }();
@@ -1,18 +1,18 @@
1
- import { Bounds, Position } from "../../MintMap";
2
- export interface ClusterInfo {
3
- bounds: Bounds;
4
- checked: boolean;
5
- center: boolean;
6
- centerPosition: Position;
7
- incList: any;
8
- itemList: Position[];
9
- size: number;
10
- }
11
- export interface ClusterStatus {
12
- total: number;
13
- average: number;
14
- min: number;
15
- max: number;
16
- }
17
- export declare type ClusterSizeCalculator = (info: ClusterInfo, status: ClusterStatus) => number;
18
- export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) => ClusterInfo[];
1
+ import { Bounds, Position } from "../../types/MapTypes";
2
+ export interface ClusterInfo {
3
+ bounds: Bounds;
4
+ checked: boolean;
5
+ center: boolean;
6
+ centerPosition: Position;
7
+ incList: any;
8
+ itemList: Position[];
9
+ size: number;
10
+ }
11
+ export interface ClusterStatus {
12
+ total: number;
13
+ average: number;
14
+ min: number;
15
+ max: number;
16
+ }
17
+ export declare type ClusterSizeCalculator = (info: ClusterInfo, status: ClusterStatus) => number;
18
+ export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) => ClusterInfo[];
@@ -2,15 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var MintMap = require('../../MintMap.js');
5
+ var MapTypes = require('../../types/MapTypes.js');
6
6
 
7
7
  var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
8
- var _a;
8
+ var _a; //1. basePixelSize 기준으로 현재 지도 크기를 베이스로 영역 갯수 정하기
9
+
9
10
 
10
11
  var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
11
- var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1;
12
+ var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1; //console.log('rowCount', rowCount, 'colCount', colCount)
13
+
12
14
  var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
13
- var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7));
15
+ var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7)); //console.log('boundsLineSize', boundsLineSizeX, boundsLineSizeY)
14
16
  var boundsPos = [];
15
17
  var tempX1, tempY1, tempX2, tempY2;
16
18
 
@@ -23,7 +25,7 @@ var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, it
23
25
  for (var k = 0; k < colCount; k++) {
24
26
  tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
25
27
  tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
26
- var thisBounds = MintMap.Bounds.fromNWSE(new MintMap.Position(tempY1, tempX1), new MintMap.Position(tempY2, tempX2));
28
+ var thisBounds = MapTypes.Bounds.fromNWSE(new MapTypes.Position(tempY1, tempX1), new MapTypes.Position(tempY2, tempX2));
27
29
  var includedList = thisBounds.getIncludedPositions(itemList);
28
30
  rows.push({
29
31
  bounds: thisBounds,
@@ -35,7 +37,8 @@ var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, it
35
37
  size: basePixelSize
36
38
  });
37
39
  }
38
- }
40
+ } //좌표마다 검사해서 인접셀 병합 처리
41
+
39
42
 
40
43
  var centerList = [];
41
44
  var totalItemCount = 0;
@@ -46,7 +49,8 @@ var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, it
46
49
  for (var k = 0; k < boundsPos[i].length; k++) {
47
50
  var curr = boundsPos[i][k];
48
51
  if (curr.checked) continue;
49
- curr.checked = true;
52
+ curr.checked = true; //현재기준 8방향 객체 모으기
53
+
50
54
  var incList = [];
51
55
 
52
56
  if (boundsPos[i]) {
@@ -88,7 +92,7 @@ var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, it
88
92
  var avrLng = calculateAverage(curr.itemList.map(function (item) {
89
93
  return item.lng;
90
94
  }));
91
- curr.centerPosition = new MintMap.Position(avrLat, avrLng);
95
+ curr.centerPosition = new MapTypes.Position(avrLat, avrLng);
92
96
  totalItemCount += curr.itemList.length;
93
97
 
94
98
  if (!min || curr.itemList.length < min) {
@@ -118,7 +122,8 @@ var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, it
118
122
  for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
119
123
  var center = centerList_1[_b];
120
124
  center.size = sizeFunction(center, status);
121
- }
125
+ } // console.log('centerList', centerList, status);
126
+
122
127
 
123
128
  return centerList;
124
129
  };
@@ -1,4 +1,4 @@
1
- export * from './animation';
2
- export * from './calculate';
3
- export * from './waiting';
4
- export * from './cluster';
1
+ export * from './animation';
2
+ export * from './calculate';
3
+ export * from './waiting';
4
+ export * from './cluster';
@@ -1 +1 @@
1
- export declare function waiting(evaluation: () => boolean, timeoutSeconds?: number): Promise<boolean>;
1
+ export declare function waiting(evaluation: () => boolean, timeoutSeconds?: number): Promise<boolean>;
@@ -9,16 +9,20 @@ function waiting(evaluation, timeoutSeconds) {
9
9
  var max;
10
10
  return tslib.__generator(this, function (_a) {
11
11
  max = (timeoutSeconds || 5) * 1000;
12
- return [2, new Promise(function (resolve) {
12
+ return [2
13
+ /*return*/
14
+ , new Promise(function (resolve) {
13
15
  var start = new Date().getTime();
14
16
  var inter = setInterval(function () {
17
+ //타임아웃 체크
15
18
  var time = new Date().getTime();
16
19
 
17
20
  if (time - start > max) {
18
21
  clearInterval(inter);
19
22
  resolve(false);
20
23
  return;
21
- }
24
+ } //평가식 체크
25
+
22
26
 
23
27
  if (evaluation()) {
24
28
  clearInterval(inter);
@@ -1,19 +1,27 @@
1
- /// <reference types="react" />
2
- import { MarkerOptions, Offset } from "../../MintMap";
3
- import { MintMapCanvasRenderer } from "../MintMapCanvasRenderer";
4
- export declare type CanvasMarkerRenderer<T> = (ctx: MintMapCanvasRenderer, offset: Offset, payload?: T) => void;
5
- export interface CanvasMarkerMouseEvent {
6
- x: number;
7
- y: number;
8
- }
9
- export declare type CanvasMarkerMouseEventCallback = (e: CanvasMarkerMouseEvent) => boolean | undefined | void;
10
- export interface MapCanvasMarkerWrapperProps<T> extends MarkerOptions {
11
- renderer: CanvasMarkerRenderer<T>;
12
- payload?: T;
13
- boxWidth: number;
14
- boxHeight: number;
15
- onClick?: CanvasMarkerMouseEventCallback;
16
- onMouseOver?: CanvasMarkerMouseEventCallback;
17
- onMouseOut?: CanvasMarkerMouseEventCallback;
18
- }
19
- export declare function MapCanvasMarkerWrapper<T>(_props: MapCanvasMarkerWrapperProps<T>): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { MarkerOptions } from "../../types/MapDrawables";
3
+ import { Offset } from "../../types/MapTypes";
4
+ import { MintMapCanvasRenderer } from "../MintMapCanvasRenderer";
5
+ export declare type CanvasMarkerRenderer<T> = (ctx: MintMapCanvasRenderer, offset: Offset, payload?: T) => void;
6
+ export interface CanvasMarkerMouseEvent {
7
+ x: number;
8
+ y: number;
9
+ }
10
+ export declare type CanvasMarkerMouseEventCallback = (e: CanvasMarkerMouseEvent) => boolean | undefined | void;
11
+ export interface MapCanvasMarkerWrapperProps<T> extends MarkerOptions {
12
+ renderer: CanvasMarkerRenderer<T>;
13
+ payload?: T;
14
+ boxWidth: number;
15
+ boxHeight: number;
16
+ onClick?: CanvasMarkerMouseEventCallback;
17
+ onMouseOver?: CanvasMarkerMouseEventCallback;
18
+ onMouseOut?: CanvasMarkerMouseEventCallback;
19
+ }
20
+ /**
21
+ * Mint Map 컴포넌트
22
+ *
23
+ * @param {MapControlWrapperProps} MapControlWrapperProps
24
+ *
25
+ * @returns {JSX.Element} JSX
26
+ */
27
+ export declare function MapCanvasMarkerWrapper<T>(_props: MapCanvasMarkerWrapperProps<T>): JSX.Element;
@@ -8,7 +8,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
10
 
11
+ /**
12
+ * Mint Map 컴포넌트
13
+ *
14
+ * @param {MapControlWrapperProps} MapControlWrapperProps
15
+ *
16
+ * @returns {JSX.Element} JSX
17
+ */
18
+
11
19
  function MapCanvasMarkerWrapper(_props) {
20
+ //실제 렌더링처리는 MapCanvasWrapper 에서...
12
21
  return React__default["default"].createElement(React__default["default"].Fragment, null);
13
22
  }
14
23
 
@@ -1,4 +1,11 @@
1
- import React from "react";
2
- export interface MapCanvasWrapperProps {
3
- }
4
- export declare function MapCanvasWrapper<T>({ children, ...props }: React.PropsWithChildren<MapCanvasWrapperProps>): JSX.Element;
1
+ import React from "react";
2
+ export interface MapCanvasWrapperProps {
3
+ }
4
+ /**
5
+ * Mint Map 컴포넌트
6
+ *
7
+ * @param {MapControlWrapperProps} MapControlWrapperProps
8
+ *
9
+ * @returns {JSX.Element} JSX
10
+ */
11
+ export declare function MapCanvasWrapper<T>({ children, ...props }: React.PropsWithChildren<MapCanvasWrapperProps>): JSX.Element;