@mint-ui/map 0.4.5-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.
- package/.eslintrc.js +109 -109
- package/LICENSE +21 -21
- package/README.md +73 -73
- package/dist/components/mint-map/MintMap.d.ts +10 -117
- package/dist/components/mint-map/MintMap.js +24 -421
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapCanvasRenderer.js +3 -1
- package/dist/components/mint-map/core/MintMapController.d.ts +58 -44
- package/dist/components/mint-map/core/MintMapController.js +49 -15
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/MintMapCore.js +22 -10
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +11 -7
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -0
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.js +257 -0
- package/dist/components/mint-map/core/advanced/index.d.ts +2 -1
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +17 -8
- package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
- package/dist/components/mint-map/core/index.d.ts +8 -8
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
- package/dist/components/mint-map/core/provider/index.d.ts +1 -1
- package/dist/components/mint-map/core/util/animation.d.ts +16 -16
- package/dist/components/mint-map/core/util/animation.js +14 -5
- package/dist/components/mint-map/core/util/calculate.d.ts +39 -34
- package/dist/components/mint-map/core/util/calculate.js +65 -26
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/cluster.js +14 -9
- package/dist/components/mint-map/core/util/index.d.ts +4 -4
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/util/waiting.js +6 -2
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +31 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +54 -25
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +42 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +90 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +48 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +147 -65
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +45 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +136 -49
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
- package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
- package/dist/components/mint-map/types/MapDrawables.js +92 -0
- package/dist/components/mint-map/types/MapTypes.d.ts +59 -0
- package/dist/components/mint-map/types/MapTypes.js +151 -0
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
- package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
- package/dist/components/mint-map/types/index.d.ts +5 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +1505 -946
- package/dist/index.js +12 -9
- package/dist/index.umd.js +1505 -946
- package/package.json +77 -77
- package/test.ts +0 -7
|
@@ -5,32 +5,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var MintMapProvider = require('../provider/MintMapProvider.js');
|
|
8
|
-
var
|
|
8
|
+
var MapDrawables = require('../../types/MapDrawables.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Mint Map 컴포넌트
|
|
16
|
+
*
|
|
17
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
18
|
+
*
|
|
19
|
+
* @returns {JSX.Element} JSX
|
|
20
|
+
*/
|
|
21
|
+
|
|
14
22
|
function MapPolylineWrapper(_a) {
|
|
15
23
|
var children = _a.children,
|
|
16
|
-
options = tslib.__rest(_a, ["children"]);
|
|
24
|
+
options = tslib.__rest(_a, ["children"]); //controller
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var controller = MintMapProvider.useMintMapController(); //lifecycle
|
|
17
28
|
|
|
18
|
-
var controller = MintMapProvider.useMintMapController();
|
|
19
29
|
React.useEffect(function () {
|
|
20
30
|
return function () {
|
|
21
31
|
if (polylineRef.current) {
|
|
22
|
-
controller.clearDrawable(polylineRef.current);
|
|
32
|
+
controller.clearDrawable(polylineRef.current); // console.log('polyline cleared')
|
|
23
33
|
}
|
|
24
34
|
};
|
|
25
|
-
}, []);
|
|
35
|
+
}, []); //create/update object
|
|
36
|
+
|
|
26
37
|
var polylineRef = React.useRef();
|
|
27
38
|
React.useEffect(function () {
|
|
39
|
+
//console.log('Polyline useEffect')
|
|
28
40
|
if (options) {
|
|
29
41
|
if (polylineRef.current) {
|
|
42
|
+
//console.log('update Polyline', options)
|
|
30
43
|
controller.updatePolyline(polylineRef.current, options);
|
|
31
44
|
} else {
|
|
32
|
-
var polyline = new
|
|
33
|
-
polylineRef.current = polyline;
|
|
45
|
+
var polyline = new MapDrawables.Polyline(options);
|
|
46
|
+
polylineRef.current = polyline; //console.log('create Polyline', options)
|
|
47
|
+
|
|
34
48
|
controller.createPolyline(polyline);
|
|
35
49
|
}
|
|
36
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './MapControlWrapper';
|
|
2
|
-
export * from './MapMarkerWrapper';
|
|
3
|
-
export * from './MapPolygonWrapper';
|
|
4
|
-
export * from './MapPolylineWrapper';
|
|
5
|
-
export * from './MapCanvasWrapper';
|
|
6
|
-
export * from './MapCanvasMarkerWrapper';
|
|
1
|
+
export * from './MapControlWrapper';
|
|
2
|
+
export * from './MapMarkerWrapper';
|
|
3
|
+
export * from './MapPolygonWrapper';
|
|
4
|
+
export * from './MapPolylineWrapper';
|
|
5
|
+
export * from './MapCanvasWrapper';
|
|
6
|
+
export * from './MapCanvasMarkerWrapper';
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
/// <reference types="google.maps" />
|
|
2
|
-
import { MintMapController } from "../core/MintMapController";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import { MintMapController } from "../core/MintMapController";
|
|
3
|
+
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
4
|
+
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
5
|
+
import { Bounds, Position } from "../types/MapTypes";
|
|
6
|
+
import { MintMapProps } from "../types/MintMapProps";
|
|
7
|
+
export declare class GoogleMintMapController extends MintMapController {
|
|
8
|
+
type: MapType;
|
|
9
|
+
map: google.maps.Map | null;
|
|
10
|
+
scriptUrl: string;
|
|
11
|
+
scriptModules: string[];
|
|
12
|
+
constructor(props: MintMapProps);
|
|
13
|
+
polylineEvents: string[];
|
|
14
|
+
createPolyline(polyline: Polyline): void;
|
|
15
|
+
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
16
|
+
polygonEvents: string[];
|
|
17
|
+
createPolygon(polygon: Polygon): void;
|
|
18
|
+
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
19
|
+
private getValidOptions;
|
|
20
|
+
markerEvents: string[];
|
|
21
|
+
createMarker(marker: Marker): void;
|
|
22
|
+
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
23
|
+
private markerMaxZIndex;
|
|
24
|
+
private getMaxZIndex;
|
|
25
|
+
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
26
|
+
markerToTheTop(marker: Marker): void;
|
|
27
|
+
clearDrawable(drawable: Drawable): boolean;
|
|
28
|
+
private dragged;
|
|
29
|
+
isMapDragged(): boolean;
|
|
30
|
+
setMapDragged(value: boolean): void;
|
|
31
|
+
private checkLoaded;
|
|
32
|
+
loadMapApi(): Promise<boolean>;
|
|
33
|
+
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
34
|
+
destroyMap: () => void;
|
|
35
|
+
private fromGoogleBounds;
|
|
36
|
+
getCurrBounds(): Bounds;
|
|
37
|
+
panningTo(targetCenter: Position): void;
|
|
38
|
+
getZoomLevel(): number;
|
|
39
|
+
setZoomLevel(zoom: number): void;
|
|
40
|
+
getCenter(): Position;
|
|
41
|
+
setCenter(position: Position): void;
|
|
42
|
+
}
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var MintMapController = require('../core/MintMapController.js');
|
|
7
7
|
var waiting = require('../core/util/waiting.js');
|
|
8
|
-
var
|
|
8
|
+
var MapTypes = require('../types/MapTypes.js');
|
|
9
9
|
|
|
10
|
-
var GoogleMintMapController =
|
|
10
|
+
var GoogleMintMapController =
|
|
11
|
+
/** @class */
|
|
12
|
+
function (_super) {
|
|
11
13
|
tslib.__extends(GoogleMintMapController, _super);
|
|
12
14
|
|
|
13
15
|
function GoogleMintMapController(props) {
|
|
@@ -16,7 +18,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
16
18
|
_this.type = 'google';
|
|
17
19
|
_this.map = null;
|
|
18
20
|
_this.scriptUrl = 'https://maps.googleapis.com/maps/api/js';
|
|
19
|
-
_this.scriptModules = ['marker'];
|
|
21
|
+
_this.scriptModules = ['marker']; //'drawing' , 'geometry' , 'journeySharing' , 'localContext' , 'places' , 'visualization']
|
|
22
|
+
|
|
20
23
|
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
21
24
|
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
22
25
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
@@ -27,10 +30,11 @@ var GoogleMintMapController = function (_super) {
|
|
|
27
30
|
_this.map && google.maps.event.clearInstanceListeners(_this.map);
|
|
28
31
|
} catch (e) {
|
|
29
32
|
console.log('google map destroy error', e);
|
|
30
|
-
}
|
|
33
|
+
} // console.log(`${this.type} map destroyed`);
|
|
34
|
+
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
return _this;
|
|
37
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
GoogleMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -48,12 +52,13 @@ var GoogleMintMapController = function (_super) {
|
|
|
48
52
|
visible = _e === void 0 ? true : _e,
|
|
49
53
|
_f = _a.editable,
|
|
50
54
|
editable = _f === void 0 ? false : _f,
|
|
51
|
-
event = _a.event;
|
|
55
|
+
event = _a.event; //console.log('polyline', polyline);
|
|
52
56
|
|
|
53
57
|
if (this.map && Array.isArray(position)) {
|
|
54
58
|
var path = position.map(function (elem) {
|
|
55
|
-
return Array.isArray(elem) ? new
|
|
56
|
-
});
|
|
59
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
60
|
+
}); //console.log('polyline path',path);
|
|
61
|
+
|
|
57
62
|
var pol_1 = new google.maps.Polyline({
|
|
58
63
|
map: this.map,
|
|
59
64
|
path: path,
|
|
@@ -63,7 +68,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
63
68
|
clickable: true,
|
|
64
69
|
visible: visible,
|
|
65
70
|
editable: editable
|
|
66
|
-
});
|
|
71
|
+
}); //console.log('google polyline created', polyline);
|
|
72
|
+
|
|
67
73
|
polyline.native = pol_1;
|
|
68
74
|
event && event.forEach(function (handler, key) {
|
|
69
75
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -74,12 +80,13 @@ var GoogleMintMapController = function (_super) {
|
|
|
74
80
|
};
|
|
75
81
|
|
|
76
82
|
GoogleMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
83
|
+
//console.log('controller updatePolyline', options);
|
|
77
84
|
if (polyline && polyline.native && polyline.native instanceof google.maps.Polyline) {
|
|
78
|
-
var polylineOption = this.getValidOptions(options);
|
|
85
|
+
var polylineOption = this.getValidOptions(options); //console.log('controller updatePolyline start', polylineOption);
|
|
79
86
|
|
|
80
87
|
if (this.map && Array.isArray(options.position)) {
|
|
81
88
|
var path = options.position.map(function (elem) {
|
|
82
|
-
return Array.isArray(elem) ? new
|
|
89
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
83
90
|
});
|
|
84
91
|
polylineOption.path = path;
|
|
85
92
|
}
|
|
@@ -108,11 +115,11 @@ var GoogleMintMapController = function (_super) {
|
|
|
108
115
|
visible = _g === void 0 ? true : _g,
|
|
109
116
|
_h = _a.editable,
|
|
110
117
|
editable = _h === void 0 ? false : _h,
|
|
111
|
-
event = _a.event;
|
|
118
|
+
event = _a.event; //console.log('polygon', polygon);
|
|
112
119
|
|
|
113
120
|
if (this.map && Array.isArray(position)) {
|
|
114
121
|
var outLine = position.map(function (elem) {
|
|
115
|
-
return Array.isArray(elem) ? new
|
|
122
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
116
123
|
});
|
|
117
124
|
var paths = [outLine];
|
|
118
125
|
innerPositions && paths.push.apply(paths, innerPositions);
|
|
@@ -127,7 +134,8 @@ var GoogleMintMapController = function (_super) {
|
|
|
127
134
|
clickable: true,
|
|
128
135
|
visible: visible,
|
|
129
136
|
editable: editable
|
|
130
|
-
});
|
|
137
|
+
}); //console.log('google polygon created', polygon);
|
|
138
|
+
|
|
131
139
|
polygon.native = pol_2;
|
|
132
140
|
event && event.forEach(function (handler, key) {
|
|
133
141
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -138,12 +146,13 @@ var GoogleMintMapController = function (_super) {
|
|
|
138
146
|
};
|
|
139
147
|
|
|
140
148
|
GoogleMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
149
|
+
//console.log('controller updatePolygon', options);
|
|
141
150
|
if (polygon && polygon.native && polygon.native instanceof google.maps.Polygon) {
|
|
142
|
-
var polygonOption = this.getValidOptions(options);
|
|
151
|
+
var polygonOption = this.getValidOptions(options); //console.log('controller updatePolygon start', polygonOption);
|
|
143
152
|
|
|
144
153
|
if (this.map && Array.isArray(options.position)) {
|
|
145
154
|
var outLine = options.position.map(function (elem) {
|
|
146
|
-
return Array.isArray(elem) ? new
|
|
155
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
147
156
|
});
|
|
148
157
|
var paths = [outLine];
|
|
149
158
|
options.innerPositions && paths.push.apply(paths, options.innerPositions);
|
|
@@ -155,12 +164,14 @@ var GoogleMintMapController = function (_super) {
|
|
|
155
164
|
};
|
|
156
165
|
|
|
157
166
|
GoogleMintMapController.prototype.getValidOptions = function (options) {
|
|
167
|
+
//console.log('getValidOptions DrawableOptions',options)
|
|
158
168
|
var target = {};
|
|
159
169
|
|
|
160
170
|
for (var _i = 0, _a = Object.getOwnPropertyNames(options); _i < _a.length; _i++) {
|
|
161
|
-
var name_1 = _a[_i];
|
|
171
|
+
var name_1 = _a[_i]; //@ts-ignore
|
|
162
172
|
|
|
163
173
|
if (options[name_1] !== undefined) {
|
|
174
|
+
//@ts-ignore
|
|
164
175
|
target[name_1] = options[name_1];
|
|
165
176
|
}
|
|
166
177
|
}
|
|
@@ -176,7 +187,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
176
187
|
if (this.map) {
|
|
177
188
|
var googleMarker_1;
|
|
178
189
|
|
|
179
|
-
if (marker.element) {
|
|
190
|
+
if (marker.element && marker.element instanceof Element) {
|
|
180
191
|
var options = {
|
|
181
192
|
map: this.map,
|
|
182
193
|
position: marker.options.position
|
|
@@ -207,6 +218,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
207
218
|
};
|
|
208
219
|
|
|
209
220
|
GoogleMintMapController.prototype.updateMarker = function (marker, options) {
|
|
221
|
+
//console.log('controller updateMarker', options);
|
|
210
222
|
var _a, _b;
|
|
211
223
|
|
|
212
224
|
if (marker && marker.native) {
|
|
@@ -216,8 +228,9 @@ var GoogleMintMapController = function (_super) {
|
|
|
216
228
|
if (map) {
|
|
217
229
|
marker.native.setOptions({
|
|
218
230
|
map: map,
|
|
219
|
-
position: options.position instanceof
|
|
220
|
-
visible: options.visible === undefined || options.visible
|
|
231
|
+
position: options.position instanceof MapTypes.Position ? options.position : marker.native.getPosition(),
|
|
232
|
+
visible: options.visible === undefined || options.visible // icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
233
|
+
|
|
221
234
|
});
|
|
222
235
|
}
|
|
223
236
|
} else if (marker.native instanceof google.maps.marker.AdvancedMarkerView) {
|
|
@@ -225,7 +238,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
225
238
|
marker.native.element.style.visibility = options.visible ? 'visible' : 'hidden';
|
|
226
239
|
}
|
|
227
240
|
|
|
228
|
-
if (options.position instanceof
|
|
241
|
+
if (options.position instanceof MapTypes.Position && (((_a = marker.native.position) === null || _a === void 0 ? void 0 : _a.lat) != options.position.lat || ((_b = marker.native.position) === null || _b === void 0 ? void 0 : _b.lng) != options.position.lng)) {
|
|
229
242
|
marker.native.position = options.position;
|
|
230
243
|
}
|
|
231
244
|
}
|
|
@@ -313,7 +326,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
313
326
|
GoogleMintMapController.prototype.checkLoaded = function () {
|
|
314
327
|
var _a, _b, _c;
|
|
315
328
|
|
|
316
|
-
return (_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.marker) === null || _c === void 0 ? void 0 : _c.AdvancedMarkerView;
|
|
329
|
+
return ((_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.marker) === null || _c === void 0 ? void 0 : _c.AdvancedMarkerView) ? true : false;
|
|
317
330
|
};
|
|
318
331
|
|
|
319
332
|
GoogleMintMapController.prototype.loadMapApi = function () {
|
|
@@ -321,17 +334,21 @@ var GoogleMintMapController = function (_super) {
|
|
|
321
334
|
var _this = this;
|
|
322
335
|
|
|
323
336
|
return tslib.__generator(this, function (_a) {
|
|
324
|
-
return [2
|
|
337
|
+
return [2
|
|
338
|
+
/*return*/
|
|
339
|
+
, new Promise(function (resolve) {
|
|
325
340
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
326
341
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
327
342
|
return tslib.__generator(this, function (_a) {
|
|
328
343
|
switch (_a.label) {
|
|
329
344
|
case 0:
|
|
330
345
|
callbackName = this.getRandomFunctionName('load_google');
|
|
331
|
-
loaded = false;
|
|
346
|
+
loaded = false; //@ts-ignore
|
|
332
347
|
|
|
333
348
|
window[callbackName] = function () {
|
|
334
|
-
|
|
349
|
+
// console.log('google api loaded');
|
|
350
|
+
loaded = true; //@ts-ignore
|
|
351
|
+
|
|
335
352
|
delete window[callbackName];
|
|
336
353
|
};
|
|
337
354
|
|
|
@@ -341,17 +358,23 @@ var GoogleMintMapController = function (_super) {
|
|
|
341
358
|
v: 'beta',
|
|
342
359
|
callback: callbackName
|
|
343
360
|
};
|
|
344
|
-
return [4
|
|
361
|
+
return [4
|
|
362
|
+
/*yield*/
|
|
363
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
|
|
345
364
|
|
|
346
365
|
case 1:
|
|
347
366
|
callbackExecFlag = _a.sent();
|
|
348
367
|
|
|
349
368
|
if (!callbackExecFlag) {
|
|
350
|
-
loaded
|
|
369
|
+
// console.log('google api loaded 222222');
|
|
370
|
+
loaded = true; //@ts-ignore
|
|
371
|
+
|
|
351
372
|
delete window[callbackName];
|
|
352
373
|
}
|
|
353
374
|
|
|
354
|
-
return [4
|
|
375
|
+
return [4
|
|
376
|
+
/*yield*/
|
|
377
|
+
, waiting.waiting(function () {
|
|
355
378
|
return loaded;
|
|
356
379
|
})];
|
|
357
380
|
|
|
@@ -364,7 +387,9 @@ var GoogleMintMapController = function (_super) {
|
|
|
364
387
|
|
|
365
388
|
this.mapApiLoaded = true;
|
|
366
389
|
resolve(true);
|
|
367
|
-
return [2
|
|
390
|
+
return [2
|
|
391
|
+
/*return*/
|
|
392
|
+
];
|
|
368
393
|
}
|
|
369
394
|
});
|
|
370
395
|
});
|
|
@@ -378,8 +403,11 @@ var GoogleMintMapController = function (_super) {
|
|
|
378
403
|
var _this = this;
|
|
379
404
|
|
|
380
405
|
return tslib.__generator(this, function (_a) {
|
|
406
|
+
//div element
|
|
381
407
|
this.mapDivElement = divElement;
|
|
382
|
-
return [2
|
|
408
|
+
return [2
|
|
409
|
+
/*return*/
|
|
410
|
+
, new Promise(function (resolve) {
|
|
383
411
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
384
412
|
var map;
|
|
385
413
|
|
|
@@ -390,15 +418,24 @@ var GoogleMintMapController = function (_super) {
|
|
|
390
418
|
return tslib.__generator(this, function (_e) {
|
|
391
419
|
switch (_e.label) {
|
|
392
420
|
case 0:
|
|
421
|
+
//이미 생성했으면
|
|
422
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
423
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
393
424
|
if (this.mapInitialized && this.map) {
|
|
394
425
|
if (this.map.getDiv() === divElement) {
|
|
395
426
|
resolve(this.map);
|
|
396
|
-
return [2
|
|
427
|
+
return [2
|
|
428
|
+
/*return*/
|
|
429
|
+
];
|
|
397
430
|
}
|
|
398
431
|
}
|
|
399
432
|
|
|
400
|
-
if (!!this.mapApiLoaded) return [3
|
|
401
|
-
|
|
433
|
+
if (!!this.mapApiLoaded) return [3
|
|
434
|
+
/*break*/
|
|
435
|
+
, 2];
|
|
436
|
+
return [4
|
|
437
|
+
/*yield*/
|
|
438
|
+
, this.loadMapApi()];
|
|
402
439
|
|
|
403
440
|
case 1:
|
|
404
441
|
_e.sent();
|
|
@@ -417,30 +454,39 @@ var GoogleMintMapController = function (_super) {
|
|
|
417
454
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
418
455
|
clickableIcons: false
|
|
419
456
|
});
|
|
420
|
-
this.map = map;
|
|
457
|
+
this.map = map; //@ts-ignore
|
|
458
|
+
|
|
421
459
|
map.addListener('idle', function () {
|
|
460
|
+
//onBoundsChanged event
|
|
422
461
|
_this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
423
462
|
});
|
|
424
463
|
map.addListener('zoom_changed', function () {
|
|
425
|
-
|
|
426
|
-
|
|
464
|
+
//onZoomChanged event
|
|
465
|
+
// console.log('zoom_changed');
|
|
466
|
+
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom() || 10);
|
|
467
|
+
}); //@ts-ignore
|
|
468
|
+
|
|
427
469
|
map.addListener('click', function (e) {
|
|
470
|
+
// console.log('map click', e)
|
|
428
471
|
if (!_this.mapProps.onClick) return;
|
|
429
|
-
var pos = new
|
|
430
|
-
pos.offset = new
|
|
472
|
+
var pos = new MapTypes.Position(e.latLng.lat(), e.latLng.lng());
|
|
473
|
+
pos.offset = new MapTypes.Offset(e.pixel.x, e.pixel.y);
|
|
431
474
|
|
|
432
475
|
_this.mapProps.onClick(pos);
|
|
433
476
|
});
|
|
434
477
|
map.addListener('mousemove', function (e) {
|
|
435
478
|
if (!_this.mapProps.onMouseMove) return;
|
|
436
|
-
var pos = new
|
|
437
|
-
pos.offset = new
|
|
479
|
+
var pos = new MapTypes.Position(e.latLng.lat(), e.latLng.lng());
|
|
480
|
+
pos.offset = new MapTypes.Offset(e.pixel.x, e.pixel.y); // console.log('mousemove', pos)
|
|
438
481
|
|
|
439
482
|
_this.mapProps.onMouseMove(pos);
|
|
440
483
|
});
|
|
441
|
-
this.mapInitialized = true;
|
|
484
|
+
this.mapInitialized = true; // console.log(`${this.type} map script initialized`, divElement);
|
|
485
|
+
|
|
442
486
|
resolve(map);
|
|
443
|
-
return [2
|
|
487
|
+
return [2
|
|
488
|
+
/*return*/
|
|
489
|
+
];
|
|
444
490
|
}
|
|
445
491
|
});
|
|
446
492
|
});
|
|
@@ -450,7 +496,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
450
496
|
};
|
|
451
497
|
|
|
452
498
|
GoogleMintMapController.prototype.fromGoogleBounds = function (bounds) {
|
|
453
|
-
return
|
|
499
|
+
return MapTypes.Bounds.fromNESW(new MapTypes.Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()), new MapTypes.Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()));
|
|
454
500
|
};
|
|
455
501
|
|
|
456
502
|
GoogleMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -463,7 +509,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
463
509
|
if (bounds) {
|
|
464
510
|
return this.fromGoogleBounds(bounds);
|
|
465
511
|
} else {
|
|
466
|
-
throw new Error('bounds is not found!!!');
|
|
512
|
+
throw new Error('bounds is not found!!!'); //return new Bounds(new Position(0,0), new Position(0,0))
|
|
467
513
|
}
|
|
468
514
|
};
|
|
469
515
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from './MintMap';
|
|
2
|
-
export * from './core';
|
|
3
|
-
export * from './naver/NaverMintMapController';
|
|
4
|
-
export * from './google/GoogleMintMapController';
|
|
1
|
+
export * from './MintMap';
|
|
2
|
+
export * from './core';
|
|
3
|
+
export * from './naver/NaverMintMapController';
|
|
4
|
+
export * from './google/GoogleMintMapController';
|
|
5
|
+
export * from './types';
|
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
/// <reference types="kakaomaps" />
|
|
2
|
-
import { MintMapController } from "../core/MintMapController";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
/// <reference types="kakaomaps" />
|
|
2
|
+
import { MintMapController } from "../core/MintMapController";
|
|
3
|
+
import { ObjectPool } from '@mint-ui/tools';
|
|
4
|
+
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
5
|
+
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
6
|
+
import { Bounds, Position } from "../types/MapTypes";
|
|
7
|
+
import { MintMapProps } from "../types/MintMapProps";
|
|
8
|
+
export declare class KakaoMintMapController extends MintMapController {
|
|
9
|
+
type: MapType;
|
|
10
|
+
map: kakao.maps.Map | null;
|
|
11
|
+
scriptUrl: string;
|
|
12
|
+
scriptModules: string[];
|
|
13
|
+
markerPool?: ObjectPool<kakao.maps.CustomOverlay>;
|
|
14
|
+
constructor(props: MintMapProps);
|
|
15
|
+
private initMarkerPool;
|
|
16
|
+
polylineEvents: string[];
|
|
17
|
+
createPolyline(polyline: Polyline): void;
|
|
18
|
+
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
19
|
+
polygonEvents: string[];
|
|
20
|
+
createPolygon(polygon: Polygon): void;
|
|
21
|
+
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
22
|
+
markerEvents: string[];
|
|
23
|
+
createMarker(marker: Marker): void;
|
|
24
|
+
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
25
|
+
private removeParentElementsMargin;
|
|
26
|
+
private markerMaxZIndex;
|
|
27
|
+
private getMaxZIndex;
|
|
28
|
+
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
29
|
+
markerToTheTop(marker: Marker): void;
|
|
30
|
+
clearDrawable(drawable: Drawable): boolean;
|
|
31
|
+
private dragStartPoint;
|
|
32
|
+
private dragged;
|
|
33
|
+
isMapDragged(): boolean;
|
|
34
|
+
setMapDragged(value: boolean): void;
|
|
35
|
+
private checkLoaded;
|
|
36
|
+
loadMapApi(): Promise<boolean>;
|
|
37
|
+
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
38
|
+
private getSafeZoomValue;
|
|
39
|
+
destroyMap(): void;
|
|
40
|
+
getCurrBounds(): Bounds;
|
|
41
|
+
panningTo(targetCenter: Position): void;
|
|
42
|
+
getZoomLevel(): number;
|
|
43
|
+
setZoomLevel(zoom: number): void;
|
|
44
|
+
getCenter(): Position;
|
|
45
|
+
setCenter(position: Position): void;
|
|
46
|
+
private positionToLatLng;
|
|
47
|
+
private latLngToPosition;
|
|
48
|
+
}
|