@mint-ui/map 0.3.5-beta → 0.3.7-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/dist/components/mint-map/MintMap.d.ts +8 -2
- package/dist/components/mint-map/MintMap.js +18 -5
- package/dist/components/mint-map/core/MintMapController.d.ts +4 -0
- package/dist/components/mint-map/core/MintMapController.js +216 -0
- package/dist/components/mint-map/core/MintMapCore.d.ts +1 -1
- package/dist/components/mint-map/core/MintMapCore.js +20 -9
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +3 -1
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +2 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +12 -1
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +43 -0
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +514 -0
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +2 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +13 -0
- package/dist/index.es.js +785 -18
- package/dist/index.umd.js +783 -16
- package/package.json +2 -1
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var MintMapController = require('../core/MintMapController.js');
|
|
7
|
+
var waiting = require('../core/util/waiting.js');
|
|
8
|
+
var MintMap = require('../MintMap.js');
|
|
9
|
+
var tools = require('@mint-ui/tools');
|
|
10
|
+
|
|
11
|
+
var KakaoMintMapController = function (_super) {
|
|
12
|
+
tslib.__extends(KakaoMintMapController, _super);
|
|
13
|
+
|
|
14
|
+
function KakaoMintMapController(props) {
|
|
15
|
+
var _this = _super.call(this, props) || this;
|
|
16
|
+
|
|
17
|
+
_this.type = 'kakao';
|
|
18
|
+
_this.map = null;
|
|
19
|
+
_this.scriptUrl = 'https://dapi.kakao.com/v2/maps/sdk.js';
|
|
20
|
+
_this.scriptModules = ['services', 'clusterer'];
|
|
21
|
+
_this.polylineEvents = ['mouseover', 'mouseout'];
|
|
22
|
+
_this.polygonEvents = ['mouseover', 'mouseout'];
|
|
23
|
+
_this.markerEvents = ['click', 'mouseover', 'mouseout'];
|
|
24
|
+
_this.dragStartPoint = [0, 0];
|
|
25
|
+
_this.dragged = false;
|
|
26
|
+
console.log("".concat(_this.type, " controller loadded"));
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
KakaoMintMapController.prototype.initMarkerPool = function () {
|
|
31
|
+
var _this = this;
|
|
32
|
+
|
|
33
|
+
if (!this.mapProps.markerCache) return;
|
|
34
|
+
this.markerPool = new tools.ObjectPool().setFactory(function () {
|
|
35
|
+
return new kakao.maps.CustomOverlay({
|
|
36
|
+
position: _this.positionToLatLng(new MintMap.Position(0, 0)),
|
|
37
|
+
map: _this.map || undefined
|
|
38
|
+
});
|
|
39
|
+
}).setClear(function (item) {
|
|
40
|
+
item.setMap(null);
|
|
41
|
+
}).createPool(this.mapProps.markerCachePoolSize && this.mapProps.markerCachePoolSize > 0 ? this.mapProps.markerCachePoolSize : 1000).setCheckLiveTimeInterval(1000);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
KakaoMintMapController.prototype.createPolyline = function (polyline) {
|
|
45
|
+
var _this = this;
|
|
46
|
+
|
|
47
|
+
var _a = polyline.options,
|
|
48
|
+
position = _a.position,
|
|
49
|
+
_b = _a.lineColor,
|
|
50
|
+
lineColor = _b === void 0 ? 'blue' : _b,
|
|
51
|
+
_c = _a.lineSize,
|
|
52
|
+
lineSize = _c === void 0 ? 1 : _c,
|
|
53
|
+
_d = _a.lineOpacity,
|
|
54
|
+
lineOpacity = _d === void 0 ? 1 : _d;
|
|
55
|
+
_a.visible;
|
|
56
|
+
_a.editable;
|
|
57
|
+
var event = _a.event;
|
|
58
|
+
|
|
59
|
+
if (this.map && Array.isArray(position)) {
|
|
60
|
+
var path = position.map(function (elem) {
|
|
61
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MintMap.Position(elem[1], elem[0]) : elem);
|
|
62
|
+
});
|
|
63
|
+
var pol_1 = new kakao.maps.Polyline({
|
|
64
|
+
map: this.map,
|
|
65
|
+
path: path,
|
|
66
|
+
strokeColor: lineColor,
|
|
67
|
+
strokeWeight: lineSize,
|
|
68
|
+
strokeOpacity: lineOpacity
|
|
69
|
+
});
|
|
70
|
+
polyline.native = pol_1;
|
|
71
|
+
event && event.forEach(function (handler, key) {
|
|
72
|
+
if (_this.polylineEvents.includes(key)) {
|
|
73
|
+
kakao.maps.event.addListener(pol_1, key, handler);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
KakaoMintMapController.prototype.updatePolyline = function (polyline, options) {
|
|
80
|
+
var _this = this;
|
|
81
|
+
|
|
82
|
+
if (polyline && polyline.native && polyline.native instanceof kakao.maps.Polyline) {
|
|
83
|
+
var path = void 0;
|
|
84
|
+
|
|
85
|
+
if (Array.isArray(options.position)) {
|
|
86
|
+
path = options.position.map(function (elem) {
|
|
87
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MintMap.Position(elem[1], elem[0]) : elem);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
polyline.native.setOptions({
|
|
92
|
+
path: path || polyline.native.getPath(),
|
|
93
|
+
strokeColor: options.lineColor,
|
|
94
|
+
strokeWeight: options.lineSize,
|
|
95
|
+
strokeOpacity: options.lineOpacity
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
KakaoMintMapController.prototype.createPolygon = function (polygon) {
|
|
101
|
+
var _this = this;
|
|
102
|
+
|
|
103
|
+
var _a = polygon.options,
|
|
104
|
+
position = _a.position,
|
|
105
|
+
innerPositions = _a.innerPositions,
|
|
106
|
+
_b = _a.lineColor,
|
|
107
|
+
lineColor = _b === void 0 ? 'green' : _b,
|
|
108
|
+
_c = _a.lineSize,
|
|
109
|
+
lineSize = _c === void 0 ? 1 : _c,
|
|
110
|
+
_d = _a.lineOpacity,
|
|
111
|
+
lineOpacity = _d === void 0 ? 1 : _d,
|
|
112
|
+
_e = _a.fillColor,
|
|
113
|
+
fillColor = _e === void 0 ? 'lightgreen' : _e,
|
|
114
|
+
_f = _a.fillOpacity,
|
|
115
|
+
fillOpacity = _f === void 0 ? 0.5 : _f;
|
|
116
|
+
_a.visible;
|
|
117
|
+
_a.editable;
|
|
118
|
+
var event = _a.event;
|
|
119
|
+
|
|
120
|
+
if (this.map && Array.isArray(position)) {
|
|
121
|
+
var outLine = position.map(function (elem) {
|
|
122
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MintMap.Position(elem[1], elem[0]) : elem);
|
|
123
|
+
});
|
|
124
|
+
var path = [outLine];
|
|
125
|
+
innerPositions && path.push(innerPositions.map(function (inner) {
|
|
126
|
+
return _this.positionToLatLng(inner);
|
|
127
|
+
}));
|
|
128
|
+
var pol_2 = new kakao.maps.Polygon({
|
|
129
|
+
map: this.map,
|
|
130
|
+
path: path,
|
|
131
|
+
strokeColor: lineColor,
|
|
132
|
+
strokeWeight: lineSize,
|
|
133
|
+
strokeOpacity: lineOpacity,
|
|
134
|
+
fillColor: fillColor,
|
|
135
|
+
fillOpacity: fillOpacity
|
|
136
|
+
});
|
|
137
|
+
polygon.native = pol_2;
|
|
138
|
+
event && event.forEach(function (handler, key) {
|
|
139
|
+
if (_this.polygonEvents.includes(key)) {
|
|
140
|
+
kakao.maps.event.addListener(pol_2, key, handler);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
KakaoMintMapController.prototype.updatePolygon = function (polygon, options) {
|
|
147
|
+
var _this = this;
|
|
148
|
+
|
|
149
|
+
if (polygon && polygon.native && polygon.native instanceof kakao.maps.Polygon) {
|
|
150
|
+
var paths = void 0;
|
|
151
|
+
|
|
152
|
+
if (Array.isArray(options.position)) {
|
|
153
|
+
var outLine = options.position.map(function (elem) {
|
|
154
|
+
return _this.positionToLatLng(Array.isArray(elem) ? new MintMap.Position(elem[1], elem[0]) : elem);
|
|
155
|
+
});
|
|
156
|
+
paths = [outLine];
|
|
157
|
+
options.innerPositions && paths.push.apply(paths, options.innerPositions.map(function (inner) {
|
|
158
|
+
return _this.positionToLatLng(inner);
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
polygon.native.setOptions({
|
|
163
|
+
path: paths || polygon.native.getPath(),
|
|
164
|
+
strokeColor: options.lineColor,
|
|
165
|
+
strokeWeight: options.lineSize,
|
|
166
|
+
strokeOpacity: options.lineOpacity,
|
|
167
|
+
fillColor: options.fillColor,
|
|
168
|
+
fillOpacity: options.fillOpacity
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
KakaoMintMapController.prototype.createMarker = function (marker) {
|
|
174
|
+
var _this = this;
|
|
175
|
+
|
|
176
|
+
var _a;
|
|
177
|
+
|
|
178
|
+
if (this.map) {
|
|
179
|
+
var options = {
|
|
180
|
+
map: this.map,
|
|
181
|
+
position: this.positionToLatLng(marker.options.position)
|
|
182
|
+
};
|
|
183
|
+
marker.element && (options.content = marker.element);
|
|
184
|
+
var kakaoMarker_1;
|
|
185
|
+
|
|
186
|
+
if (this.mapProps.markerCache && this.markerPool) {
|
|
187
|
+
kakaoMarker_1 = this.markerPool.getPoolItem();
|
|
188
|
+
kakaoMarker_1.setVisible(true);
|
|
189
|
+
options.content && kakaoMarker_1.setContent(options.content);
|
|
190
|
+
marker.native = kakaoMarker_1;
|
|
191
|
+
this.updateMarker(marker, marker.options);
|
|
192
|
+
} else {
|
|
193
|
+
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
194
|
+
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
195
|
+
marker.native = kakaoMarker_1;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
|
|
199
|
+
if (_this.markerEvents.includes(key)) {
|
|
200
|
+
kakao.maps.event.addListener(kakaoMarker_1, key, handler);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
KakaoMintMapController.prototype.updateMarker = function (marker, options) {
|
|
207
|
+
if (marker && marker.native && marker.native instanceof kakao.maps.CustomOverlay) {
|
|
208
|
+
var map = marker.native.getMap();
|
|
209
|
+
|
|
210
|
+
if (map) {
|
|
211
|
+
if (options.position && options.position instanceof MintMap.Position) {
|
|
212
|
+
marker.native.setPosition(this.positionToLatLng(options.position));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (options.visible !== undefined) {
|
|
216
|
+
marker.native.setVisible(options.visible);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
KakaoMintMapController.prototype.getMaxZIndex = function (increment, parent) {
|
|
223
|
+
if (increment === void 0) {
|
|
224
|
+
increment = 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this.map) {
|
|
228
|
+
var targetPane = parent;
|
|
229
|
+
var max = 0;
|
|
230
|
+
|
|
231
|
+
for (var i = 0; i < targetPane.childElementCount; i++) {
|
|
232
|
+
var elem = targetPane.children[i];
|
|
233
|
+
|
|
234
|
+
if (elem instanceof HTMLElement) {
|
|
235
|
+
var index = Number(elem.style.zIndex);
|
|
236
|
+
|
|
237
|
+
if (!isNaN(index) && index > max) {
|
|
238
|
+
max = index;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.markerMaxZIndex = max + increment;
|
|
244
|
+
return this.markerMaxZIndex;
|
|
245
|
+
} else {
|
|
246
|
+
return this.markerMaxZIndex || 1;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
KakaoMintMapController.prototype.setMarkerZIndex = function (marker, zIndex) {
|
|
251
|
+
if (this.map && marker.element && marker.element instanceof HTMLElement) {
|
|
252
|
+
var parent_1 = marker.element.parentElement;
|
|
253
|
+
|
|
254
|
+
if (parent_1) {
|
|
255
|
+
parent_1.style.zIndex = String(zIndex);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
KakaoMintMapController.prototype.markerToTheTop = function (marker) {
|
|
261
|
+
if (this.map && marker.element && marker.element instanceof HTMLElement) {
|
|
262
|
+
var parent_2 = marker.element.parentElement;
|
|
263
|
+
|
|
264
|
+
if (parent_2) {
|
|
265
|
+
this.setMarkerZIndex(marker, this.getMaxZIndex(1, parent_2));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
KakaoMintMapController.prototype.clearDrawable = function (drawable) {
|
|
271
|
+
var _this = this;
|
|
272
|
+
|
|
273
|
+
var _a, _b;
|
|
274
|
+
|
|
275
|
+
if (drawable && drawable.native && (drawable.native instanceof kakao.maps.CustomOverlay || drawable.native instanceof kakao.maps.Polyline || drawable.native instanceof kakao.maps.Polygon)) {
|
|
276
|
+
if (drawable.native instanceof kakao.maps.CustomOverlay) {
|
|
277
|
+
if (this.mapProps.markerCache && this.markerPool) {
|
|
278
|
+
drawable.native.setVisible(false);
|
|
279
|
+
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.releasePoolItem(drawable.native);
|
|
280
|
+
} else {
|
|
281
|
+
drawable.native.setMap(null);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
drawable.native.setMap(null);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
((_b = drawable.options) === null || _b === void 0 ? void 0 : _b.event) && drawable.options.event.forEach(function (handler, key) {
|
|
288
|
+
if (_this.markerEvents.includes(key)) {
|
|
289
|
+
kakao.maps.event.removeListener(drawable.native, key, handler);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return false;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
KakaoMintMapController.prototype.isMapDragged = function () {
|
|
299
|
+
return this.dragged;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
KakaoMintMapController.prototype.setMapDragged = function (value) {
|
|
303
|
+
this.dragged = false;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
307
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
308
|
+
var _this = this;
|
|
309
|
+
|
|
310
|
+
return tslib.__generator(this, function (_a) {
|
|
311
|
+
return [2, new Promise(function (resolve) {
|
|
312
|
+
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
313
|
+
var params, ok;
|
|
314
|
+
return tslib.__generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
params = {
|
|
318
|
+
appkey: this.mapProps.mapKey,
|
|
319
|
+
libraries: this.scriptModules.join(','),
|
|
320
|
+
autoload: false
|
|
321
|
+
};
|
|
322
|
+
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakaoscript')];
|
|
323
|
+
|
|
324
|
+
case 1:
|
|
325
|
+
_a.sent();
|
|
326
|
+
|
|
327
|
+
window.kakao.maps.load();
|
|
328
|
+
return [4, waiting.waiting(function () {
|
|
329
|
+
return window.kakao.maps.Map ? true : false;
|
|
330
|
+
})];
|
|
331
|
+
|
|
332
|
+
case 2:
|
|
333
|
+
ok = _a.sent();
|
|
334
|
+
|
|
335
|
+
if (!ok) {
|
|
336
|
+
throw new Error('kakao script api load failed!!');
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
this.mapApiLoaded = true;
|
|
340
|
+
resolve(true);
|
|
341
|
+
console.log("".concat(this.type, " map script loaded"));
|
|
342
|
+
return [2];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
})];
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
KakaoMintMapController.prototype.initializingMap = function (divElement) {
|
|
352
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
353
|
+
var _this = this;
|
|
354
|
+
|
|
355
|
+
return tslib.__generator(this, function (_a) {
|
|
356
|
+
return [2, new Promise(function (resolve) {
|
|
357
|
+
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
358
|
+
var options, maxZoom, minZoom, map;
|
|
359
|
+
|
|
360
|
+
var _this = this;
|
|
361
|
+
|
|
362
|
+
var _a, _b, _c, _d;
|
|
363
|
+
|
|
364
|
+
return tslib.__generator(this, function (_e) {
|
|
365
|
+
switch (_e.label) {
|
|
366
|
+
case 0:
|
|
367
|
+
if (this.mapInitialized && this.map) {
|
|
368
|
+
if (this.map.getElement() === divElement) {
|
|
369
|
+
resolve(this.map);
|
|
370
|
+
return [2];
|
|
371
|
+
} else {
|
|
372
|
+
this.map.destroy();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (!!this.mapApiLoaded) return [3, 2];
|
|
377
|
+
return [4, this.loadMapApi()];
|
|
378
|
+
|
|
379
|
+
case 1:
|
|
380
|
+
_e.sent();
|
|
381
|
+
|
|
382
|
+
_e.label = 2;
|
|
383
|
+
|
|
384
|
+
case 2:
|
|
385
|
+
options = {
|
|
386
|
+
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
387
|
+
level: this.getBaseToMapZoom((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel),
|
|
388
|
+
draggable: this.mapProps.draggable === false ? false : true,
|
|
389
|
+
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
390
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
391
|
+
};
|
|
392
|
+
maxZoom = 1;
|
|
393
|
+
minZoom = 14;
|
|
394
|
+
|
|
395
|
+
if ((_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.maxZoomLevel) {
|
|
396
|
+
maxZoom = this.getSafeZoomValue(this.mapProps.base.maxZoomLevel);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.minZoomLevel) {
|
|
400
|
+
minZoom = this.getSafeZoomValue(this.mapProps.base.minZoomLevel);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (minZoom < maxZoom) {
|
|
404
|
+
minZoom = 14;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
map = new kakao.maps.Map(divElement, options);
|
|
408
|
+
map.setMaxLevel(minZoom);
|
|
409
|
+
map.setMinLevel(maxZoom);
|
|
410
|
+
this.map = map;
|
|
411
|
+
map.addListener('idle', function (e) {
|
|
412
|
+
_this.map && _this.checkBoundsChangeThrottleTime() && _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
|
|
413
|
+
});
|
|
414
|
+
map.addListener('zoom_changed', function () {
|
|
415
|
+
_this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.getZoomLevel());
|
|
416
|
+
});
|
|
417
|
+
map.addListener('click', function (e) {
|
|
418
|
+
if (!_this.mapProps.onClick) return;
|
|
419
|
+
var pos = new MintMap.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
420
|
+
pos.offset = new MintMap.Offset(e.point.x, e.point.y);
|
|
421
|
+
|
|
422
|
+
_this.mapProps.onClick(pos);
|
|
423
|
+
});
|
|
424
|
+
map.addListener('mousemove', function (e) {
|
|
425
|
+
if (!_this.mapProps.onMouseMove) return;
|
|
426
|
+
var pos = new MintMap.Position(e.latLng.getLat(), e.latLng.getLng());
|
|
427
|
+
pos.offset = new MintMap.Offset(e.point.x, e.point.y);
|
|
428
|
+
|
|
429
|
+
_this.mapProps.onMouseMove(pos);
|
|
430
|
+
});
|
|
431
|
+
this.mapInitialized = true;
|
|
432
|
+
this.initMarkerPool();
|
|
433
|
+
console.log("".concat(this.type, " map script initialized"), divElement);
|
|
434
|
+
resolve(map);
|
|
435
|
+
return [2];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
})];
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
445
|
+
var mapValue = this.getBaseToMapZoom(value);
|
|
446
|
+
|
|
447
|
+
if (mapValue > 14) {
|
|
448
|
+
return 14;
|
|
449
|
+
} else if (mapValue < 1) {
|
|
450
|
+
return 1;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return mapValue;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
KakaoMintMapController.prototype.destroyMap = function () {
|
|
457
|
+
var _a;
|
|
458
|
+
|
|
459
|
+
try {
|
|
460
|
+
(_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
461
|
+
} catch (e) {
|
|
462
|
+
console.log('kakao map destroy error', e);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
console.log("".concat(this.type, " map destroyed"));
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
KakaoMintMapController.prototype.getCurrBounds = function () {
|
|
469
|
+
if (!this.map) {
|
|
470
|
+
throw new Error('Map is not initialized!!');
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
var bounds = this.map.getBounds();
|
|
474
|
+
return MintMap.Bounds.fromNESW(this.latLngToPosition(bounds.getNorthEast()), this.latLngToPosition(bounds.getSouthWest()));
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
KakaoMintMapController.prototype.panningTo = function (targetCenter) {
|
|
478
|
+
var _a;
|
|
479
|
+
|
|
480
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.panTo(this.positionToLatLng(targetCenter));
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
KakaoMintMapController.prototype.getZoomLevel = function () {
|
|
484
|
+
return this.map ? this.getMapToBaseZoom(this.map.getLevel()) : 13;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
KakaoMintMapController.prototype.setZoomLevel = function (zoom) {
|
|
488
|
+
var _a;
|
|
489
|
+
|
|
490
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setLevel(this.getBaseToMapZoom(zoom));
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
KakaoMintMapController.prototype.getCenter = function () {
|
|
494
|
+
return this.getCurrBounds().getCenter();
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
KakaoMintMapController.prototype.setCenter = function (position) {
|
|
498
|
+
var _a;
|
|
499
|
+
|
|
500
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(this.positionToLatLng(position));
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
KakaoMintMapController.prototype.positionToLatLng = function (pos) {
|
|
504
|
+
return pos ? new kakao.maps.LatLng(pos.lat, pos.lng) : undefined;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
KakaoMintMapController.prototype.latLngToPosition = function (latLng) {
|
|
508
|
+
return latLng ? new MintMap.Position(latLng.getLat(), latLng.getLng()) : undefined;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
return KakaoMintMapController;
|
|
512
|
+
}(MintMapController.MintMapController);
|
|
513
|
+
|
|
514
|
+
exports.KakaoMintMapController = KakaoMintMapController;
|
|
@@ -394,6 +394,9 @@ var NaverMintMapController = function (_super) {
|
|
|
394
394
|
options = {
|
|
395
395
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
396
396
|
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
397
|
+
draggable: this.mapProps.draggable === false ? false : true,
|
|
398
|
+
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
399
|
+
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
397
400
|
logoControl: false,
|
|
398
401
|
mapDataControl: false,
|
|
399
402
|
mapTypeControl: false,
|
|
@@ -515,6 +518,16 @@ var NaverMintMapController = function (_super) {
|
|
|
515
518
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setZoom(zoom, true);
|
|
516
519
|
};
|
|
517
520
|
|
|
521
|
+
NaverMintMapController.prototype.getCenter = function () {
|
|
522
|
+
return this.getCurrBounds().getCenter();
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
NaverMintMapController.prototype.setCenter = function (position) {
|
|
526
|
+
var _a;
|
|
527
|
+
|
|
528
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
529
|
+
};
|
|
530
|
+
|
|
518
531
|
return NaverMintMapController;
|
|
519
532
|
}(MintMapController.MintMapController);
|
|
520
533
|
|