@mint-ui/map 0.4.3-beta → 0.4.5-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 +15 -1
- package/dist/components/mint-map/MintMap.js +249 -21
- package/dist/components/mint-map/core/MintMapController.d.ts +2 -1
- package/dist/components/mint-map/core/MintMapController.js +19 -4
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +1 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +15 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +1 -0
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +11 -2
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +1 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +15 -4
- package/dist/index.es.js +308 -36
- package/dist/index.js +2 -0
- package/dist/index.umd.js +312 -39
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export interface MintMapProps extends MintMapEvents {
|
|
|
18
18
|
markerCache?: boolean;
|
|
19
19
|
markerCachePoolSize?: number;
|
|
20
20
|
boundsChangeThrottlingTime?: number;
|
|
21
|
+
dissolveEffectWhenLoaded?: boolean;
|
|
21
22
|
mapLoadingComponent?: () => JSX.Element;
|
|
22
23
|
}
|
|
23
24
|
export interface MintMapEvents {
|
|
@@ -100,4 +101,17 @@ export declare class Polygon extends Drawable {
|
|
|
100
101
|
constructor(options: PolygonOptions);
|
|
101
102
|
getCenter(): Position;
|
|
102
103
|
}
|
|
103
|
-
export declare function MintMap({ mapLoadingComponent, mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
104
|
+
export declare function MintMap({ mapLoadingComponent, dissolveEffectWhenLoaded, mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
105
|
+
export interface PointLoadingProps {
|
|
106
|
+
text?: string;
|
|
107
|
+
pointCount?: number;
|
|
108
|
+
speedMs?: number;
|
|
109
|
+
}
|
|
110
|
+
export declare function PointLoading({ text, pointCount, speedMs }: PointLoadingProps): JSX.Element;
|
|
111
|
+
export declare function MapLoadingWithImage({ size }: MapImageLoadingProps): JSX.Element;
|
|
112
|
+
interface MapImageLoadingProps {
|
|
113
|
+
size?: number;
|
|
114
|
+
duration?: number;
|
|
115
|
+
delay?: number;
|
|
116
|
+
}
|
|
117
|
+
export {};
|
|
@@ -195,23 +195,25 @@ var DEFAULT_CENTER = {
|
|
|
195
195
|
};
|
|
196
196
|
function MintMap(_a) {
|
|
197
197
|
var mapLoadingComponent = _a.mapLoadingComponent,
|
|
198
|
+
_b = _a.dissolveEffectWhenLoaded,
|
|
199
|
+
dissolveEffectWhenLoaded = _b === void 0 ? true : _b,
|
|
198
200
|
mapType = _a.mapType,
|
|
199
201
|
children = _a.children,
|
|
200
|
-
|
|
201
|
-
base =
|
|
202
|
+
_c = _a.base,
|
|
203
|
+
base = _c === void 0 ? {
|
|
202
204
|
center: DEFAULT_CENTER,
|
|
203
205
|
zoomLevel: 12
|
|
204
|
-
} :
|
|
205
|
-
props = tslib.__rest(_a, ["mapLoadingComponent", "mapType", "children", "base"]);
|
|
206
|
+
} : _c,
|
|
207
|
+
props = tslib.__rest(_a, ["mapLoadingComponent", "dissolveEffectWhenLoaded", "mapType", "children", "base"]);
|
|
206
208
|
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
var loadingRef = React.useRef(null);
|
|
210
|
+
|
|
211
|
+
var _d = React.useState(),
|
|
212
|
+
controller = _d[0],
|
|
213
|
+
setController = _d[1];
|
|
210
214
|
|
|
211
215
|
var loading = React.useMemo(function () {
|
|
212
|
-
return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(
|
|
213
|
-
text: "Loading"
|
|
214
|
-
});
|
|
216
|
+
return mapLoadingComponent ? mapLoadingComponent() : React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
215
217
|
}, [mapLoadingComponent]);
|
|
216
218
|
React.useEffect(function () {
|
|
217
219
|
if (mapType && mapType.length > 0) {
|
|
@@ -243,28 +245,56 @@ function MintMap(_a) {
|
|
|
243
245
|
}, [mapType]);
|
|
244
246
|
return React__default["default"].createElement(React__default["default"].Fragment, null, controller ? React__default["default"].createElement(MintMapProvider.MintMapProvider, {
|
|
245
247
|
controller: controller
|
|
246
|
-
}, React__default["default"].createElement(
|
|
248
|
+
}, dissolveEffectWhenLoaded && React__default["default"].createElement("div", {
|
|
249
|
+
className: cn('ani-fade-out'),
|
|
250
|
+
style: {
|
|
251
|
+
position: 'absolute',
|
|
252
|
+
top: '0px',
|
|
253
|
+
left: '0px',
|
|
254
|
+
width: '100%',
|
|
255
|
+
height: '100%',
|
|
256
|
+
background: 'white',
|
|
257
|
+
zIndex: 1000,
|
|
258
|
+
animationFillMode: 'forwards',
|
|
259
|
+
animationDuration: '0.7s'
|
|
260
|
+
},
|
|
261
|
+
onAnimationEnd: function (e) {
|
|
262
|
+
e.target.style.display = 'none';
|
|
263
|
+
}
|
|
264
|
+
}), React__default["default"].createElement(MintMapCore.MintMapCore, tslib.__assign({
|
|
247
265
|
mapType: mapType
|
|
248
266
|
}, props, {
|
|
249
267
|
base: base
|
|
250
|
-
}), children)) : React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
268
|
+
}), children)) : React__default["default"].createElement(React__default["default"].Fragment, null, dissolveEffectWhenLoaded && React__default["default"].createElement("div", {
|
|
269
|
+
ref: function (refs) {
|
|
270
|
+
loadingRef.current = refs;
|
|
271
|
+
},
|
|
272
|
+
style: {
|
|
273
|
+
position: 'absolute',
|
|
274
|
+
top: '0px',
|
|
275
|
+
left: '0px',
|
|
276
|
+
width: '100%',
|
|
277
|
+
height: '100%',
|
|
278
|
+
zIndex: 1000
|
|
279
|
+
}
|
|
280
|
+
}), loading));
|
|
251
281
|
}
|
|
252
|
-
|
|
253
282
|
function PointLoading(_a) {
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
283
|
+
var _b = _a.text,
|
|
284
|
+
text = _b === void 0 ? 'Loading' : _b,
|
|
285
|
+
_c = _a.pointCount,
|
|
286
|
+
pointCount = _c === void 0 ? 4 : _c,
|
|
287
|
+
_d = _a.speedMs,
|
|
288
|
+
speedMs = _d === void 0 ? 200 : _d;
|
|
259
289
|
var pointStringPool = React.useState(Array.from(Array(pointCount)).map(function (_el, idx) {
|
|
260
290
|
return Array.from(Array(idx + 1)).map(function () {
|
|
261
291
|
return '.';
|
|
262
292
|
}).join('');
|
|
263
293
|
}))[0];
|
|
264
294
|
|
|
265
|
-
var
|
|
266
|
-
pointString =
|
|
267
|
-
setPointString =
|
|
295
|
+
var _e = React.useState(''),
|
|
296
|
+
pointString = _e[0],
|
|
297
|
+
setPointString = _e[1];
|
|
268
298
|
|
|
269
299
|
React.useEffect(function () {
|
|
270
300
|
var pointStringIndex = 0;
|
|
@@ -293,12 +323,210 @@ function PointLoading(_a) {
|
|
|
293
323
|
}
|
|
294
324
|
}, "".concat(text, " ").concat(pointString)));
|
|
295
325
|
}
|
|
326
|
+
function MapLoadingWithImage(_a) {
|
|
327
|
+
var _b = _a.size,
|
|
328
|
+
size = _b === void 0 ? 256 : _b;
|
|
329
|
+
|
|
330
|
+
var _c = React.useState(),
|
|
331
|
+
width = _c[0],
|
|
332
|
+
setWidth = _c[1];
|
|
333
|
+
|
|
334
|
+
var _d = React.useState(),
|
|
335
|
+
height = _d[0],
|
|
336
|
+
setHeight = _d[1];
|
|
337
|
+
|
|
338
|
+
var render = React.useMemo(function () {
|
|
339
|
+
if (!height || !width) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var row = Math.ceil(height / size);
|
|
344
|
+
var col = Math.ceil(width / size);
|
|
345
|
+
console.log('re render', width, height, row, col);
|
|
346
|
+
return Array.from(Array(row)).map(function () {
|
|
347
|
+
return React__default["default"].createElement("div", {
|
|
348
|
+
style: {
|
|
349
|
+
display: 'flex'
|
|
350
|
+
}
|
|
351
|
+
}, Array.from(Array(col)).map(function () {
|
|
352
|
+
var duration = Number((Math.random() * 4).toFixed(1)) + 1;
|
|
353
|
+
var delay = Number((Math.random() * 4).toFixed(1)) + 2;
|
|
354
|
+
return React__default["default"].createElement(LoadingImage, {
|
|
355
|
+
size: size,
|
|
356
|
+
duration: duration,
|
|
357
|
+
delay: delay
|
|
358
|
+
});
|
|
359
|
+
}));
|
|
360
|
+
});
|
|
361
|
+
}, [width, height]);
|
|
362
|
+
return React__default["default"].createElement("div", {
|
|
363
|
+
ref: function (refs) {
|
|
364
|
+
setWidth(refs === null || refs === void 0 ? void 0 : refs.offsetWidth);
|
|
365
|
+
setHeight(refs === null || refs === void 0 ? void 0 : refs.offsetHeight);
|
|
366
|
+
},
|
|
367
|
+
style: {
|
|
368
|
+
width: '100%',
|
|
369
|
+
height: '100%',
|
|
370
|
+
overflow: 'hidden'
|
|
371
|
+
}
|
|
372
|
+
}, render);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function LoadingImage(_a) {
|
|
376
|
+
var _b = _a.size,
|
|
377
|
+
size = _b === void 0 ? 256 : _b,
|
|
378
|
+
_c = _a.duration,
|
|
379
|
+
duration = _c === void 0 ? 1 : _c,
|
|
380
|
+
_d = _a.delay,
|
|
381
|
+
delay = _d === void 0 ? 1 : _d;
|
|
382
|
+
var scale = 256 / 4000;
|
|
383
|
+
return React__default["default"].createElement("svg", {
|
|
384
|
+
className: cn("ani-fade-in"),
|
|
385
|
+
style: {
|
|
386
|
+
flex: "0 0 ".concat(size, "px"),
|
|
387
|
+
opacity: 0,
|
|
388
|
+
animationDelay: "".concat(delay, "s"),
|
|
389
|
+
animationDuration: "".concat(duration, "s"),
|
|
390
|
+
animationFillMode: 'forwards'
|
|
391
|
+
},
|
|
392
|
+
width: size,
|
|
393
|
+
height: size,
|
|
394
|
+
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
395
|
+
fill: "none",
|
|
396
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
397
|
+
}, React__default["default"].createElement("g", {
|
|
398
|
+
transform: "scale(".concat(scale, ")"),
|
|
399
|
+
"clip-path": "url(#clip0_5_701)"
|
|
400
|
+
}, React__default["default"].createElement("rect", {
|
|
401
|
+
width: "4000",
|
|
402
|
+
height: "4000",
|
|
403
|
+
transform: "translate(0 4000) rotate(-90)",
|
|
404
|
+
fill: "#F8F8F8"
|
|
405
|
+
}), React__default["default"].createElement("path", {
|
|
406
|
+
d: "M2996.5 780L3624 309L3928.5 789.5L3422 1080.5L2996.5 780Z",
|
|
407
|
+
fill: "#E6E6E6"
|
|
408
|
+
}), React__default["default"].createElement("path", {
|
|
409
|
+
d: "M522.5 449.5L1156.5 48.4999L1197.5 64.4999L1502.5 485.5L822.5 918L522.5 449.5Z",
|
|
410
|
+
fill: "#F6E4DD"
|
|
411
|
+
}), React__default["default"].createElement("path", {
|
|
412
|
+
d: "M1149.5 1386.5L2468 516L2931.5 1286.5L2966 1415L1650.5 2248L1149.5 1386.5Z",
|
|
413
|
+
fill: "#DCEACA"
|
|
414
|
+
}), React__default["default"].createElement("path", {
|
|
415
|
+
d: "M1840.5 2838.5L2609 2313L3047.5 2599.5L3073.5 2745.5L2176.5 3311L1840.5 2838.5Z",
|
|
416
|
+
fill: "#E6E6E6"
|
|
417
|
+
}), React__default["default"].createElement("path", {
|
|
418
|
+
d: "M594 3013.5L1080.5 2681.5L1744 3615L1162.5 4002.5L594 3013.5Z",
|
|
419
|
+
fill: "#DCEACA"
|
|
420
|
+
}), React__default["default"].createElement("path", {
|
|
421
|
+
d: "M2094.05 1450.88C2127.97 1531.67 2192.23 1496.11 2250.02 1514.4C2567.73 1559.37 2608.68 1362.05 2668.2 1302.01C2736.79 1232.83 2612.15 1065.8 2523.28 1090.46C2434.42 1115.13 2432.96 1150.53 2415.25 1229.76C2397.53 1308.98 2233.45 1247.46 2177.4 1257.03C2121.35 1266.61 2051.65 1349.89 2094.05 1450.88Z",
|
|
422
|
+
fill: "#A2CAEE"
|
|
423
|
+
}), React__default["default"].createElement("circle", {
|
|
424
|
+
cx: "958",
|
|
425
|
+
cy: "3092",
|
|
426
|
+
r: "95",
|
|
427
|
+
fill: "#A2CAEE"
|
|
428
|
+
}), React__default["default"].createElement("circle", {
|
|
429
|
+
cx: "1127",
|
|
430
|
+
cy: "3176",
|
|
431
|
+
r: "56",
|
|
432
|
+
fill: "#A2CAEE"
|
|
433
|
+
}), React__default["default"].createElement("path", {
|
|
434
|
+
"fill-rule": "evenodd",
|
|
435
|
+
"clip-rule": "evenodd",
|
|
436
|
+
d: "M3459.68 1085.96L4058.54 2069.19L4001.32 2104.04L3402.46 1120.82L3459.68 1085.96Z",
|
|
437
|
+
fill: "white"
|
|
438
|
+
}), React__default["default"].createElement("path", {
|
|
439
|
+
"fill-rule": "evenodd",
|
|
440
|
+
"clip-rule": "evenodd",
|
|
441
|
+
d: "M-317.721 1447.99L595.333 2953.94L1201.76 4004.26L1143.74 4037.76L537.668 2988.06L-375.013 1482.72L-317.721 1447.99ZM1058.06 1406.15L1789.22 920.04L1109.17 -5.66436L1163.17 -45.3311L1844.92 882.695L2486.62 448.527L3047.72 1427.91L2989.59 1461.22L2464.38 544.474L1855.66 956.322L1855.55 956.398L1095.15 1461.94L1058.06 1406.15ZM1384.39 3114.5L2197.8 2552.05L1838.4 2105.93L1890.57 2063.9L2253.06 2513.84L2642 2244.89L2680.11 2300L1883.89 2850.56L2238.69 3352.52L2183.98 3391.19L1828.78 2888.67L1422.5 3169.61L1384.39 3114.5Z",
|
|
442
|
+
fill: "white"
|
|
443
|
+
}), React__default["default"].createElement("path", {
|
|
444
|
+
"fill-rule": "evenodd",
|
|
445
|
+
"clip-rule": "evenodd",
|
|
446
|
+
d: "M-100.246 749.04L1266.96 -152.746L1346.25 -32.5396L-20.9597 869.247L-100.246 749.04Z",
|
|
447
|
+
fill: "#FBEDB1"
|
|
448
|
+
}), React__default["default"].createElement("path", {
|
|
449
|
+
"fill-rule": "evenodd",
|
|
450
|
+
"clip-rule": "evenodd",
|
|
451
|
+
d: "M5229.83 1392.22L2830.78 2477.33L2803.17 2416.28L5202.22 1331.17L5229.83 1392.22Z",
|
|
452
|
+
fill: "white"
|
|
453
|
+
}), React__default["default"].createElement("path", {
|
|
454
|
+
"fill-rule": "evenodd",
|
|
455
|
+
"clip-rule": "evenodd",
|
|
456
|
+
d: "M2486.94 449.315L3519.19 1097.44L3483.56 1154.18L2451.32 506.057L2486.94 449.315Z",
|
|
457
|
+
fill: "white"
|
|
458
|
+
}), React__default["default"].createElement("path", {
|
|
459
|
+
"fill-rule": "evenodd",
|
|
460
|
+
"clip-rule": "evenodd",
|
|
461
|
+
d: "M2352.16 -273.141L2533.64 518.164L2468.34 533.141L2286.86 -258.164L2352.16 -273.141Z",
|
|
462
|
+
fill: "white"
|
|
463
|
+
}), React__default["default"].createElement("path", {
|
|
464
|
+
"fill-rule": "evenodd",
|
|
465
|
+
"clip-rule": "evenodd",
|
|
466
|
+
d: "M2237.62 3336.43L2440.07 4086.61L2375.39 4104.07L2172.93 3353.89L2237.62 3336.43Z",
|
|
467
|
+
fill: "white"
|
|
468
|
+
}), React__default["default"].createElement("path", {
|
|
469
|
+
"fill-rule": "evenodd",
|
|
470
|
+
"clip-rule": "evenodd",
|
|
471
|
+
d: "M1204.91 1396.51L-54.5055 1973.41L-82.4082 1912.49L1177.01 1335.59L1204.91 1396.51Z",
|
|
472
|
+
fill: "white"
|
|
473
|
+
}), React__default["default"].createElement("path", {
|
|
474
|
+
"fill-rule": "evenodd",
|
|
475
|
+
"clip-rule": "evenodd",
|
|
476
|
+
d: "M2694.5 2950.14L4158.86 4928.5L4105.01 4968.36L2640.64 2990L2694.5 2950.14Z",
|
|
477
|
+
fill: "white"
|
|
478
|
+
}), React__default["default"].createElement("path", {
|
|
479
|
+
"fill-rule": "evenodd",
|
|
480
|
+
"clip-rule": "evenodd",
|
|
481
|
+
d: "M3441.72 -42.6462L3995.65 846.725L3938.77 882.146L3384.85 -7.2254L3441.72 -42.6462Z",
|
|
482
|
+
fill: "white"
|
|
483
|
+
}), React__default["default"].createElement("path", {
|
|
484
|
+
"fill-rule": "evenodd",
|
|
485
|
+
"clip-rule": "evenodd",
|
|
486
|
+
d: "M2282.81 3631.14L2925.81 3304.14L2956.19 3363.86L2313.19 3690.86L2282.81 3631.14Z",
|
|
487
|
+
fill: "white"
|
|
488
|
+
}), React__default["default"].createElement("path", {
|
|
489
|
+
"fill-rule": "evenodd",
|
|
490
|
+
"clip-rule": "evenodd",
|
|
491
|
+
d: "M466.178 1695.89L522.822 1660.11L813.709 2120.58L1365.65 1773.15L1401.35 1829.85L849.492 2177.23L1140.32 2637.61L1083.68 2673.39L466.178 1695.89Z",
|
|
492
|
+
fill: "white"
|
|
493
|
+
}), React__default["default"].createElement("path", {
|
|
494
|
+
"fill-rule": "evenodd",
|
|
495
|
+
"clip-rule": "evenodd",
|
|
496
|
+
d: "M790.24 914.745L1475.24 451.745L1512.76 507.255L827.76 970.255L790.24 914.745Z",
|
|
497
|
+
fill: "white"
|
|
498
|
+
}), React__default["default"].createElement("path", {
|
|
499
|
+
"fill-rule": "evenodd",
|
|
500
|
+
"clip-rule": "evenodd",
|
|
501
|
+
d: "M3410.6 2192.45L2986.6 1469.45L3044.4 1435.55L3468.4 2158.55L3410.6 2192.45Z",
|
|
502
|
+
fill: "white"
|
|
503
|
+
}), React__default["default"].createElement("path", {
|
|
504
|
+
"fill-rule": "evenodd",
|
|
505
|
+
"clip-rule": "evenodd",
|
|
506
|
+
d: "M3637.26 329.182L3012.26 803.682L2971.74 750.318L3596.74 275.818L3637.26 329.182Z",
|
|
507
|
+
fill: "white"
|
|
508
|
+
}), React__default["default"].createElement("path", {
|
|
509
|
+
"fill-rule": "evenodd",
|
|
510
|
+
"clip-rule": "evenodd",
|
|
511
|
+
d: "M-102.531 3333.52L1563.16 2259.21L418.867 413.751L541.25 337.866L1684.19 2181.14L4025.32 666.934L4103.57 787.82L2336.63 1931.51L3187.41 2659.17L4104.73 3340.1L4018.9 3455.73L3139.75 2803.13L956.929 4221.62L878.381 4100.93L1666.1 3588.26L1086.77 2737.81L-24.4816 3454.53L-102.531 3333.52ZM1207.82 2659.74L1786.86 3509.76L3022.47 2707.58L2210.46 2013.07L1207.82 2659.74Z",
|
|
512
|
+
fill: "#FBEDB1"
|
|
513
|
+
})), React__default["default"].createElement("defs", null, React__default["default"].createElement("clipPath", {
|
|
514
|
+
id: "clip0_5_701"
|
|
515
|
+
}, React__default["default"].createElement("rect", {
|
|
516
|
+
width: "4000",
|
|
517
|
+
height: "4000",
|
|
518
|
+
fill: "white",
|
|
519
|
+
transform: "translate(0 4000) rotate(-90)"
|
|
520
|
+
}))));
|
|
521
|
+
}
|
|
296
522
|
|
|
297
523
|
exports.Bounds = Bounds;
|
|
298
524
|
exports.Drawable = Drawable;
|
|
525
|
+
exports.MapLoadingWithImage = MapLoadingWithImage;
|
|
299
526
|
exports.Marker = Marker;
|
|
300
527
|
exports.MintMap = MintMap;
|
|
301
528
|
exports.Offset = Offset;
|
|
529
|
+
exports.PointLoading = PointLoading;
|
|
302
530
|
exports.Polygon = Polygon;
|
|
303
531
|
exports.Polyline = Polyline;
|
|
304
532
|
exports.Position = Position;
|
|
@@ -32,7 +32,8 @@ export declare abstract class MintMapController {
|
|
|
32
32
|
getMapType(): MapType;
|
|
33
33
|
positionToOffset(position: Position): Offset;
|
|
34
34
|
offsetToPosition(offset: Offset): Position;
|
|
35
|
-
loadScript(url: string, id
|
|
35
|
+
loadScript(url: string, id: string, checkLoaded: () => boolean): Promise<boolean>;
|
|
36
|
+
getRandomFunctionName(prefix: string): string;
|
|
36
37
|
buildUrl(baseUrl: string, param: {
|
|
37
38
|
[key: string]: string | string[];
|
|
38
39
|
}): string;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var MintMap = require('../MintMap.js');
|
|
7
|
+
var uuid = require('uuid');
|
|
7
8
|
|
|
8
9
|
var MintMapController = function () {
|
|
9
10
|
function MintMapController(props) {
|
|
@@ -53,12 +54,21 @@ var MintMapController = function () {
|
|
|
53
54
|
return new MintMap.Position(latVal, lngVal);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
MintMapController.prototype.loadScript = function (url, id) {
|
|
57
|
+
MintMapController.prototype.loadScript = function (url, id, checkLoaded) {
|
|
57
58
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
58
59
|
return tslib.__generator(this, function (_a) {
|
|
59
60
|
return [2, new Promise(function (resolve) {
|
|
60
|
-
if (
|
|
61
|
-
resolve();
|
|
61
|
+
if (checkLoaded()) {
|
|
62
|
+
resolve(false);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var prevElement = id ? document.getElementById(id) : undefined;
|
|
67
|
+
|
|
68
|
+
if (prevElement) {
|
|
69
|
+
prevElement.addEventListener('load', function () {
|
|
70
|
+
resolve(false);
|
|
71
|
+
});
|
|
62
72
|
return;
|
|
63
73
|
}
|
|
64
74
|
|
|
@@ -66,8 +76,9 @@ var MintMapController = function () {
|
|
|
66
76
|
script.src = url;
|
|
67
77
|
script.async = true;
|
|
68
78
|
script.defer = true;
|
|
79
|
+
id && (script.id = id);
|
|
69
80
|
script.addEventListener('load', function () {
|
|
70
|
-
resolve();
|
|
81
|
+
resolve(true);
|
|
71
82
|
});
|
|
72
83
|
document.body.appendChild(script);
|
|
73
84
|
})];
|
|
@@ -75,6 +86,10 @@ var MintMapController = function () {
|
|
|
75
86
|
});
|
|
76
87
|
};
|
|
77
88
|
|
|
89
|
+
MintMapController.prototype.getRandomFunctionName = function (prefix) {
|
|
90
|
+
return "".concat(prefix, "_").concat(uuid.v4().replace(/-/g, '_'));
|
|
91
|
+
};
|
|
92
|
+
|
|
78
93
|
MintMapController.prototype.buildUrl = function (baseUrl, param) {
|
|
79
94
|
var params = Object.entries(param).map(function (_a) {
|
|
80
95
|
var key = _a[0],
|
|
@@ -25,6 +25,7 @@ export declare class GoogleMintMapController extends MintMapController {
|
|
|
25
25
|
private dragged;
|
|
26
26
|
isMapDragged(): boolean;
|
|
27
27
|
setMapDragged(value: boolean): void;
|
|
28
|
+
private checkLoaded;
|
|
28
29
|
loadMapApi(): Promise<boolean>;
|
|
29
30
|
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
30
31
|
destroyMap: () => void;
|
|
@@ -310,6 +310,12 @@ var GoogleMintMapController = function (_super) {
|
|
|
310
310
|
this.dragged = false;
|
|
311
311
|
};
|
|
312
312
|
|
|
313
|
+
GoogleMintMapController.prototype.checkLoaded = function () {
|
|
314
|
+
var _a, _b, _c;
|
|
315
|
+
|
|
316
|
+
return (_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.marker) === null || _c === void 0 ? void 0 : _c.AdvancedMarkerView;
|
|
317
|
+
};
|
|
318
|
+
|
|
313
319
|
GoogleMintMapController.prototype.loadMapApi = function () {
|
|
314
320
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
315
321
|
var _this = this;
|
|
@@ -317,11 +323,11 @@ var GoogleMintMapController = function (_super) {
|
|
|
317
323
|
return tslib.__generator(this, function (_a) {
|
|
318
324
|
return [2, new Promise(function (resolve) {
|
|
319
325
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
320
|
-
var callbackName, loaded, params, ok;
|
|
326
|
+
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
321
327
|
return tslib.__generator(this, function (_a) {
|
|
322
328
|
switch (_a.label) {
|
|
323
329
|
case 0:
|
|
324
|
-
callbackName =
|
|
330
|
+
callbackName = this.getRandomFunctionName('load_google');
|
|
325
331
|
loaded = false;
|
|
326
332
|
|
|
327
333
|
window[callbackName] = function () {
|
|
@@ -335,10 +341,15 @@ var GoogleMintMapController = function (_super) {
|
|
|
335
341
|
v: 'beta',
|
|
336
342
|
callback: callbackName
|
|
337
343
|
};
|
|
338
|
-
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), '
|
|
344
|
+
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'google_map_script', this.checkLoaded)];
|
|
339
345
|
|
|
340
346
|
case 1:
|
|
341
|
-
_a.sent();
|
|
347
|
+
callbackExecFlag = _a.sent();
|
|
348
|
+
|
|
349
|
+
if (!callbackExecFlag) {
|
|
350
|
+
loaded = true;
|
|
351
|
+
delete window[callbackName];
|
|
352
|
+
}
|
|
342
353
|
|
|
343
354
|
return [4, waiting.waiting(function () {
|
|
344
355
|
return loaded;
|
|
@@ -28,6 +28,7 @@ export declare class KakaoMintMapController extends MintMapController {
|
|
|
28
28
|
private dragged;
|
|
29
29
|
isMapDragged(): boolean;
|
|
30
30
|
setMapDragged(value: boolean): void;
|
|
31
|
+
private checkLoaded;
|
|
31
32
|
loadMapApi(): Promise<boolean>;
|
|
32
33
|
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
33
34
|
private getSafeZoomValue;
|
|
@@ -305,6 +305,12 @@ var KakaoMintMapController = function (_super) {
|
|
|
305
305
|
this.dragged = false;
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
+
KakaoMintMapController.prototype.checkLoaded = function () {
|
|
309
|
+
var _a, _b;
|
|
310
|
+
|
|
311
|
+
return (_b = (_a = window.kakao) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
312
|
+
};
|
|
313
|
+
|
|
308
314
|
KakaoMintMapController.prototype.loadMapApi = function () {
|
|
309
315
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
310
316
|
var _this = this;
|
|
@@ -313,6 +319,9 @@ var KakaoMintMapController = function (_super) {
|
|
|
313
319
|
return [2, new Promise(function (resolve) {
|
|
314
320
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
315
321
|
var params, ok;
|
|
322
|
+
|
|
323
|
+
var _this = this;
|
|
324
|
+
|
|
316
325
|
return tslib.__generator(this, function (_a) {
|
|
317
326
|
switch (_a.label) {
|
|
318
327
|
case 0:
|
|
@@ -321,14 +330,14 @@ var KakaoMintMapController = function (_super) {
|
|
|
321
330
|
libraries: this.scriptModules.join(','),
|
|
322
331
|
autoload: false
|
|
323
332
|
};
|
|
324
|
-
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), '
|
|
333
|
+
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'kakao_map_script', this.checkLoaded)];
|
|
325
334
|
|
|
326
335
|
case 1:
|
|
327
336
|
_a.sent();
|
|
328
337
|
|
|
329
338
|
window.kakao.maps.load();
|
|
330
339
|
return [4, waiting.waiting(function () {
|
|
331
|
-
return
|
|
340
|
+
return _this.checkLoaded() ? true : false;
|
|
332
341
|
})];
|
|
333
342
|
|
|
334
343
|
case 2:
|
|
@@ -28,6 +28,7 @@ export declare class NaverMintMapController extends MintMapController {
|
|
|
28
28
|
private dragged;
|
|
29
29
|
isMapDragged(): boolean;
|
|
30
30
|
setMapDragged(value: boolean): void;
|
|
31
|
+
private checkLoaded;
|
|
31
32
|
loadMapApi(): Promise<boolean>;
|
|
32
33
|
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
33
34
|
private getSafeZoomValue;
|
|
@@ -303,6 +303,12 @@ var NaverMintMapController = function (_super) {
|
|
|
303
303
|
this.dragged = false;
|
|
304
304
|
};
|
|
305
305
|
|
|
306
|
+
NaverMintMapController.prototype.checkLoaded = function () {
|
|
307
|
+
var _a, _b;
|
|
308
|
+
|
|
309
|
+
return (_b = (_a = window.naver) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map;
|
|
310
|
+
};
|
|
311
|
+
|
|
306
312
|
NaverMintMapController.prototype.loadMapApi = function () {
|
|
307
313
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
308
314
|
var _this = this;
|
|
@@ -310,11 +316,11 @@ var NaverMintMapController = function (_super) {
|
|
|
310
316
|
return tslib.__generator(this, function (_a) {
|
|
311
317
|
return [2, new Promise(function (resolve, error) {
|
|
312
318
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
313
|
-
var callbackName, loaded, params, ok;
|
|
319
|
+
var callbackName, loaded, params, callbackExecFlag, ok;
|
|
314
320
|
return tslib.__generator(this, function (_a) {
|
|
315
321
|
switch (_a.label) {
|
|
316
322
|
case 0:
|
|
317
|
-
callbackName =
|
|
323
|
+
callbackName = this.getRandomFunctionName('load_naver');
|
|
318
324
|
loaded = false;
|
|
319
325
|
|
|
320
326
|
window[callbackName] = function () {
|
|
@@ -327,10 +333,15 @@ var NaverMintMapController = function (_super) {
|
|
|
327
333
|
submodules: this.scriptModules.join(','),
|
|
328
334
|
callback: callbackName
|
|
329
335
|
};
|
|
330
|
-
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), '
|
|
336
|
+
return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'naver_map_script', this.checkLoaded)];
|
|
331
337
|
|
|
332
338
|
case 1:
|
|
333
|
-
_a.sent();
|
|
339
|
+
callbackExecFlag = _a.sent();
|
|
340
|
+
|
|
341
|
+
if (!callbackExecFlag) {
|
|
342
|
+
loaded = true;
|
|
343
|
+
delete window[callbackName];
|
|
344
|
+
}
|
|
334
345
|
|
|
335
346
|
return [4, waiting.waiting(function () {
|
|
336
347
|
return loaded;
|