@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,10 +5,12 @@ 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
10
|
|
|
11
|
-
var KakaoMintMapController =
|
|
11
|
+
var KakaoMintMapController =
|
|
12
|
+
/** @class */
|
|
13
|
+
function (_super) {
|
|
12
14
|
tslib.__extends(KakaoMintMapController, _super);
|
|
13
15
|
|
|
14
16
|
function KakaoMintMapController(props) {
|
|
@@ -23,21 +25,30 @@ var KakaoMintMapController = function (_super) {
|
|
|
23
25
|
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
24
26
|
_this.dragStartPoint = [0, 0];
|
|
25
27
|
_this.dragged = false;
|
|
26
|
-
return _this;
|
|
28
|
+
return _this; // console.log(`${this.type} controller loadded`);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
KakaoMintMapController.prototype.initMarkerPool = function () {
|
|
30
32
|
var _this = this;
|
|
31
33
|
|
|
32
|
-
if (!this.mapProps.markerCache) return;
|
|
33
|
-
|
|
34
|
+
if (!this.mapProps.markerCache) return; //marker pool setting
|
|
35
|
+
|
|
36
|
+
this.markerPool = new tools.ObjectPool() //logging on
|
|
37
|
+
//.setLog(true)
|
|
38
|
+
//factory 셋팅
|
|
39
|
+
.setFactory(function () {
|
|
40
|
+
//console.log('pool item created');
|
|
34
41
|
return new kakao.maps.CustomOverlay({
|
|
35
|
-
position: _this.positionToLatLng(new
|
|
42
|
+
position: _this.positionToLatLng(new MapTypes.Position(0, 0)),
|
|
36
43
|
map: _this.map || undefined
|
|
37
44
|
});
|
|
38
|
-
})
|
|
45
|
+
}) //clear function 셋팅
|
|
46
|
+
.setClear(function (item) {
|
|
47
|
+
//console.log('pool item cleared');
|
|
39
48
|
item.setMap(null);
|
|
40
|
-
})
|
|
49
|
+
}) //초기 pool 사이즈
|
|
50
|
+
.createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000) //TTL 체크 간격 (기본 5초)
|
|
51
|
+
.setCheckLiveTimeInterval(1000);
|
|
41
52
|
};
|
|
42
53
|
|
|
43
54
|
KakaoMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -53,11 +64,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
53
64
|
lineOpacity = _d === void 0 ? 1 : _d;
|
|
54
65
|
_a.visible;
|
|
55
66
|
_a.editable;
|
|
56
|
-
var event = _a.event;
|
|
67
|
+
var event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
57
68
|
|
|
58
69
|
if (this.map && Array.isArray(position)) {
|
|
59
70
|
var path = position.map(function (elem) {
|
|
60
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
71
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
61
72
|
});
|
|
62
73
|
var pol_1 = new kakao.maps.Polyline({
|
|
63
74
|
map: this.map,
|
|
@@ -65,7 +76,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
65
76
|
strokeColor: lineColor,
|
|
66
77
|
strokeWeight: lineSize,
|
|
67
78
|
strokeOpacity: lineOpacity
|
|
68
|
-
});
|
|
79
|
+
}); // if(editable){
|
|
80
|
+
// //@ts-ignore
|
|
81
|
+
// this.drawingManager.addDrawing(pol, kakao.maps.drawing.DrawingMode.POLYLINE)
|
|
82
|
+
// }
|
|
83
|
+
|
|
69
84
|
polyline.native = pol_1;
|
|
70
85
|
event && event.forEach(function (handler, key) {
|
|
71
86
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -76,19 +91,22 @@ var KakaoMintMapController = function (_super) {
|
|
|
76
91
|
};
|
|
77
92
|
|
|
78
93
|
KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
94
|
+
//console.log('controller updatePolyline', options);
|
|
79
95
|
var _this = this;
|
|
80
96
|
|
|
81
97
|
if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
|
|
98
|
+
//console.log('controller updatePolyline start');
|
|
82
99
|
var path = void 0;
|
|
83
100
|
|
|
84
101
|
if (Array.isArray(options.position)) {
|
|
85
102
|
path = options.position.map(function (elem) {
|
|
86
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
103
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
87
104
|
});
|
|
88
105
|
}
|
|
89
106
|
|
|
90
107
|
polyline.native.setOptions({
|
|
91
108
|
path: path || polyline.native.getPath(),
|
|
109
|
+
//visible:options.visible === undefined || options.visible,
|
|
92
110
|
strokeColor: options.lineColor,
|
|
93
111
|
strokeWeight: options.lineSize,
|
|
94
112
|
strokeOpacity: options.lineOpacity
|
|
@@ -114,15 +132,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
114
132
|
fillOpacity = _f === void 0 ? 0.5 : _f;
|
|
115
133
|
_a.visible;
|
|
116
134
|
_a.editable;
|
|
117
|
-
var event = _a.event;
|
|
135
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
118
136
|
|
|
119
137
|
if (this.map && Array.isArray(position)) {
|
|
120
138
|
var outLine = position.map(function (elem) {
|
|
121
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
139
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
122
140
|
});
|
|
123
141
|
var path = [outLine];
|
|
124
|
-
innerPositions && path.push(innerPositions.map(function (inner) {
|
|
125
|
-
return
|
|
142
|
+
innerPositions && path.push.apply(path, innerPositions.map(function (inner) {
|
|
143
|
+
return inner.map(function (innerItem) {
|
|
144
|
+
return _this.positionToLatLng(innerItem);
|
|
145
|
+
});
|
|
126
146
|
}));
|
|
127
147
|
var pol_2 = new kakao.maps.Polygon({
|
|
128
148
|
map: this.map,
|
|
@@ -131,8 +151,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
131
151
|
strokeWeight: lineSize,
|
|
132
152
|
strokeOpacity: lineOpacity,
|
|
133
153
|
fillColor: fillColor,
|
|
134
|
-
fillOpacity: fillOpacity
|
|
135
|
-
|
|
154
|
+
fillOpacity: fillOpacity // clickable:true,
|
|
155
|
+
// visible:visible,
|
|
156
|
+
|
|
157
|
+
}); //@ts-ignore
|
|
158
|
+
//pol.setEditable(editable)
|
|
159
|
+
|
|
136
160
|
polygon.native = pol_2;
|
|
137
161
|
event && event.forEach(function (handler, key) {
|
|
138
162
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -143,29 +167,35 @@ var KakaoMintMapController = function (_super) {
|
|
|
143
167
|
};
|
|
144
168
|
|
|
145
169
|
KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
170
|
+
//console.log('controller updatePolygon', options);
|
|
146
171
|
var _this = this;
|
|
147
172
|
|
|
148
173
|
if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
|
|
174
|
+
//console.log('controller updatePolygon start');
|
|
149
175
|
var paths = void 0;
|
|
150
176
|
|
|
151
177
|
if (Array.isArray(options.position)) {
|
|
152
178
|
var outLine = options.position.map(function (elem) {
|
|
153
|
-
return _this.positionToLatLng(Array.isArray(elem) ? new
|
|
179
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem);
|
|
154
180
|
});
|
|
155
181
|
paths = [outLine];
|
|
156
182
|
options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
|
|
157
|
-
return
|
|
183
|
+
return inner.map(function (innerItem) {
|
|
184
|
+
return _this.positionToLatLng(innerItem);
|
|
185
|
+
});
|
|
158
186
|
}));
|
|
159
187
|
}
|
|
160
188
|
|
|
161
189
|
polygon.native.setOptions({
|
|
162
190
|
path: paths || polygon.native.getPath(),
|
|
191
|
+
// visible:options.visible === undefined || options.visible,
|
|
163
192
|
strokeColor: options.lineColor,
|
|
164
193
|
strokeWeight: options.lineSize,
|
|
165
194
|
strokeOpacity: options.lineOpacity,
|
|
166
195
|
fillColor: options.fillColor,
|
|
167
196
|
fillOpacity: options.fillOpacity
|
|
168
|
-
});
|
|
197
|
+
}); //@ts-ignore
|
|
198
|
+
// options.editable !== undefined && polygon.native.setEditable(options.editable)
|
|
169
199
|
}
|
|
170
200
|
};
|
|
171
201
|
|
|
@@ -177,8 +207,10 @@ var KakaoMintMapController = function (_super) {
|
|
|
177
207
|
if (this.map) {
|
|
178
208
|
var options = {
|
|
179
209
|
map: this.map,
|
|
180
|
-
position: this.positionToLatLng(marker.options.position)
|
|
181
|
-
|
|
210
|
+
position: this.positionToLatLng(marker.options.position) // visible:marker.options.visible === undefined || marker.options.visible,
|
|
211
|
+
|
|
212
|
+
}; //console.log('controller createMarker', marker.options);
|
|
213
|
+
|
|
182
214
|
marker.element && (options.content = marker.element);
|
|
183
215
|
var kakaoMarker_1;
|
|
184
216
|
|
|
@@ -191,7 +223,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
191
223
|
} else {
|
|
192
224
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
193
225
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
194
|
-
marker
|
|
226
|
+
this.removeParentElementsMargin(marker);
|
|
195
227
|
marker.native = kakaoMarker_1;
|
|
196
228
|
}
|
|
197
229
|
|
|
@@ -204,11 +236,13 @@ var KakaoMintMapController = function (_super) {
|
|
|
204
236
|
};
|
|
205
237
|
|
|
206
238
|
KakaoMintMapController.prototype.updateMarker = function (marker, options) {
|
|
239
|
+
//console.log('controller updateMarker', options);
|
|
207
240
|
if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
|
|
208
241
|
var map = marker.native.getMap();
|
|
209
242
|
|
|
210
243
|
if (map) {
|
|
211
|
-
|
|
244
|
+
//Position
|
|
245
|
+
if (options.position && options.position instanceof MapTypes.Position) {
|
|
212
246
|
marker.native.setPosition(this.positionToLatLng(options.position));
|
|
213
247
|
}
|
|
214
248
|
|
|
@@ -216,11 +250,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
216
250
|
marker.native.setVisible(options.visible);
|
|
217
251
|
}
|
|
218
252
|
|
|
219
|
-
marker
|
|
253
|
+
this.removeParentElementsMargin(marker);
|
|
220
254
|
}
|
|
221
255
|
}
|
|
222
256
|
};
|
|
223
257
|
|
|
258
|
+
KakaoMintMapController.prototype.removeParentElementsMargin = function (marker) {
|
|
259
|
+
//맵 별로 offset 통일을 위해서 margin 제거
|
|
260
|
+
marker.element && marker.element instanceof HTMLElement && marker.element.parentElement && (marker.element.parentElement.style.margin = '0');
|
|
261
|
+
};
|
|
262
|
+
|
|
224
263
|
KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
|
|
225
264
|
if (increment === void 0) {
|
|
226
265
|
increment = 0;
|
|
@@ -230,14 +269,16 @@ var KakaoMintMapController = function (_super) {
|
|
|
230
269
|
var targetPane = parent.parentElement;
|
|
231
270
|
var max = 0;
|
|
232
271
|
|
|
233
|
-
|
|
234
|
-
var
|
|
272
|
+
if (targetPane) {
|
|
273
|
+
for (var i = 0; i < targetPane.childElementCount; i++) {
|
|
274
|
+
var elem = targetPane.children[i];
|
|
235
275
|
|
|
236
|
-
|
|
237
|
-
|
|
276
|
+
if (elem instanceof HTMLElement) {
|
|
277
|
+
var index = Number(elem.style.zIndex);
|
|
238
278
|
|
|
239
|
-
|
|
240
|
-
|
|
279
|
+
if (!isNaN(index) && index > max) {
|
|
280
|
+
max = index;
|
|
281
|
+
}
|
|
241
282
|
}
|
|
242
283
|
}
|
|
243
284
|
}
|
|
@@ -308,7 +349,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
308
349
|
KakaoMintMapController.prototype.checkLoaded = function () {
|
|
309
350
|
var _a, _b;
|
|
310
351
|
|
|
311
|
-
return (_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
352
|
+
return ((_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
312
353
|
};
|
|
313
354
|
|
|
314
355
|
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
@@ -316,7 +357,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
316
357
|
var _this = this;
|
|
317
358
|
|
|
318
359
|
return tslib.__generator(this, function (_a) {
|
|
319
|
-
return [2
|
|
360
|
+
return [2
|
|
361
|
+
/*return*/
|
|
362
|
+
, new Promise(function (resolve) {
|
|
320
363
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
321
364
|
var params, ok;
|
|
322
365
|
|
|
@@ -330,13 +373,17 @@ var KakaoMintMapController = function (_super) {
|
|
|
330
373
|
libraries: this.scriptModules.join(','),
|
|
331
374
|
autoload: false
|
|
332
375
|
};
|
|
333
|
-
return [4
|
|
376
|
+
return [4
|
|
377
|
+
/*yield*/
|
|
378
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
|
|
334
379
|
|
|
335
380
|
case 1:
|
|
336
381
|
_a.sent();
|
|
337
382
|
|
|
338
|
-
window.kakao.maps.load();
|
|
339
|
-
return [4
|
|
383
|
+
window.kakao.maps.load(function () {});
|
|
384
|
+
return [4
|
|
385
|
+
/*yield*/
|
|
386
|
+
, waiting.waiting(function () {
|
|
340
387
|
return _this.checkLoaded() ? true : false;
|
|
341
388
|
})];
|
|
342
389
|
|
|
@@ -349,7 +396,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
349
396
|
|
|
350
397
|
this.mapApiLoaded = true;
|
|
351
398
|
resolve(true);
|
|
352
|
-
return [2
|
|
399
|
+
return [2
|
|
400
|
+
/*return*/
|
|
401
|
+
];
|
|
353
402
|
}
|
|
354
403
|
});
|
|
355
404
|
});
|
|
@@ -364,7 +413,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
364
413
|
|
|
365
414
|
return tslib.__generator(this, function (_a) {
|
|
366
415
|
this.mapDivElement = divElement;
|
|
367
|
-
return [2
|
|
416
|
+
return [2
|
|
417
|
+
/*return*/
|
|
418
|
+
, new Promise(function (resolve) {
|
|
368
419
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
369
420
|
var options, maxZoom, minZoom, map;
|
|
370
421
|
|
|
@@ -375,17 +426,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
375
426
|
return tslib.__generator(this, function (_e) {
|
|
376
427
|
switch (_e.label) {
|
|
377
428
|
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()];
|
|
429
|
+
if (!!this.mapApiLoaded) return [3
|
|
430
|
+
/*break*/
|
|
431
|
+
, 2];
|
|
432
|
+
return [4
|
|
433
|
+
/*yield*/
|
|
434
|
+
, this.loadMapApi()];
|
|
389
435
|
|
|
390
436
|
case 1:
|
|
391
437
|
_e.sent();
|
|
@@ -395,7 +441,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
395
441
|
case 2:
|
|
396
442
|
options = {
|
|
397
443
|
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),
|
|
444
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 10),
|
|
399
445
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
400
446
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
401
447
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -418,31 +464,58 @@ var KakaoMintMapController = function (_super) {
|
|
|
418
464
|
map = new kakao.maps.Map(divElement, options);
|
|
419
465
|
map.setMaxLevel(minZoom);
|
|
420
466
|
map.setMinLevel(maxZoom);
|
|
421
|
-
this.map = map;
|
|
467
|
+
this.map = map; //@ts-ignore
|
|
468
|
+
// map.addListener('dragstart', (e)=>{
|
|
469
|
+
// //console.log('map dragstart', e);
|
|
470
|
+
// this.dragStartPoint[0] = e.domEvent.clientX
|
|
471
|
+
// this.dragStartPoint[1] = e.domEvent.clientY
|
|
472
|
+
// })
|
|
473
|
+
//@ts-ignore
|
|
474
|
+
// map.addListener('dragend', (e)=>{
|
|
475
|
+
// //console.log('map dragend', e);
|
|
476
|
+
// if(this.dragStartPoint[0] === e.domEvent.clientX && this.dragStartPoint[1] === e.domEvent.clientY){
|
|
477
|
+
// this.dragged = false
|
|
478
|
+
// }else{
|
|
479
|
+
// this.dragged = true
|
|
480
|
+
// }
|
|
481
|
+
// //console.log('map dragend', this.dragged)
|
|
482
|
+
// })
|
|
483
|
+
//@ts-ignore
|
|
484
|
+
|
|
422
485
|
map.addListener('idle', function (e) {
|
|
486
|
+
//onBoundsChanged event
|
|
423
487
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
424
|
-
});
|
|
488
|
+
}); //@ts-ignore
|
|
489
|
+
|
|
425
490
|
map.addListener('zoom_changed', function () {
|
|
491
|
+
//onZoomChanged event
|
|
492
|
+
//console.log('zoom_changed');
|
|
426
493
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
|
|
427
|
-
});
|
|
494
|
+
}); //@ts-ignore
|
|
495
|
+
|
|
428
496
|
map.addListener('click', function (e) {
|
|
497
|
+
// console.log('map click', e);
|
|
429
498
|
if (!_this.mapProps.onClick) return;
|
|
430
|
-
var pos = new
|
|
431
|
-
pos.offset = new
|
|
499
|
+
var pos = new MapTypes.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
500
|
+
pos.offset = new MapTypes.Offset(e.point.x, e.point.y);
|
|
432
501
|
|
|
433
502
|
_this.mapProps.onClick(pos);
|
|
434
|
-
});
|
|
503
|
+
}); //@ts-ignore
|
|
504
|
+
|
|
435
505
|
map.addListener('mousemove', function (e) {
|
|
436
506
|
if (!_this.mapProps.onMouseMove) return;
|
|
437
|
-
var pos = new
|
|
438
|
-
pos.offset = new
|
|
507
|
+
var pos = new MapTypes.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
508
|
+
pos.offset = new MapTypes.Offset(e.point.x, e.point.y); // console.log('mousemove', pos)
|
|
439
509
|
|
|
440
510
|
_this.mapProps.onMouseMove(pos);
|
|
441
511
|
});
|
|
442
512
|
this.mapInitialized = true;
|
|
443
|
-
this.initMarkerPool();
|
|
513
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
514
|
+
|
|
444
515
|
resolve(map);
|
|
445
|
-
return [2
|
|
516
|
+
return [2
|
|
517
|
+
/*return*/
|
|
518
|
+
];
|
|
446
519
|
}
|
|
447
520
|
});
|
|
448
521
|
});
|
|
@@ -452,6 +525,14 @@ var KakaoMintMapController = function (_super) {
|
|
|
452
525
|
};
|
|
453
526
|
|
|
454
527
|
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
528
|
+
/**
|
|
529
|
+
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
530
|
+
* - 가장 확대된 값 : 1
|
|
531
|
+
* - 가장 축소된 값 : 14
|
|
532
|
+
*
|
|
533
|
+
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
534
|
+
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
535
|
+
*/
|
|
455
536
|
var mapValue = this.getBaseToMapZoom(value);
|
|
456
537
|
|
|
457
538
|
if (mapValue > 14) {
|
|
@@ -470,7 +551,8 @@ var KakaoMintMapController = function (_super) {
|
|
|
470
551
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
471
552
|
} catch (e) {
|
|
472
553
|
console.log('kakao map destroy error', e);
|
|
473
|
-
}
|
|
554
|
+
} // console.log(`${this.type} map destroyed`);
|
|
555
|
+
|
|
474
556
|
};
|
|
475
557
|
|
|
476
558
|
KakaoMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -479,7 +561,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
479
561
|
}
|
|
480
562
|
|
|
481
563
|
var bounds = this.map.getBounds();
|
|
482
|
-
return
|
|
564
|
+
return MapTypes.Bounds.fromNESW(this.latLngToPosition(bounds.getNorthEast()), this.latLngToPosition(bounds.getSouthWest()));
|
|
483
565
|
};
|
|
484
566
|
|
|
485
567
|
KakaoMintMapController.prototype.panningTo = function (targetCenter) {
|
|
@@ -509,11 +591,11 @@ var KakaoMintMapController = function (_super) {
|
|
|
509
591
|
};
|
|
510
592
|
|
|
511
593
|
KakaoMintMapController.prototype.positionToLatLng = function (pos) {
|
|
512
|
-
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) :
|
|
594
|
+
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : new kakao.maps.LatLng(0, 0);
|
|
513
595
|
};
|
|
514
596
|
|
|
515
597
|
KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
|
|
516
|
-
return latLng ? new
|
|
598
|
+
return latLng ? new MapTypes.Position(latLng.getLat(), latLng.getLng()) : new MapTypes.Position(0, 0);
|
|
517
599
|
};
|
|
518
600
|
|
|
519
601
|
return KakaoMintMapController;
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
/// <reference types="navermaps" />
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
/// <reference types="navermaps" />
|
|
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 NaverMintMapController extends MintMapController {
|
|
9
|
+
type: MapType;
|
|
10
|
+
map: naver.maps.Map | null;
|
|
11
|
+
scriptUrl: string;
|
|
12
|
+
scriptModules: string[];
|
|
13
|
+
markerPool?: ObjectPool<naver.maps.Marker>;
|
|
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 markerMaxZIndex;
|
|
26
|
+
private getMaxZIndex;
|
|
27
|
+
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
28
|
+
markerToTheTop(marker: Marker): void;
|
|
29
|
+
clearDrawable(drawable: Drawable): boolean;
|
|
30
|
+
private dragStartPoint;
|
|
31
|
+
private dragged;
|
|
32
|
+
isMapDragged(): boolean;
|
|
33
|
+
setMapDragged(value: boolean): void;
|
|
34
|
+
private checkLoaded;
|
|
35
|
+
loadMapApi(): Promise<boolean>;
|
|
36
|
+
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
37
|
+
private getSafeZoomValue;
|
|
38
|
+
destroyMap(): void;
|
|
39
|
+
getCurrBounds(): Bounds;
|
|
40
|
+
panningTo(targetCenter: Position): void;
|
|
41
|
+
getZoomLevel(): number;
|
|
42
|
+
setZoomLevel(zoom: number): void;
|
|
43
|
+
getCenter(): Position;
|
|
44
|
+
setCenter(position: Position): void;
|
|
45
|
+
}
|