@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.
- 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 +64 -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 +3 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -0
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +137 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +188 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +54 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +152 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +60 -0
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -0
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +21 -9
- 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 +66 -34
- package/dist/components/mint-map/core/util/calculate.js +233 -27
- 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 +32 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +76 -28
- 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 +51 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +224 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +265 -66
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +53 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +237 -50
- 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/MapEventTypes.d.ts +41 -0
- package/dist/components/mint-map/types/MapEventTypes.js +57 -0
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -0
- package/dist/components/mint-map/types/MapTypes.js +155 -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 +6 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +2638 -975
- package/dist/index.js +25 -9
- package/dist/index.umd.js +2644 -974
- package/package.json +77 -77
- package/test.ts +0 -7
|
@@ -5,10 +5,13 @@ 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 MintMap = require('../MintMap.js');
|
|
9
8
|
var tools = require('@mint-ui/tools');
|
|
9
|
+
var MapTypes = require('../types/MapTypes.js');
|
|
10
|
+
var MapEventTypes = require('../types/MapEventTypes.js');
|
|
10
11
|
|
|
11
|
-
var KakaoMintMapController =
|
|
12
|
+
var KakaoMintMapController =
|
|
13
|
+
/** @class */
|
|
14
|
+
function (_super) {
|
|
12
15
|
tslib.__extends(KakaoMintMapController, _super);
|
|
13
16
|
|
|
14
17
|
function KakaoMintMapController(props) {
|
|
@@ -17,27 +20,44 @@ var KakaoMintMapController = function (_super) {
|
|
|
17
20
|
_this.type = 'kakao';
|
|
18
21
|
_this.map = null;
|
|
19
22
|
_this.scriptUrl = 'https://dapi.kakao.com/v2/maps/sdk.js';
|
|
20
|
-
_this.scriptModules = ['services', 'clusterer'];
|
|
23
|
+
_this.scriptModules = ['services', 'clusterer']; // , 'geocoder' , 'panorama' , 'visualization']
|
|
24
|
+
|
|
25
|
+
_this.mapEvent = new MapEventTypes.MapEvent();
|
|
26
|
+
_this.mapUIEvent = new MapEventTypes.MapUIEvent();
|
|
21
27
|
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
22
28
|
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
23
29
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
24
30
|
_this.dragStartPoint = [0, 0];
|
|
25
31
|
_this.dragged = false;
|
|
26
|
-
|
|
32
|
+
_this.eventMap = new Map(); //kakao only 이벤트이름 재정의 zoom_start
|
|
33
|
+
|
|
34
|
+
_this.mapEvent.ZOOMSTART = 'zoom_start';
|
|
35
|
+
Object.freeze(_this.mapEvent);
|
|
36
|
+
Object.freeze(_this.mapUIEvent);
|
|
37
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
KakaoMintMapController.prototype.initMarkerPool = function () {
|
|
30
41
|
var _this = this;
|
|
31
42
|
|
|
32
|
-
if (!this.mapProps.markerCache) return;
|
|
33
|
-
|
|
43
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
44
|
+
|
|
45
|
+
this.markerPool = new tools.ObjectPool() //logging on
|
|
46
|
+
//.setLog(true)
|
|
47
|
+
//factory 셋팅
|
|
48
|
+
.setFactory(function () {
|
|
49
|
+
//console.log('pool item created');
|
|
34
50
|
return new kakao.maps.CustomOverlay({
|
|
35
|
-
position: _this.positionToLatLng(new
|
|
51
|
+
position: _this.positionToLatLng(new MapTypes.Position(0, 0)),
|
|
36
52
|
map: _this.map || undefined
|
|
37
53
|
});
|
|
38
|
-
})
|
|
54
|
+
}) //clear function 셋팅
|
|
55
|
+
.setClear(function (item) {
|
|
56
|
+
//console.log('pool item cleared');
|
|
39
57
|
item.setMap(null);
|
|
40
|
-
})
|
|
58
|
+
}) //초기 pool 사이즈
|
|
59
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
60
|
+
.setCheckLiveTimeInterval(1000);
|
|
41
61
|
};
|
|
42
62
|
|
|
43
63
|
KakaoMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -53,11 +73,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
53
73
|
lineOpacity = _d === void 0 ? 1 : _d;
|
|
54
74
|
_a.visible;
|
|
55
75
|
_a.editable;
|
|
56
|
-
var event = _a.event;
|
|
76
|
+
var event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
57
77
|
|
|
58
78
|
if (this.map && Array.isArray(position)) {
|
|
59
79
|
var path = position.map(function (elem) {
|
|
60
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
80
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
61
81
|
});
|
|
62
82
|
var pol_1 = new kakao.maps.Polyline({
|
|
63
83
|
map: this.map,
|
|
@@ -65,7 +85,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
65
85
|
strokeColor: lineColor,
|
|
66
86
|
strokeWeight: lineSize,
|
|
67
87
|
strokeOpacity: lineOpacity
|
|
68
|
-
});
|
|
88
|
+
}); // if(editable){
|
|
89
|
+
// //@ts-ignore
|
|
90
|
+
// this.drawingManager.addDrawing(pol, kakao.maps.drawing.DrawingMode.POLYLINE)
|
|
91
|
+
// }
|
|
92
|
+
|
|
69
93
|
polyline.native = pol_1;
|
|
70
94
|
event && event.forEach(function (handler, key) {
|
|
71
95
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -76,19 +100,22 @@ var KakaoMintMapController = function (_super) {
|
|
|
76
100
|
};
|
|
77
101
|
|
|
78
102
|
KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
103
|
+
//console.log('controller updatePolyline', options);
|
|
79
104
|
var _this = this;
|
|
80
105
|
|
|
81
106
|
if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
|
|
107
|
+
//console.log('controller updatePolyline start');
|
|
82
108
|
var path = void 0;
|
|
83
109
|
|
|
84
110
|
if (Array.isArray(options.position)) {
|
|
85
111
|
path = options.position.map(function (elem) {
|
|
86
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
112
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
87
113
|
});
|
|
88
114
|
}
|
|
89
115
|
|
|
90
116
|
polyline.native.setOptions({
|
|
91
117
|
path: path || polyline.native.getPath(),
|
|
118
|
+
//visible:options.visible === undefined || options.visible,
|
|
92
119
|
strokeColor: options.lineColor,
|
|
93
120
|
strokeWeight: options.lineSize,
|
|
94
121
|
strokeOpacity: options.lineOpacity
|
|
@@ -114,15 +141,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
114
141
|
fillOpacity = _f === void 0 ? 0.5 : _f;
|
|
115
142
|
_a.visible;
|
|
116
143
|
_a.editable;
|
|
117
|
-
var event = _a.event;
|
|
144
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
118
145
|
|
|
119
146
|
if (this.map && Array.isArray(position)) {
|
|
120
147
|
var outLine = position.map(function (elem) {
|
|
121
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
148
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
122
149
|
});
|
|
123
150
|
var path = [outLine];
|
|
124
|
-
innerPositions && path.push(innerPositions.map(function (inner) {
|
|
125
|
-
return
|
|
151
|
+
innerPositions && path.push.apply(path, innerPositions.map(function (inner) {
|
|
152
|
+
return inner.map(function (innerItem) {
|
|
153
|
+
return _this.positionToLatLng(innerItem);
|
|
154
|
+
});
|
|
126
155
|
}));
|
|
127
156
|
var pol_2 = new kakao.maps.Polygon({
|
|
128
157
|
map: this.map,
|
|
@@ -131,8 +160,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
131
160
|
strokeWeight: lineSize,
|
|
132
161
|
strokeOpacity: lineOpacity,
|
|
133
162
|
fillColor: fillColor,
|
|
134
|
-
fillOpacity: fillOpacity
|
|
135
|
-
|
|
163
|
+
fillOpacity: fillOpacity // clickable:true,
|
|
164
|
+
// visible:visible,
|
|
165
|
+
|
|
166
|
+
}); //@ts-ignore
|
|
167
|
+
//pol.setEditable(editable)
|
|
168
|
+
|
|
136
169
|
polygon.native = pol_2;
|
|
137
170
|
event && event.forEach(function (handler, key) {
|
|
138
171
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -143,29 +176,35 @@ var KakaoMintMapController = function (_super) {
|
|
|
143
176
|
};
|
|
144
177
|
|
|
145
178
|
KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
179
|
+
//console.log('controller updatePolygon', options);
|
|
146
180
|
var _this = this;
|
|
147
181
|
|
|
148
182
|
if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
|
|
183
|
+
//console.log('controller updatePolygon start');
|
|
149
184
|
var paths = void 0;
|
|
150
185
|
|
|
151
186
|
if (Array.isArray(options.position)) {
|
|
152
187
|
var outLine = options.position.map(function (elem) {
|
|
153
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
188
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
154
189
|
});
|
|
155
190
|
paths = [outLine];
|
|
156
191
|
options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
|
|
157
|
-
return
|
|
192
|
+
return inner.map(function (innerItem) {
|
|
193
|
+
return _this.positionToLatLng(innerItem);
|
|
194
|
+
});
|
|
158
195
|
}));
|
|
159
196
|
}
|
|
160
197
|
|
|
161
198
|
polygon.native.setOptions({
|
|
162
199
|
path: paths || polygon.native.getPath(),
|
|
200
|
+
// visible:options.visible === undefined || options.visible,
|
|
163
201
|
strokeColor: options.lineColor,
|
|
164
202
|
strokeWeight: options.lineSize,
|
|
165
203
|
strokeOpacity: options.lineOpacity,
|
|
166
204
|
fillColor: options.fillColor,
|
|
167
205
|
fillOpacity: options.fillOpacity
|
|
168
|
-
});
|
|
206
|
+
}); //@ts-ignore
|
|
207
|
+
// options.editable !== undefined && polygon.native.setEditable(options.editable)
|
|
169
208
|
}
|
|
170
209
|
};
|
|
171
210
|
|
|
@@ -177,8 +216,10 @@ var KakaoMintMapController = function (_super) {
|
|
|
177
216
|
if (this.map) {
|
|
178
217
|
var options = {
|
|
179
218
|
map: this.map,
|
|
180
|
-
position: this.positionToLatLng(marker.options.position)
|
|
181
|
-
|
|
219
|
+
position: this.positionToLatLng(marker.options.position) // visible:marker.options.visible === undefined || marker.options.visible,
|
|
220
|
+
|
|
221
|
+
}; //console.log('controller createMarker', marker.options);
|
|
222
|
+
|
|
182
223
|
marker.element && (options.content = marker.element);
|
|
183
224
|
var kakaoMarker_1;
|
|
184
225
|
|
|
@@ -191,7 +232,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
191
232
|
} else {
|
|
192
233
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
193
234
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
194
|
-
marker
|
|
235
|
+
this.removeParentElementsMargin(marker);
|
|
195
236
|
marker.native = kakaoMarker_1;
|
|
196
237
|
}
|
|
197
238
|
|
|
@@ -204,11 +245,13 @@ var KakaoMintMapController = function (_super) {
|
|
|
204
245
|
};
|
|
205
246
|
|
|
206
247
|
KakaoMintMapController.prototype.updateMarker = function (marker, options) {
|
|
248
|
+
//console.log('controller updateMarker', options);
|
|
207
249
|
if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
|
|
208
250
|
var map = marker.native.getMap();
|
|
209
251
|
|
|
210
252
|
if (map) {
|
|
211
|
-
|
|
253
|
+
//Position
|
|
254
|
+
if (options.position && options.position instanceof MapTypes.Position) {
|
|
212
255
|
marker.native.setPosition(this.positionToLatLng(options.position));
|
|
213
256
|
}
|
|
214
257
|
|
|
@@ -216,11 +259,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
216
259
|
marker.native.setVisible(options.visible);
|
|
217
260
|
}
|
|
218
261
|
|
|
219
|
-
marker
|
|
262
|
+
this.removeParentElementsMargin(marker);
|
|
220
263
|
}
|
|
221
264
|
}
|
|
222
265
|
};
|
|
223
266
|
|
|
267
|
+
KakaoMintMapController.prototype.removeParentElementsMargin = function (marker) {
|
|
268
|
+
//맵 별로 offset 통일을 위해서 margin 제거
|
|
269
|
+
marker.element && marker.element instanceof HTMLElement && marker.element.parentElement && (marker.element.parentElement.style.margin = '0');
|
|
270
|
+
};
|
|
271
|
+
|
|
224
272
|
KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
|
|
225
273
|
if (increment === void 0) {
|
|
226
274
|
increment = 0;
|
|
@@ -230,14 +278,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
230
278
|
var targetPane = parent.parentElement;
|
|
231
279
|
var max = 0;
|
|
232
280
|
|
|
233
|
-
|
|
234
|
-
var
|
|
281
|
+
if (targetPane) {
|
|
282
|
+
for (var i = 0; i < targetPane.childElementCount; i++) {
|
|
283
|
+
var elem = targetPane.children[i];
|
|
235
284
|
|
|
236
|
-
|
|
237
|
-
|
|
285
|
+
if (elem instanceof HTMLElement) {
|
|
286
|
+
var index = Number(elem.style.zIndex);
|
|
238
287
|
|
|
239
|
-
|
|
240
|
-
|
|
288
|
+
if (!isNaN(index) && index > max) {
|
|
289
|
+
max = index;
|
|
290
|
+
}
|
|
241
291
|
}
|
|
242
292
|
}
|
|
243
293
|
}
|
|
@@ -308,7 +358,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
308
358
|
KakaoMintMapController.prototype.checkLoaded = function () {
|
|
309
359
|
var _a, _b;
|
|
310
360
|
|
|
311
|
-
return (_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
361
|
+
return ((_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
312
362
|
};
|
|
313
363
|
|
|
314
364
|
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
@@ -316,7 +366,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
316
366
|
var _this = this;
|
|
317
367
|
|
|
318
368
|
return tslib.__generator(this, function (_a) {
|
|
319
|
-
return [2
|
|
369
|
+
return [2
|
|
370
|
+
/*return*/
|
|
371
|
+
, new Promise(function (resolve) {
|
|
320
372
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
321
373
|
var params, ok;
|
|
322
374
|
|
|
@@ -330,13 +382,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
330
382
|
libraries: this.scriptModules.join(','),
|
|
331
383
|
autoload: false
|
|
332
384
|
};
|
|
333
|
-
return [4
|
|
385
|
+
return [4
|
|
386
|
+
/*yield*/
|
|
387
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
|
|
334
388
|
|
|
335
389
|
case 1:
|
|
336
390
|
_a.sent();
|
|
337
391
|
|
|
338
|
-
window.kakao.maps.load();
|
|
339
|
-
return [4
|
|
392
|
+
window.kakao.maps.load(function () {});
|
|
393
|
+
return [4
|
|
394
|
+
/*yield*/
|
|
395
|
+
, waiting.waiting(function () {
|
|
340
396
|
return _this.checkLoaded() ? true : false;
|
|
341
397
|
})];
|
|
342
398
|
|
|
@@ -349,7 +405,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
349
405
|
|
|
350
406
|
this.mapApiLoaded = true;
|
|
351
407
|
resolve(true);
|
|
352
|
-
return [2
|
|
408
|
+
return [2
|
|
409
|
+
/*return*/
|
|
410
|
+
];
|
|
353
411
|
}
|
|
354
412
|
});
|
|
355
413
|
});
|
|
@@ -364,7 +422,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
364
422
|
|
|
365
423
|
return tslib.__generator(this, function (_a) {
|
|
366
424
|
this.mapDivElement = divElement;
|
|
367
|
-
return [2
|
|
425
|
+
return [2
|
|
426
|
+
/*return*/
|
|
427
|
+
, new Promise(function (resolve) {
|
|
368
428
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
369
429
|
var options, maxZoom, minZoom, map;
|
|
370
430
|
|
|
@@ -375,17 +435,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
375
435
|
return tslib.__generator(this, function (_e) {
|
|
376
436
|
switch (_e.label) {
|
|
377
437
|
case 0:
|
|
378
|
-
if (this.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (!!this.mapApiLoaded) return [3, 2];
|
|
388
|
-
return [4, this.loadMapApi()];
|
|
438
|
+
if (!!this.mapApiLoaded) return [3
|
|
439
|
+
/*break*/
|
|
440
|
+
, 2];
|
|
441
|
+
return [4
|
|
442
|
+
/*yield*/
|
|
443
|
+
, this.loadMapApi()];
|
|
389
444
|
|
|
390
445
|
case 1:
|
|
391
446
|
_e.sent();
|
|
@@ -395,7 +450,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
395
450
|
case 2:
|
|
396
451
|
options = {
|
|
397
452
|
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
398
|
-
level: this.getBaseToMapZoom((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel),
|
|
453
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
|
|
399
454
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
400
455
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
401
456
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -418,31 +473,58 @@ var KakaoMintMapController = function (_super) {
|
|
|
418
473
|
map = new kakao.maps.Map(divElement, options);
|
|
419
474
|
map.setMaxLevel(minZoom);
|
|
420
475
|
map.setMinLevel(maxZoom);
|
|
421
|
-
this.map = map;
|
|
476
|
+
this.map = map; //@ts-ignore
|
|
477
|
+
// map.addListener('dragstart', (e)=>{
|
|
478
|
+
// //console.log('map dragstart', e);
|
|
479
|
+
// this.dragStartPoint[0] = e.domEvent.clientX
|
|
480
|
+
// this.dragStartPoint[1] = e.domEvent.clientY
|
|
481
|
+
// })
|
|
482
|
+
//@ts-ignore
|
|
483
|
+
// map.addListener('dragend', (e)=>{
|
|
484
|
+
// //console.log('map dragend', e);
|
|
485
|
+
// if(this.dragStartPoint[0] === e.domEvent.clientX && this.dragStartPoint[1] === e.domEvent.clientY){
|
|
486
|
+
// this.dragged = false
|
|
487
|
+
// }else{
|
|
488
|
+
// this.dragged = true
|
|
489
|
+
// }
|
|
490
|
+
// //console.log('map dragend', this.dragged)
|
|
491
|
+
// })
|
|
492
|
+
//@ts-ignore
|
|
493
|
+
|
|
422
494
|
map.addListener('idle', function (e) {
|
|
495
|
+
//onBoundsChanged event
|
|
423
496
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
424
|
-
});
|
|
497
|
+
}); //@ts-ignore
|
|
498
|
+
|
|
425
499
|
map.addListener('zoom_changed', function () {
|
|
500
|
+
//onZoomChanged event
|
|
501
|
+
//console.log('zoom_changed');
|
|
426
502
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
|
|
427
|
-
});
|
|
503
|
+
}); //@ts-ignore
|
|
504
|
+
|
|
428
505
|
map.addListener('click', function (e) {
|
|
506
|
+
// console.log('map click', e);
|
|
429
507
|
if (!_this.mapProps.onClick) return;
|
|
430
|
-
var pos = new
|
|
431
|
-
pos.offset = new
|
|
508
|
+
var pos = new MapTypes.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
509
|
+
pos.offset = new MapTypes.Offset(e.point.x, e.point.y);
|
|
432
510
|
|
|
433
511
|
_this.mapProps.onClick(pos);
|
|
434
|
-
});
|
|
512
|
+
}); //@ts-ignore
|
|
513
|
+
|
|
435
514
|
map.addListener('mousemove', function (e) {
|
|
436
515
|
if (!_this.mapProps.onMouseMove) return;
|
|
437
|
-
var pos = new
|
|
438
|
-
pos.offset = new
|
|
516
|
+
var pos = new MapTypes.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
517
|
+
pos.offset = new MapTypes.Offset(e.point.x, e.point.y); // console.log('mousemove', pos)
|
|
439
518
|
|
|
440
519
|
_this.mapProps.onMouseMove(pos);
|
|
441
520
|
});
|
|
442
521
|
this.mapInitialized = true;
|
|
443
|
-
this.initMarkerPool();
|
|
522
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
523
|
+
|
|
444
524
|
resolve(map);
|
|
445
|
-
return [2
|
|
525
|
+
return [2
|
|
526
|
+
/*return*/
|
|
527
|
+
];
|
|
446
528
|
}
|
|
447
529
|
});
|
|
448
530
|
});
|
|
@@ -452,6 +534,14 @@ var KakaoMintMapController = function (_super) {
|
|
|
452
534
|
};
|
|
453
535
|
|
|
454
536
|
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
537
|
+
/**
|
|
538
|
+
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
539
|
+
* - 가장 확대된 값 : 1
|
|
540
|
+
* - 가장 축소된 값 : 14
|
|
541
|
+
*
|
|
542
|
+
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
543
|
+
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
544
|
+
*/
|
|
455
545
|
var mapValue = this.getBaseToMapZoom(value);
|
|
456
546
|
|
|
457
547
|
if (mapValue > 14) {
|
|
@@ -470,7 +560,8 @@ var KakaoMintMapController = function (_super) {
|
|
|
470
560
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
471
561
|
} catch (e) {
|
|
472
562
|
console.log('kakao map destroy error', e);
|
|
473
|
-
}
|
|
563
|
+
} // console.log(`${this.type} map destroyed`);
|
|
564
|
+
|
|
474
565
|
};
|
|
475
566
|
|
|
476
567
|
KakaoMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -479,7 +570,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
479
570
|
}
|
|
480
571
|
|
|
481
572
|
var bounds = this.map.getBounds();
|
|
482
|
-
return
|
|
573
|
+
return MapTypes.Bounds.fromNESW(this.latLngToPosition(bounds.getNorthEast()), this.latLngToPosition(bounds.getSouthWest()));
|
|
483
574
|
};
|
|
484
575
|
|
|
485
576
|
KakaoMintMapController.prototype.panningTo = function (targetCenter) {
|
|
@@ -509,11 +600,119 @@ var KakaoMintMapController = function (_super) {
|
|
|
509
600
|
};
|
|
510
601
|
|
|
511
602
|
KakaoMintMapController.prototype.positionToLatLng = function (pos) {
|
|
512
|
-
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) :
|
|
603
|
+
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : new kakao.maps.LatLng(0, 0);
|
|
513
604
|
};
|
|
514
605
|
|
|
515
606
|
KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
|
|
516
|
-
return latLng ? new
|
|
607
|
+
return latLng ? new MapTypes.Position(latLng.getLat(), latLng.getLng()) : new MapTypes.Position(0, 0);
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
611
|
+
var _this = this;
|
|
612
|
+
|
|
613
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
614
|
+
|
|
615
|
+
if (!kakaoEventName) {
|
|
616
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
617
|
+
return;
|
|
618
|
+
} // console.log(`${eventName} add`);
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
var map = this.eventMap.get(eventName);
|
|
622
|
+
|
|
623
|
+
if (!map) {
|
|
624
|
+
map = new Map();
|
|
625
|
+
this.eventMap.set(eventName, map);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
var wrappingCallback = function (e) {
|
|
629
|
+
if (eventName in _this.mapEvent) {
|
|
630
|
+
var bounds = _this.getCurrBounds();
|
|
631
|
+
|
|
632
|
+
var param = {
|
|
633
|
+
name: eventName,
|
|
634
|
+
mapType: 'kakao',
|
|
635
|
+
vendorEventName: kakaoEventName,
|
|
636
|
+
param: {
|
|
637
|
+
bounds: bounds,
|
|
638
|
+
center: bounds.getCenter(),
|
|
639
|
+
zoomLevel: _this.getZoomLevel()
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
callback(param);
|
|
643
|
+
} else if (eventName in _this.mapUIEvent) {
|
|
644
|
+
var position = new MapTypes.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
645
|
+
position.offset = new MapTypes.Offset(e.point.x, e.point.y);
|
|
646
|
+
var param = {
|
|
647
|
+
name: eventName,
|
|
648
|
+
mapType: 'kakao',
|
|
649
|
+
vendorEventName: kakaoEventName,
|
|
650
|
+
param: {
|
|
651
|
+
position: position,
|
|
652
|
+
offset: position.offset
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
callback(param);
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
kakao.maps.event.addListener(this.map, kakaoEventName, wrappingCallback);
|
|
660
|
+
map.set(callback, wrappingCallback);
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
KakaoMintMapController.prototype.removeEventListener = function (eventName, callback) {
|
|
664
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
665
|
+
|
|
666
|
+
if (!kakaoEventName) {
|
|
667
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
var map = this.eventMap.get(eventName);
|
|
672
|
+
|
|
673
|
+
if (map) {
|
|
674
|
+
var wrappingCallback = map.get(callback);
|
|
675
|
+
|
|
676
|
+
if (wrappingCallback) {
|
|
677
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
678
|
+
kakao.maps.event.removeListener(this.map, kakaoEventName, wrappingCallback);
|
|
679
|
+
map.delete(callback);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
KakaoMintMapController.prototype.removeAllEventListener = function (eventName) {
|
|
685
|
+
var _this = this;
|
|
686
|
+
|
|
687
|
+
if (eventName) {
|
|
688
|
+
this.clearEventListener(eventName);
|
|
689
|
+
} else {
|
|
690
|
+
this.eventMap.forEach(function (_map, eventName) {
|
|
691
|
+
_this.clearEventListener(eventName);
|
|
692
|
+
});
|
|
693
|
+
this.eventMap.clear();
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
KakaoMintMapController.prototype.clearEventListener = function (eventName) {
|
|
698
|
+
var _this = this;
|
|
699
|
+
|
|
700
|
+
var kakaoEventName = this.mapEvent.get(eventName) || this.mapUIEvent.get(eventName);
|
|
701
|
+
|
|
702
|
+
if (!kakaoEventName) {
|
|
703
|
+
console.warn("MapEventName ".concat(eventName, " is not supported"));
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
var map = this.eventMap.get(eventName);
|
|
708
|
+
|
|
709
|
+
if (map) {
|
|
710
|
+
map.forEach(function (wrappingCallback) {
|
|
711
|
+
// console.log(`${naverEventListener.eventName} remove`);
|
|
712
|
+
kakao.maps.event.removeListener(_this.map, kakaoEventName, wrappingCallback);
|
|
713
|
+
});
|
|
714
|
+
this.eventMap.delete(eventName);
|
|
715
|
+
}
|
|
517
716
|
};
|
|
518
717
|
|
|
519
718
|
return KakaoMintMapController;
|