@mint-ui/map 0.4.5-beta → 0.5.0-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 (79) 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 +64 -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 +3 -1
  17. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -0
  18. package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +137 -0
  19. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -0
  20. package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +188 -0
  21. package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -0
  22. package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +54 -0
  23. package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -0
  24. package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +152 -0
  25. package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -0
  26. package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +60 -0
  27. package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -0
  28. package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -0
  29. package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
  30. package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +21 -9
  31. package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
  32. package/dist/components/mint-map/core/index.d.ts +8 -8
  33. package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
  34. package/dist/components/mint-map/core/provider/index.d.ts +1 -1
  35. package/dist/components/mint-map/core/util/animation.d.ts +16 -16
  36. package/dist/components/mint-map/core/util/animation.js +14 -5
  37. package/dist/components/mint-map/core/util/calculate.d.ts +66 -34
  38. package/dist/components/mint-map/core/util/calculate.js +233 -27
  39. package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
  40. package/dist/components/mint-map/core/util/cluster.js +14 -9
  41. package/dist/components/mint-map/core/util/index.d.ts +4 -4
  42. package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
  43. package/dist/components/mint-map/core/util/waiting.js +6 -2
  44. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
  45. package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
  46. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
  47. package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
  48. package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
  49. package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
  50. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +32 -23
  51. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +76 -28
  52. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
  53. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
  54. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
  55. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
  56. package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
  57. package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -39
  58. package/dist/components/mint-map/google/GoogleMintMapController.js +224 -44
  59. package/dist/components/mint-map/index.d.ts +5 -4
  60. package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -44
  61. package/dist/components/mint-map/kakao/KakaoMintMapController.js +265 -66
  62. package/dist/components/mint-map/naver/NaverMintMapController.d.ts +53 -42
  63. package/dist/components/mint-map/naver/NaverMintMapController.js +237 -50
  64. package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
  65. package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
  66. package/dist/components/mint-map/types/MapDrawables.js +92 -0
  67. package/dist/components/mint-map/types/MapEventTypes.d.ts +41 -0
  68. package/dist/components/mint-map/types/MapEventTypes.js +57 -0
  69. package/dist/components/mint-map/types/MapTypes.d.ts +60 -0
  70. package/dist/components/mint-map/types/MapTypes.js +155 -0
  71. package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
  72. package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
  73. package/dist/components/mint-map/types/index.d.ts +6 -0
  74. package/dist/index.d.ts +7 -1
  75. package/dist/index.es.js +2638 -975
  76. package/dist/index.js +25 -9
  77. package/dist/index.umd.js +2644 -974
  78. package/package.json +77 -77
  79. package/test.ts +0 -7
@@ -6,6 +6,9 @@ var React = require('react');
6
6
  var MintMapProvider = require('../provider/MintMapProvider.js');
7
7
  var animation = require('../util/animation.js');
8
8
  var calculate = require('../util/calculate.js');
9
+ require('../../types/MapDrawables.js');
10
+ var MapTypes = require('../../types/MapTypes.js');
11
+ require('../../types/MapEventTypes.js');
9
12
 
