@mint-ui/map 0.4.4-beta → 0.4.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +91 -45
- 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 +1506 -947
- package/dist/index.js +12 -9
- package/dist/index.umd.js +1506 -947
- 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 NaverMintMapController =
|
|
11
|
+
var NaverMintMapController =
|
|
12
|
+
/** @class */
|
|
13
|
+
function (_super) {
|
|
12
14
|
tslib.__extends(NaverMintMapController, _super);
|
|
13
15
|
|
|
14
16
|
function NaverMintMapController(props) {
|
|
@@ -23,21 +25,30 @@ var NaverMintMapController = 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
|
NaverMintMapController.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 naver.maps.Marker({
|
|
35
|
-
position: new
|
|
42
|
+
position: 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
|
NaverMintMapController.prototype.createPolyline = function (polyline) {
|
|
@@ -55,11 +66,11 @@ var NaverMintMapController = function (_super) {
|
|
|
55
66
|
visible = _e === void 0 ? true : _e,
|
|
56
67
|
_f = _a.editable,
|
|
57
68
|
editable = _f === void 0 ? false : _f,
|
|
58
|
-
event = _a.event;
|
|
69
|
+
event = _a.event; //console.log('controller createPolyline start', polyline);
|
|
59
70
|
|
|
60
71
|
if (this.map && Array.isArray(position)) {
|
|
61
72
|
var path = position.map(function (elem) {
|
|
62
|
-
return Array.isArray(elem) ? new
|
|
73
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
63
74
|
});
|
|
64
75
|
var pol_1 = new naver.maps.Polyline({
|
|
65
76
|
map: this.map,
|
|
@@ -69,8 +80,13 @@ var NaverMintMapController = function (_super) {
|
|
|
69
80
|
strokeOpacity: lineOpacity,
|
|
70
81
|
clickable: true,
|
|
71
82
|
visible: visible
|
|
72
|
-
});
|
|
73
|
-
|
|
83
|
+
}); //@ts-ignore
|
|
84
|
+
|
|
85
|
+
editable && pol_1.setEditable(editable); // if(editable){
|
|
86
|
+
// //@ts-ignore
|
|
87
|
+
// this.drawingManager.addDrawing(pol, naver.maps.drawing.DrawingMode.POLYLINE)
|
|
88
|
+
// }
|
|
89
|
+
|
|
74
90
|
polyline.native = pol_1;
|
|
75
91
|
event && event.forEach(function (handler, key) {
|
|
76
92
|
if (_this.polylineEvents.includes(key)) {
|
|
@@ -81,12 +97,14 @@ var NaverMintMapController = function (_super) {
|
|
|
81
97
|
};
|
|
82
98
|
|
|
83
99
|
NaverMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
100
|
+
//console.log('controller updatePolyline', options);
|
|
84
101
|
if (polyline && polyline.native && polyline.native instanceof naver.maps.Polyline) {
|
|
102
|
+
//console.log('controller updatePolyline start');
|
|
85
103
|
var path = void 0;
|
|
86
104
|
|
|
87
105
|
if (Array.isArray(options.position)) {
|
|
88
106
|
path = options.position.map(function (elem) {
|
|
89
|
-
return Array.isArray(elem) ? new
|
|
107
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
90
108
|
});
|
|
91
109
|
}
|
|
92
110
|
|
|
@@ -96,7 +114,8 @@ var NaverMintMapController = function (_super) {
|
|
|
96
114
|
strokeColor: options.lineColor,
|
|
97
115
|
strokeWeight: options.lineSize,
|
|
98
116
|
strokeOpacity: options.lineOpacity
|
|
99
|
-
});
|
|
117
|
+
}); //@ts-ignore
|
|
118
|
+
|
|
100
119
|
options.editable !== undefined && polyline.native.setEditable(options.editable);
|
|
101
120
|
}
|
|
102
121
|
};
|
|
@@ -120,11 +139,11 @@ var NaverMintMapController = function (_super) {
|
|
|
120
139
|
_g = _a.visible,
|
|
121
140
|
visible = _g === void 0 ? true : _g;
|
|
122
141
|
_a.editable;
|
|
123
|
-
var event = _a.event;
|
|
142
|
+
var event = _a.event; //console.log('polygon', polygon);
|
|
124
143
|
|
|
125
144
|
if (this.map && Array.isArray(position)) {
|
|
126
145
|
var outLine = position.map(function (elem) {
|
|
127
|
-
return Array.isArray(elem) ? new
|
|
146
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
128
147
|
});
|
|
129
148
|
var paths = [outLine];
|
|
130
149
|
innerPositions && paths.push.apply(paths, innerPositions);
|
|
@@ -138,7 +157,9 @@ var NaverMintMapController = function (_super) {
|
|
|
138
157
|
fillOpacity: fillOpacity,
|
|
139
158
|
clickable: true,
|
|
140
159
|
visible: visible
|
|
141
|
-
});
|
|
160
|
+
}); //@ts-ignore
|
|
161
|
+
//pol.setEditable(editable)
|
|
162
|
+
|
|
142
163
|
polygon.native = pol_2;
|
|
143
164
|
event && event.forEach(function (handler, key) {
|
|
144
165
|
if (_this.polygonEvents.includes(key)) {
|
|
@@ -149,12 +170,14 @@ var NaverMintMapController = function (_super) {
|
|
|
149
170
|
};
|
|
150
171
|
|
|
151
172
|
NaverMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
173
|
+
//console.log('controller updatePolygon', options);
|
|
152
174
|
if (polygon && polygon.native && polygon.native instanceof naver.maps.Polygon) {
|
|
175
|
+
//console.log('controller updatePolygon start');
|
|
153
176
|
var paths = void 0;
|
|
154
177
|
|
|
155
178
|
if (Array.isArray(options.position)) {
|
|
156
179
|
var outLine = options.position.map(function (elem) {
|
|
157
|
-
return Array.isArray(elem) ? new
|
|
180
|
+
return Array.isArray(elem) ? new MapTypes.Position(elem[1], elem[0]) : elem;
|
|
158
181
|
});
|
|
159
182
|
paths = [outLine];
|
|
160
183
|
options.innerPositions && paths.push.apply(paths, options.innerPositions);
|
|
@@ -168,7 +191,8 @@ var NaverMintMapController = function (_super) {
|
|
|
168
191
|
strokeOpacity: options.lineOpacity,
|
|
169
192
|
fillColor: options.fillColor,
|
|
170
193
|
fillOpacity: options.fillOpacity
|
|
171
|
-
});
|
|
194
|
+
}); //@ts-ignore
|
|
195
|
+
|
|
172
196
|
options.editable !== undefined && polygon.native.setEditable(options.editable);
|
|
173
197
|
}
|
|
174
198
|
};
|
|
@@ -183,7 +207,8 @@ var NaverMintMapController = function (_super) {
|
|
|
183
207
|
map: this.map,
|
|
184
208
|
position: marker.options.position,
|
|
185
209
|
visible: marker.options.visible === undefined || marker.options.visible
|
|
186
|
-
};
|
|
210
|
+
}; //console.log('controller createMarker', marker.options);
|
|
211
|
+
|
|
187
212
|
marker.element && (options.icon = {
|
|
188
213
|
content: marker.element,
|
|
189
214
|
anchor: marker.options.anchor
|
|
@@ -210,11 +235,19 @@ var NaverMintMapController = function (_super) {
|
|
|
210
235
|
};
|
|
211
236
|
|
|
212
237
|
NaverMintMapController.prototype.updateMarker = function (marker, options) {
|
|
238
|
+
//console.log('controller updateMarker', options);
|
|
213
239
|
if (marker && marker.native && marker.native instanceof naver.maps.Marker) {
|
|
214
240
|
var map = marker.native.getMap();
|
|
215
241
|
|
|
216
242
|
if (map) {
|
|
217
|
-
|
|
243
|
+
/** 중요!!!!
|
|
244
|
+
* naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
|
|
245
|
+
* setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
|
|
246
|
+
* (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
|
|
247
|
+
* 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
|
|
248
|
+
*/
|
|
249
|
+
//Position
|
|
250
|
+
if (options.position && options.position instanceof MapTypes.Position) {
|
|
218
251
|
marker.native.setPosition(options.position);
|
|
219
252
|
}
|
|
220
253
|
|
|
@@ -226,7 +259,21 @@ var NaverMintMapController = function (_super) {
|
|
|
226
259
|
marker.native.setIcon(tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
|
|
227
260
|
anchor: options.anchor
|
|
228
261
|
}));
|
|
229
|
-
}
|
|
262
|
+
} // const newOption = {
|
|
263
|
+
// map:map,
|
|
264
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
265
|
+
// visible:options.visible === undefined || options.visible,
|
|
266
|
+
// } as naver.maps.MarkerOptions
|
|
267
|
+
// if(options.anchor){
|
|
268
|
+
// newOption.icon = {...marker.native.getIcon(), anchor:options.anchor}
|
|
269
|
+
// }
|
|
270
|
+
// marker.native.setOptions({
|
|
271
|
+
// map:map,
|
|
272
|
+
// position:options.position instanceof Position?options.position:marker.native.getPosition(),
|
|
273
|
+
// visible:options.visible === undefined || options.visible,
|
|
274
|
+
// icon:{...marker.native.getIcon(), anchor:options.anchor}
|
|
275
|
+
// })
|
|
276
|
+
|
|
230
277
|
}
|
|
231
278
|
}
|
|
232
279
|
};
|
|
@@ -306,7 +353,7 @@ var NaverMintMapController = function (_super) {
|
|
|
306
353
|
NaverMintMapController.prototype.checkLoaded = function () {
|
|
307
354
|
var _a, _b;
|
|
308
355
|
|
|
309
|
-
return (_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
356
|
+
return ((_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) ? true : false;
|
|
310
357
|
};
|
|
311
358
|
|
|
312
359
|
NaverMintMapController.prototype.loadMapApi = function () {
|
|
@@ -314,17 +361,21 @@ var NaverMintMapController = function (_super) {
|
|
|
314
361
|
var _this = this;
|
|
315
362
|
|
|
316
363
|
return tslib.__generator(this, function (_a) {
|
|
317
|
-
return [2
|
|
364
|
+
return [2
|
|
365
|
+
/*return*/
|
|
366
|
+
, new Promise(function (resolve, error) {
|
|
318
367
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
319
368
|
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
320
369
|
return tslib.__generator(this, function (_a) {
|
|
321
370
|
switch (_a.label) {
|
|
322
371
|
case 0:
|
|
323
372
|
callbackName = this.getRandomFunctionName('load_naver');
|
|
324
|
-
loaded = false;
|
|
373
|
+
loaded = false; //@ts-ignore
|
|
325
374
|
|
|
326
375
|
window[callbackName] = function () {
|
|
327
|
-
|
|
376
|
+
// console.log('naver api loaded');
|
|
377
|
+
loaded = true; //@ts-ignore
|
|
378
|
+
|
|
328
379
|
delete window[callbackName];
|
|
329
380
|
};
|
|
330
381
|
|
|
@@ -333,17 +384,22 @@ var NaverMintMapController = function (_super) {
|
|
|
333
384
|
submodules: this.scriptModules.join(','),
|
|
334
385
|
callback: callbackName
|
|
335
386
|
};
|
|
336
|
-
return [4
|
|
387
|
+
return [4
|
|
388
|
+
/*yield*/
|
|
389
|
+
, this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
|
|
337
390
|
|
|
338
391
|
case 1:
|
|
339
392
|
callbackExecFlag = _a.sent();
|
|
340
393
|
|
|
341
394
|
if (!callbackExecFlag) {
|
|
342
|
-
loaded = true;
|
|
395
|
+
loaded = true; //@ts-ignore
|
|
396
|
+
|
|
343
397
|
delete window[callbackName];
|
|
344
398
|
}
|
|
345
399
|
|
|
346
|
-
return [4
|
|
400
|
+
return [4
|
|
401
|
+
/*yield*/
|
|
402
|
+
, waiting.waiting(function () {
|
|
347
403
|
return loaded;
|
|
348
404
|
})];
|
|
349
405
|
|
|
@@ -356,7 +412,9 @@ var NaverMintMapController = function (_super) {
|
|
|
356
412
|
|
|
357
413
|
this.mapApiLoaded = true;
|
|
358
414
|
resolve(true);
|
|
359
|
-
return [2
|
|
415
|
+
return [2
|
|
416
|
+
/*return*/
|
|
417
|
+
];
|
|
360
418
|
}
|
|
361
419
|
});
|
|
362
420
|
});
|
|
@@ -370,8 +428,11 @@ var NaverMintMapController = function (_super) {
|
|
|
370
428
|
var _this = this;
|
|
371
429
|
|
|
372
430
|
return tslib.__generator(this, function (_a) {
|
|
431
|
+
//div element
|
|
373
432
|
this.mapDivElement = divElement;
|
|
374
|
-
return [2
|
|
433
|
+
return [2
|
|
434
|
+
/*return*/
|
|
435
|
+
, new Promise(function (resolve) {
|
|
375
436
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
376
437
|
var options, maxZoom, minZoom, map;
|
|
377
438
|
|
|
@@ -382,17 +443,26 @@ var NaverMintMapController = function (_super) {
|
|
|
382
443
|
return tslib.__generator(this, function (_e) {
|
|
383
444
|
switch (_e.label) {
|
|
384
445
|
case 0:
|
|
446
|
+
//이미 생성했으면
|
|
447
|
+
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
448
|
+
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
385
449
|
if (this.mapInitialized && this.map) {
|
|
386
450
|
if (this.map.getElement() === divElement) {
|
|
387
451
|
resolve(this.map);
|
|
388
|
-
return [2
|
|
452
|
+
return [2
|
|
453
|
+
/*return*/
|
|
454
|
+
];
|
|
389
455
|
} else {
|
|
390
456
|
this.map.destroy();
|
|
391
457
|
}
|
|
392
458
|
}
|
|
393
459
|
|
|
394
|
-
if (!!this.mapApiLoaded) return [3
|
|
395
|
-
|
|
460
|
+
if (!!this.mapApiLoaded) return [3
|
|
461
|
+
/*break*/
|
|
462
|
+
, 2];
|
|
463
|
+
return [4
|
|
464
|
+
/*yield*/
|
|
465
|
+
, this.loadMapApi()];
|
|
396
466
|
|
|
397
467
|
case 1:
|
|
398
468
|
_e.sent();
|
|
@@ -429,43 +499,59 @@ var NaverMintMapController = function (_super) {
|
|
|
429
499
|
options.minZoom = minZoom;
|
|
430
500
|
options.maxZoom = maxZoom;
|
|
431
501
|
map = new naver.maps.Map(divElement, options);
|
|
432
|
-
this.map = map;
|
|
502
|
+
this.map = map; //@ts-ignore
|
|
503
|
+
|
|
433
504
|
map.addListener('dragstart', function (e) {
|
|
505
|
+
//console.log('map dragstart', e);
|
|
434
506
|
_this.dragStartPoint[0] = e.domEvent.clientX;
|
|
435
507
|
_this.dragStartPoint[1] = e.domEvent.clientY;
|
|
436
|
-
});
|
|
508
|
+
}); //@ts-ignore
|
|
509
|
+
|
|
437
510
|
map.addListener('dragend', function (e) {
|
|
511
|
+
//console.log('map dragend', e);
|
|
438
512
|
if (_this.dragStartPoint[0] === e.domEvent.clientX && _this.dragStartPoint[1] === e.domEvent.clientY) {
|
|
439
513
|
_this.dragged = false;
|
|
440
514
|
} else {
|
|
441
515
|
_this.dragged = true;
|
|
442
|
-
}
|
|
443
|
-
|
|
516
|
+
} //console.log('map dragend', this.dragged)
|
|
517
|
+
|
|
518
|
+
}); //@ts-ignore
|
|
519
|
+
|
|
444
520
|
map.addListener('idle', function (e) {
|
|
521
|
+
//onBoundsChanged event
|
|
445
522
|
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
446
523
|
});
|
|
447
524
|
map.addListener('zoom_changed', function () {
|
|
525
|
+
//onZoomChanged event
|
|
526
|
+
//console.log('zoom_changed');
|
|
448
527
|
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom());
|
|
449
|
-
});
|
|
528
|
+
}); //@ts-ignore
|
|
529
|
+
|
|
450
530
|
map.addListener('click', function (e) {
|
|
531
|
+
// console.log('map click', e);
|
|
451
532
|
if (!_this.mapProps.onClick) return;
|
|
452
|
-
var pos = new
|
|
453
|
-
pos.offset = new
|
|
533
|
+
var pos = new MapTypes.Position(e.coord.y, e.coord.x);
|
|
534
|
+
pos.offset = new MapTypes.Offset(e.offset.x, e.offset.y);
|
|
454
535
|
|
|
455
536
|
_this.mapProps.onClick(pos);
|
|
456
|
-
});
|
|
537
|
+
}); //@ts-ignore
|
|
538
|
+
|
|
457
539
|
map.addListener('mousemove', function (e) {
|
|
458
540
|
if (!_this.mapProps.onMouseMove) return;
|
|
459
|
-
var pos = new
|
|
460
|
-
pos.offset = new
|
|
541
|
+
var pos = new MapTypes.Position(e.coord.y, e.coord.x);
|
|
542
|
+
pos.offset = new MapTypes.Offset(e.offset.x, e.offset.y); // console.log('mousemove', pos)
|
|
461
543
|
|
|
462
544
|
_this.mapProps.onMouseMove(pos);
|
|
463
545
|
});
|
|
464
546
|
this.mapInitialized = true;
|
|
465
|
-
this.initMarkerPool();
|
|
466
|
-
|
|
547
|
+
this.initMarkerPool(); // console.log(`${this.type} map script initialized`, divElement);
|
|
548
|
+
|
|
549
|
+
resolve(map); //네이버는 로드 후에 idle 이 발생 안해서 직접 일으켜준다
|
|
550
|
+
|
|
467
551
|
map.trigger('idle');
|
|
468
|
-
return [2
|
|
552
|
+
return [2
|
|
553
|
+
/*return*/
|
|
554
|
+
];
|
|
469
555
|
}
|
|
470
556
|
});
|
|
471
557
|
});
|
|
@@ -492,7 +578,8 @@ var NaverMintMapController = function (_super) {
|
|
|
492
578
|
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
493
579
|
} catch (e) {
|
|
494
580
|
console.log('naver map destroy error', e);
|
|
495
|
-
}
|
|
581
|
+
} // console.log(`${this.type} map destroyed`);
|
|
582
|
+
|
|
496
583
|
};
|
|
497
584
|
|
|
498
585
|
NaverMintMapController.prototype.getCurrBounds = function () {
|
|
@@ -501,7 +588,7 @@ var NaverMintMapController = function (_super) {
|
|
|
501
588
|
}
|
|
502
589
|
|
|
503
590
|
var bounds = this.map.getBounds();
|
|
504
|
-
return
|
|
591
|
+
return MapTypes.Bounds.fromNWSE(new MapTypes.Position(bounds.getMax().y, bounds.getMin().x), new MapTypes.Position(bounds.getMin().y, bounds.getMax().x));
|
|
505
592
|
};
|
|
506
593
|
|
|
507
594
|
NaverMintMapController.prototype.panningTo = function (targetCenter) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="navermaps" />
|
|
2
|
+
/// <reference types="google.maps" />
|
|
3
|
+
/// <reference types="kakaomaps" />
|
|
4
|
+
/**
|
|
5
|
+
* 지원되는 맵 종류
|
|
6
|
+
*/
|
|
7
|
+
export declare type MapType = 'naver' | 'google' | 'kakao';
|
|
8
|
+
/**
|
|
9
|
+
* 맵 객체의 native 타입
|
|
10
|
+
*/
|
|
11
|
+
export declare type MapVendorType = naver.maps.Map | google.maps.Map | kakao.maps.Map;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Offset, Position } from "./MapTypes";
|
|
2
|
+
export interface DrawableOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 좌표값
|
|
5
|
+
*/
|
|
6
|
+
position: Position | Position[] | [number, number][];
|
|
7
|
+
/**
|
|
8
|
+
* 좌표값
|
|
9
|
+
*/
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 이벤트 목록
|
|
13
|
+
*/
|
|
14
|
+
event?: Map<keyof DocumentEventMap, (e: Event) => boolean | void>;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class Drawable {
|
|
17
|
+
/**
|
|
18
|
+
* 지도의 native drawable object
|
|
19
|
+
*/
|
|
20
|
+
native?: any;
|
|
21
|
+
/**
|
|
22
|
+
* Drawable options
|
|
23
|
+
*/
|
|
24
|
+
abstract options: DrawableOptions;
|
|
25
|
+
}
|
|
26
|
+
export interface MarkerOptions extends DrawableOptions {
|
|
27
|
+
/**
|
|
28
|
+
* 마커의 좌표와 Element 사이의 offset 값
|
|
29
|
+
*/
|
|
30
|
+
anchor?: Offset;
|
|
31
|
+
/**
|
|
32
|
+
* zIndex 설정
|
|
33
|
+
*/
|
|
34
|
+
zIndex?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class Marker extends Drawable {
|
|
37
|
+
/**
|
|
38
|
+
* Marker 의 옵션
|
|
39
|
+
*/
|
|
40
|
+
options: MarkerOptions;
|
|
41
|
+
/**
|
|
42
|
+
* 커스텀 마커 Element
|
|
43
|
+
*/
|
|
44
|
+
element?: string | HTMLElement;
|
|
45
|
+
/**
|
|
46
|
+
* 지도에 표시할 마커정보
|
|
47
|
+
*/
|
|
48
|
+
constructor(options: MarkerOptions);
|
|
49
|
+
}
|
|
50
|
+
export interface PolylineOptions extends DrawableOptions {
|
|
51
|
+
/**
|
|
52
|
+
* 외곽선 의 색상
|
|
53
|
+
* @description css 의 color 에 준함
|
|
54
|
+
*/
|
|
55
|
+
lineColor?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 외곽선 의 굵기
|
|
58
|
+
* @description 픽셀
|
|
59
|
+
*/
|
|
60
|
+
lineSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 외곽선 의 투명도
|
|
63
|
+
* @description 0.0과 1.0 사이의 불투명도
|
|
64
|
+
*/
|
|
65
|
+
lineOpacity?: number;
|
|
66
|
+
/**
|
|
67
|
+
* 편집가능 여부
|
|
68
|
+
*/
|
|
69
|
+
editable?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export declare class Polyline extends Drawable {
|
|
72
|
+
/**
|
|
73
|
+
* Polygon 의 옵션
|
|
74
|
+
*/
|
|
75
|
+
options: PolylineOptions;
|
|
76
|
+
/**
|
|
77
|
+
* 지도에 표시할 폴리곤정보
|
|
78
|
+
*/
|
|
79
|
+
constructor(options: PolylineOptions);
|
|
80
|
+
}
|
|
81
|
+
export interface PolygonOptions extends PolylineOptions {
|
|
82
|
+
/**
|
|
83
|
+
* 폴리곤 외곽선의 내부 다각형 position
|
|
84
|
+
*/
|
|
85
|
+
innerPositions?: Position[][];
|
|
86
|
+
/**
|
|
87
|
+
* 면의 배경색
|
|
88
|
+
* @description css 의 color 에 준함
|
|
89
|
+
*/
|
|
90
|
+
fillColor?: string;
|
|
91
|
+
/**
|
|
92
|
+
* 면의 투명도
|
|
93
|
+
* @description 0~1 의 값
|
|
94
|
+
*/
|
|
95
|
+
fillOpacity?: number;
|
|
96
|
+
}
|
|
97
|
+
export declare class Polygon extends Drawable {
|
|
98
|
+
/**
|
|
99
|
+
* Polygon 의 옵션
|
|
100
|
+
*/
|
|
101
|
+
options: PolygonOptions;
|
|
102
|
+
/**
|
|
103
|
+
* 지도에 표시할 폴리곤정보
|
|
104
|
+
*/
|
|
105
|
+
constructor(options: PolygonOptions);
|
|
106
|
+
/**
|
|
107
|
+
* 폴리곤의 중점을 구한다.
|
|
108
|
+
*/
|
|
109
|
+
getCenter(): Position;
|
|
110
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var calculate = require('../core/util/calculate.js');
|
|
7
|
+
var MapTypes = require('./MapTypes.js');
|
|
8
|
+
|
|
9
|
+
var Drawable =
|
|
10
|
+
/** @class */
|
|
11
|
+
function () {
|
|
12
|
+
function Drawable() {}
|
|
13
|
+
|
|
14
|
+
return Drawable;
|
|
15
|
+
}();
|
|
16
|
+
|
|
17
|
+
var Marker =
|
|
18
|
+
/** @class */
|
|
19
|
+
function (_super) {
|
|
20
|
+
tslib.__extends(Marker, _super);
|
|
21
|
+
/**
|
|
22
|
+
* 지도에 표시할 마커정보
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function Marker(options) {
|
|
27
|
+
var _this = _super.call(this) || this;
|
|
28
|
+
|
|
29
|
+
_this.options = options;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Marker;
|
|
34
|
+
}(Drawable);
|
|
35
|
+
|
|
36
|
+
var Polyline =
|
|
37
|
+
/** @class */
|
|
38
|
+
function (_super) {
|
|
39
|
+
tslib.__extends(Polyline, _super);
|
|
40
|
+
/**
|
|
41
|
+
* 지도에 표시할 폴리곤정보
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function Polyline(options) {
|
|
46
|
+
var _this = _super.call(this) || this;
|
|
47
|
+
|
|
48
|
+
_this.options = options;
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return Polyline;
|
|
53
|
+
}(Drawable);
|
|
54
|
+
|
|
55
|
+
var Polygon =
|
|
56
|
+
/** @class */
|
|
57
|
+
function (_super) {
|
|
58
|
+
tslib.__extends(Polygon, _super);
|
|
59
|
+
/**
|
|
60
|
+
* 지도에 표시할 폴리곤정보
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function Polygon(options) {
|
|
65
|
+
var _this = _super.call(this) || this;
|
|
66
|
+
|
|
67
|
+
_this.options = options;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 폴리곤의 중점을 구한다.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Polygon.prototype.getCenter = function () {
|
|
76
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
77
|
+
var paths = this.options.position.map(function (elem) {
|
|
78
|
+
return elem instanceof MapTypes.Position ? elem : new MapTypes.Position(elem[0], elem[1]);
|
|
79
|
+
});
|
|
80
|
+
return calculate.PolygonCalculator.getCenter(paths);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return Polygon;
|
|
87
|
+
}(Drawable);
|
|
88
|
+
|
|
89
|
+
exports.Drawable = Drawable;
|
|
90
|
+
exports.Marker = Marker;
|
|
91
|
+
exports.Polygon = Polygon;
|
|
92
|
+
exports.Polyline = Polyline;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 좌표값
|
|
3
|
+
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
4
|
+
*/
|
|
5
|
+
export declare class Position {
|
|
6
|
+
/**
|
|
7
|
+
* 위도
|
|
8
|
+
* @description 위도(latitude)
|
|
9
|
+
*/
|
|
10
|
+
lat: number;
|
|
11
|
+
/**
|
|
12
|
+
* 경도
|
|
13
|
+
* @description 경도(longitude)
|
|
14
|
+
*/
|
|
15
|
+
lng: number;
|
|
16
|
+
/**
|
|
17
|
+
* offset 좌표
|
|
18
|
+
* @description DOM 상에서의 offset 정보
|
|
19
|
+
*/
|
|
20
|
+
offset?: Offset;
|
|
21
|
+
constructor(lat: number, lng: number);
|
|
22
|
+
static equals(pos1: Position, pos2: Position): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class Bounds {
|
|
25
|
+
nw: Position;
|
|
26
|
+
se: Position;
|
|
27
|
+
ne: Position;
|
|
28
|
+
sw: Position;
|
|
29
|
+
constructor(nw?: Position, se?: Position, ne?: Position, sw?: Position);
|
|
30
|
+
static fromNWSE(nw: Position, se: Position): Bounds;
|
|
31
|
+
static fromNESW(ne: Position, sw: Position): Bounds;
|
|
32
|
+
private covertNWSEtoNESW;
|
|
33
|
+
private covertNESWtoNWSE;
|
|
34
|
+
getCenter(): Position;
|
|
35
|
+
includesPosition(pos: Position): boolean;
|
|
36
|
+
getIncludedPositions(positions: Position[]): Position[];
|
|
37
|
+
includes(positions: Position | Position[]): boolean;
|
|
38
|
+
includesOnlyOnePoint(positions: Position[]): boolean;
|
|
39
|
+
intersects(positions: Position[]): boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
43
|
+
*/
|
|
44
|
+
export declare class Offset {
|
|
45
|
+
/**
|
|
46
|
+
* x 좌표
|
|
47
|
+
* @description DOM 상에서의 offsetX
|
|
48
|
+
*/
|
|
49
|
+
x: number;
|
|
50
|
+
/**
|
|
51
|
+
* y 좌표
|
|
52
|
+
* @description DOM 상에서의 offsetY
|
|
53
|
+
*/
|
|
54
|
+
y: number;
|
|
55
|
+
/**
|
|
56
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
57
|
+
*/
|
|
58
|
+
constructor(x: number, y: number);
|
|
59
|
+
}
|