10
13
  function nextIndex(array, currIdx) {
11
14
  var next = currIdx + 1;
@@ -33,13 +36,16 @@ function useMarkerMoving(_a) {
33
36
  _h = _a.velocity,
34
37
  velocity = _h === void 0 ? 10 : _h,
35
38
  onMovingStart = _a.onMovingStart,
36
- onMovingEnd = _a.onMovingEnd;
39
+ onMovingEnd = _a.onMovingEnd; //controller
40
+
37
41
  var controller = MintMapProvider.useMintMapController();
38
42
  React.useEffect(function () {
43
+ //console.log('velocity changed!!!!', velocity);
39
44
  contextRef.current && (contextRef.current.velocityKmh = velocity);
40
45
  }, [velocity]);
41
46
  var contextRef = React.useRef();
42
47
  React.useEffect(function () {
48
+ //console.log('ani marker', marker);
43
49
  if (marker) {
44
50
  var currTargetIndex_1 = nextIndex(positions, startPositionIndex);
45
51
  var stopNext_1 = false;
@@ -57,15 +63,19 @@ function useMarkerMoving(_a) {
57
63
  var draw = function (frameGapTime, _elapsedTime) {
58
64
  if (!marker) {
59
65
  console.log('myMarker is not exist!!!');
60
- return true;
61
- }
66
+ return true; //종료
67
+ } //지난 시간
68
+
62
69
 
63
- context_1.elapsedTimeMs = frameGapTime;
70
+ context_1.elapsedTimeMs = frameGapTime; //next position 계산
64
71
 
65
72
  while (true) {
66
- calculate.GeoCalulator.computeNextPositionAndDistances(context_1);
73
+ //계산
74
+ calculate.GeoCalulator.computeNextPositionAndDistances(context_1); //타겟에 도착했으면, 원래 얼마나 더 갈수 있었는지 체크해서
75
+ //그 만큼 더 가도록 계속 처리하기위해 다시 계산
67
76
 
68
77
  if (context_1.nextPos === context_1.pos2) {
78
+ //다음 목표가 시작점과 같으면 loop 카운트 +1
69
79
  if (currTargetIndex_1 === startPositionIndex) {
70
80
  loopCount_1 += 1;
71
81
  }
@@ -73,9 +83,11 @@ function useMarkerMoving(_a) {
73
83
  if (!loop && loopCount_1 > 0) {
74
84
  stopNext_1 = true;
75
85
  break;
76
- }
86
+ } //현재 출발점
87
+
88
+
89
+ context_1.pos1 = positions[currTargetIndex_1]; //현재 목표점
77
90
 
78
- context_1.pos1 = positions[currTargetIndex_1];
79
91
  currTargetIndex_1 = nextIndex(positions, currTargetIndex_1);
80
92
 
81
93
  if (currTargetIndex_1 === 0 && !positionClosed) {
@@ -89,13 +101,13 @@ function useMarkerMoving(_a) {
89
101
  }
90
102
  }
91
103
 
92
- nextOption_1.position = context_1.nextPos;
104
+ nextOption_1.position = new MapTypes.Position(context_1.nextPos.lat, context_1.nextPos.lng);
93
105
  marker.options.position = nextOption_1.position;
94
106
  controller.updateMarker(marker, nextOption_1);
95
107
 
96
108
  if (stopNext_1) {
97
109
  onMovingEnd && onMovingEnd();
98
- return true;
110
+ return true; //종료
99
111
  }
100
112
 
101
113
  return false;
@@ -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,66 @@
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 getRegionInfo(positions: PositionMirror[]): {
8
+ maxLat: number | undefined;
9
+ minLat: number | undefined;
10
+ maxLng: number | undefined;
11
+ minLng: number | undefined;
12
+ centerLat: number | undefined;
13
+ centerLng: number | undefined;
14
+ };
15
+ static getRegionStart(positions: PositionMirror[]): PositionMirror;
16
+ static getRegionEnd(positions: PositionMirror[]): PositionMirror;
17
+ static getCenter(positions: PositionMirror[]): PositionMirror;
18
+ static intersects(positions1: PositionMirror[], positions2: PositionMirror[]): boolean;
19
+ static getIncludedPositions(polygon: PositionMirror[], position: PositionMirror | PositionMirror[]): PositionMirror[];
20
+ private static convertPolygonToLinePoints;
21
+ private static convertPositionToPoints;
22
+ private static getCrossPoint;
23
+ private static toFixedPosition;
24
+ private static getCrossPointAll;
25
+ private static findCrossPoint;
26
+ static readonly TOLERANCE_NAVER_STYLE = 0.0001;
27
+ static readonly TOLERANCE_GOOGLE_STYLE = 0.00001;
28
+ static simplifyPoints(polygon: PositionMirror[], tolerance?: number, lastRepeated?: boolean): PositionMirror[];
29
+ private static simplify;
30
+ private static perpendicularDistance;
31
+ static calculatePolygonSize(polygon: PositionMirror[], innerPolygons?: PositionMirror[][]): number;
32
+ private static calculatePolygonSizeMain;
33
+ }
34
+ export interface NextPositionContext {
35
+ pos1: PositionMirror;
36
+ pos2: PositionMirror;
37
+ velocityKmh: number;
38
+ elapsedTimeMs: number;
39
+ totalDistance: number;
40
+ currDistance: number;
41
+ distanceRemain: number;
42
+ prevPos2: PositionMirror;
43
+ prevVelocityKmh: number;
44
+ vPerMs: number;
45
+ nextPos: PositionMirror;
46
+ }
47
+ export declare class GeoCalulator {
48
+ private static readonly EARTH_EQUATORIAL_RADIUS;
49
+ private static readonly EARTH_EQUATORIAL_RADIUS_KM;
50
+ private static readonly EARTH_ECCENTRICITY;
51
+ private static readonly METER_VALUE_PER_LATITUDE;
52
+ private static readonly LATITUDE_POSITION_VALUE_PER_METER;
53
+ static computeDistanceKiloMeter(pos1: PositionMirror, pos2: PositionMirror): number;
54
+ private static deg2rad;
55
+ static convertMeterToLatitudeValue(meter: number): number;
56
+ static convertLatitudeToMeterValue(lat: number): number;
57
+ static convertLongitudeToMeterValue(lat: number, lng: number): number;
58
+ private static readonly CACHE_OF_LNG_PER_METER;
59
+ private static getCacheUnitOfLongitudeValueWithLatitudeInMeter;
60
+ private static getCacheOfLongitudeValueWithLatitudeInMeter;
61
+ private static setCacheOfLongitudeValueWithLatitudeInMeter;
62
+ static calculateLongitudeValueWithLatitudeInMeter(lat: number): number;
63
+ private static readonly MS_FROM_HOUR;
64
+ static computeNextPositionAndDistances(context: NextPositionContext): NextPositionContext;
65
+ }
66
+ export {};