@mint-ui/map 0.1.1-beta → 0.1.2-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.
Files changed (34) hide show
  1. package/dist/components/mint-map/MintMap.d.ts +2 -2
  2. package/dist/components/mint-map/MintMap.js +69 -49
  3. package/dist/components/mint-map/core/MintMapController.d.ts +1 -1
  4. package/dist/components/mint-map/core/MintMapController.js +3 -1
  5. package/dist/components/mint-map/core/MintMapCore.d.ts +1 -1
  6. package/dist/components/mint-map/core/MintMapCore.js +3 -1
  7. package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +4 -4
  8. package/dist/components/mint-map/core/advanced/index.d.ts +1 -0
  9. package/dist/components/mint-map/core/hooks/index.d.ts +1 -0
  10. package/dist/components/mint-map/core/index.d.ts +7 -7
  11. package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +2 -2
  12. package/dist/components/mint-map/core/provider/MintMapProvider.js +1 -1
  13. package/dist/components/mint-map/core/provider/index.d.ts +1 -0
  14. package/dist/components/mint-map/core/util/index.d.ts +3 -0
  15. package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
  16. package/dist/components/mint-map/core/util/waiting.js +33 -0
  17. package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +1 -1
  18. package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +3 -1
  19. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +1 -1
  20. package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +3 -1
  21. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +1 -1
  22. package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +3 -1
  23. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +1 -1
  24. package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +3 -1
  25. package/dist/components/mint-map/core/wrapper/index.d.ts +4 -0
  26. package/dist/components/mint-map/google/GoogleMintMapController.d.ts +2 -2
  27. package/dist/components/mint-map/google/GoogleMintMapController.js +431 -0
  28. package/dist/components/mint-map/index.d.ts +3 -1
  29. package/dist/components/mint-map/naver/NaverMintMapController.d.ts +2 -2
  30. package/dist/components/mint-map/naver/NaverMintMapController.js +427 -0
  31. package/dist/index.es.js +1095 -197
  32. package/dist/index.js +32 -9
  33. package/dist/index.umd.js +1109 -195
  34. package/package.json +1 -1
package/dist/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  value: controller
23
23
  }, children);
24
24
  }
25
- function MintMapProvider.useMintMapController() {
25
+ function useMintMapController() {
26
26
  var controller = React.useContext(MintMapControllerContext);
27
27
 
28
28
  if (controller === null) {
@@ -44,7 +44,7 @@
44
44
  _b = _a.visible,
45
45
  visible = _b === void 0 ? true : _b,
46
46
  children = _a.children;
47
- var controller = MintMapProvider.useMintMapController();
47
+ var controller = useMintMapController();
48
48
  var elementRef = React.useRef(null);
49
49
 
50
50
  var _c = React.useState(false),
@@ -129,7 +129,7 @@
129
129
  }
130
130
 
131
131
  if (maxX && minX && maxY && minY) {
132
- return new MintMap.Position(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
132
+ return new Position(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
133
133
  }
134
134
 
135
135
  throw new Error('Calculate Center Error!!!');
@@ -178,7 +178,7 @@
178
178
  return PolygonCalculator;
179
179
  }();
180
180
 
181
- var calculate.GeoCalulator = function () {
181
+ var GeoCalulator = function () {
182
182
  function GeoCalulator() {}
183
183
 
184
184
  GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
@@ -234,7 +234,7 @@
234
234
  var ratio = nextDistance / totalDistance;
235
235
  var latCalib = pos2.lat > pos1.lat ? 1 : -1;
236
236
  var lngCalib = pos2.lng > pos1.lng ? 1 : -1;
237
- var newPos = new MintMap.Position(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
237
+ var newPos = new Position(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
238
238
 
239
239
  if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
240
240
  newPos = pos2;
@@ -250,7 +250,922 @@
250
250
  return GeoCalulator;
251
251
  }();
252
252
 
253
- var MintMap.Position = function () {
253
+ var MintMapController = function () {
254
+ function MintMapController(props) {
255
+ this.mapApiLoaded = false;
256
+ this.mapInitialized = false;
257
+ this.mapProps = props;
258
+ }
259
+
260
+ MintMapController.prototype.getMap = function () {
261
+ return this.map;
262
+ };
263
+
264
+ MintMapController.prototype.getMapType = function () {
265
+ return this.type;
266
+ };
267
+
268
+ MintMapController.prototype.loadScript = function (url, id) {
269
+ return tslib.__awaiter(this, void 0, void 0, function () {
270
+ return tslib.__generator(this, function (_a) {
271
+ return [2, new Promise(function (resolve) {
272
+ if (id && document.getElementById(id)) {
273
+ console.log("already loaded script => ".concat(id));
274
+ resolve();
275
+ return;
276
+ }
277
+
278
+ var script = document.createElement('script');
279
+ script.src = url;
280
+ script.async = true;
281
+ script.defer = true;
282
+ script.addEventListener('load', function () {
283
+ resolve();
284
+ });
285
+ document.body.appendChild(script);
286
+ })];
287
+ });
288
+ });
289
+ };
290
+
291
+ MintMapController.prototype.buildUrl = function (baseUrl, param) {
292
+ var params = Object.entries(param).map(function (_a) {
293
+ var key = _a[0],
294
+ value = _a[1];
295
+ var temp = encodeURIComponent(Array.isArray(value) ? value.join(',') : value);
296
+ return "".concat(key, "=").concat(temp);
297
+ }).join('&');
298
+ return "".concat(baseUrl, "?").concat(params);
299
+ };
300
+
301
+ return MintMapController;
302
+ }();
303
+
304
+ function waiting(evaluation, timeoutSeconds) {
305
+ return tslib.__awaiter(this, void 0, void 0, function () {
306
+ var max;
307
+ return tslib.__generator(this, function (_a) {
308
+ max = (timeoutSeconds || 5) * 1000;
309
+ return [2, new Promise(function (resolve) {
310
+ var start = new Date().getTime();
311
+ var inter = setInterval(function () {
312
+ var time = new Date().getTime();
313
+
314
+ if (time - start > max) {
315
+ clearInterval(inter);
316
+ resolve(false);
317
+ return;
318
+ }
319
+
320
+ if (evaluation()) {
321
+ clearInterval(inter);
322
+ resolve(true);
323
+ }
324
+ }, 100);
325
+ })];
326
+ });
327
+ });
328
+ }
329
+
330
+ var NaverMintMapController = function (_super) {
331
+ tslib.__extends(NaverMintMapController, _super);
332
+
333
+ function NaverMintMapController(props) {
334
+ var _this = _super.call(this, props) || this;
335
+
336
+ _this.type = 'naver';
337
+ _this.map = null;
338
+ _this.scriptUrl = 'https://openapi.map.naver.com/openapi/v3/maps.js';
339
+ _this.scriptModules = ['drawing'];
340
+ _this.polylineEvents = ['mouseover', 'mouseout'];
341
+ _this.polygonEvents = ['mouseover', 'mouseout'];
342
+ _this.markerEvents = ['click', 'mouseover', 'mouseout'];
343
+ _this.dragStartPoint = [0, 0];
344
+ _this.dragged = false;
345
+ console.log("".concat(_this.type, " controller loadded"));
346
+ return _this;
347
+ }
348
+
349
+ NaverMintMapController.prototype.createPolyline = function (polyline) {
350
+ var _this = this;
351
+
352
+ var _a = polyline.options,
353
+ position = _a.position,
354
+ _b = _a.lineColor,
355
+ lineColor = _b === void 0 ? 'blue' : _b,
356
+ _c = _a.lineSize,
357
+ lineSize = _c === void 0 ? 1 : _c,
358
+ _d = _a.lineOpacity,
359
+ lineOpacity = _d === void 0 ? 1 : _d,
360
+ _e = _a.visible,
361
+ visible = _e === void 0 ? true : _e,
362
+ _f = _a.editable,
363
+ editable = _f === void 0 ? false : _f,
364
+ event = _a.event;
365
+
366
+ if (this.map && Array.isArray(position)) {
367
+ var path = position.map(function (elem) {
368
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
369
+ });
370
+ var pol_1 = new naver.maps.Polyline({
371
+ map: this.map,
372
+ path: path,
373
+ strokeColor: lineColor,
374
+ strokeWeight: lineSize,
375
+ strokeOpacity: lineOpacity,
376
+ clickable: true,
377
+ visible: visible
378
+ });
379
+ editable && pol_1.setEditable(editable);
380
+ polyline.native = pol_1;
381
+ event && event.forEach(function (handler, key) {
382
+ if (_this.polylineEvents.includes(key)) {
383
+ naver.maps.Event.addListener(pol_1, key, handler);
384
+ }
385
+ });
386
+ }
387
+ };
388
+
389
+ NaverMintMapController.prototype.updatePolyline = function (polyline, options) {
390
+ if (polyline && polyline.native && polyline.native instanceof naver.maps.Polyline) {
391
+ var path = void 0;
392
+
393
+ if (Array.isArray(options.position)) {
394
+ path = options.position.map(function (elem) {
395
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
396
+ });
397
+ }
398
+
399
+ polyline.native.setOptions({
400
+ path: path || polyline.native.getPath(),
401
+ visible: options.visible === undefined || options.visible,
402
+ strokeColor: options.lineColor,
403
+ strokeWeight: options.lineSize,
404
+ strokeOpacity: options.lineOpacity
405
+ });
406
+ options.editable !== undefined && polyline.native.setEditable(options.editable);
407
+ }
408
+ };
409
+
410
+ NaverMintMapController.prototype.createPolygon = function (polygon) {
411
+ var _this = this;
412
+
413
+ var _a = polygon.options,
414
+ position = _a.position,
415
+ innerPositions = _a.innerPositions,
416
+ _b = _a.lineColor,
417
+ lineColor = _b === void 0 ? 'green' : _b,
418
+ _c = _a.lineSize,
419
+ lineSize = _c === void 0 ? 1 : _c,
420
+ _d = _a.lineOpacity,
421
+ lineOpacity = _d === void 0 ? 1 : _d,
422
+ _e = _a.fillColor,
423
+ fillColor = _e === void 0 ? 'lightgreen' : _e,
424
+ _f = _a.fillOpacity,
425
+ fillOpacity = _f === void 0 ? 0.5 : _f,
426
+ _g = _a.visible,
427
+ visible = _g === void 0 ? true : _g;
428
+ _a.editable;
429
+ var event = _a.event;
430
+
431
+ if (this.map && Array.isArray(position)) {
432
+ var outLine = position.map(function (elem) {
433
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
434
+ });
435
+ var paths = innerPositions ? tslib.__spreadArray([outLine], innerPositions, true) : [outLine];
436
+ var pol_2 = new naver.maps.Polygon({
437
+ map: this.map,
438
+ paths: paths,
439
+ strokeColor: lineColor,
440
+ strokeWeight: lineSize,
441
+ strokeOpacity: lineOpacity,
442
+ fillColor: fillColor,
443
+ fillOpacity: fillOpacity,
444
+ clickable: true,
445
+ visible: visible
446
+ });
447
+ polygon.native = pol_2;
448
+ event && event.forEach(function (handler, key) {
449
+ if (_this.polygonEvents.includes(key)) {
450
+ naver.maps.Event.addListener(pol_2, key, handler);
451
+ }
452
+ });
453
+ }
454
+ };
455
+
456
+ NaverMintMapController.prototype.updatePolygon = function (polygon, options) {
457
+ if (polygon && polygon.native && polygon.native instanceof naver.maps.Polygon) {
458
+ polygon.native.setOptions({
459
+ paths: polygon.native.getPaths(),
460
+ visible: options.visible === undefined || options.visible,
461
+ strokeColor: options.lineColor,
462
+ strokeWeight: options.lineSize,
463
+ strokeOpacity: options.lineOpacity,
464
+ fillColor: options.fillColor,
465
+ fillOpacity: options.fillOpacity
466
+ });
467
+ options.editable !== undefined && polygon.native.setEditable(options.editable);
468
+ }
469
+ };
470
+
471
+ NaverMintMapController.prototype.createMarker = function (marker) {
472
+ var _this = this;
473
+
474
+ var _a;
475
+
476
+ if (this.map) {
477
+ var options = {
478
+ map: this.map,
479
+ position: marker.options.position,
480
+ visible: marker.options.visible === undefined || marker.options.visible
481
+ };
482
+ marker.element && (options.icon = {
483
+ content: marker.element,
484
+ anchor: marker.options.anchor
485
+ });
486
+ var naverMarker_1 = new naver.maps.Marker(options);
487
+ marker.native = naverMarker_1;
488
+ ((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
489
+ if (_this.markerEvents.includes(key)) {
490
+ naver.maps.Event.addListener(naverMarker_1, key, handler);
491
+ }
492
+ });
493
+ }
494
+ };
495
+
496
+ NaverMintMapController.prototype.updateMarker = function (marker, options) {
497
+ if (marker && marker.native && marker.native instanceof naver.maps.Marker) {
498
+ var map = marker.native.getMap();
499
+
500
+ if (map) {
501
+ var newOption = {
502
+ map: map,
503
+ position: options.position instanceof Position ? options.position : marker.native.getPosition(),
504
+ visible: options.visible === undefined || options.visible
505
+ };
506
+
507
+ if (options.anchor) {
508
+ newOption.icon = tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
509
+ anchor: options.anchor
510
+ });
511
+ }
512
+
513
+ marker.native.setOptions({
514
+ map: map,
515
+ position: options.position instanceof Position ? options.position : marker.native.getPosition(),
516
+ visible: options.visible === undefined || options.visible,
517
+ icon: tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
518
+ anchor: options.anchor
519
+ })
520
+ });
521
+ }
522
+ }
523
+ };
524
+
525
+ NaverMintMapController.prototype.getMaxZIndex = function (increment) {
526
+ if (increment === void 0) {
527
+ increment = 0;
528
+ }
529
+
530
+ if (this.map) {
531
+ var targetPane = this.map.getPanes().overlayImage;
532
+ var max = 0;
533
+
534
+ for (var i = 0; i < targetPane.childElementCount; i++) {
535
+ var elem = targetPane.children[i];
536
+
537
+ if (elem instanceof HTMLElement) {
538
+ var index = Number(elem.style.zIndex);
539
+
540
+ if (!isNaN(index) && index > max) {
541
+ max = index;
542
+ }
543
+ }
544
+ }
545
+
546
+ this.markerMaxZIndex = max + increment;
547
+ return this.markerMaxZIndex;
548
+ } else {
549
+ return this.markerMaxZIndex || 1;
550
+ }
551
+ };
552
+
553
+ NaverMintMapController.prototype.markerToTheTop = function (marker) {
554
+ if (this.map && marker.element && marker.element instanceof HTMLElement) {
555
+ var parent_1 = marker.element.parentElement;
556
+
557
+ if (parent_1) {
558
+ parent_1.style.zIndex = String(this.getMaxZIndex(1));
559
+ }
560
+ }
561
+ };
562
+
563
+ NaverMintMapController.prototype.clearDrawable = function (drawable) {
564
+ if (drawable && drawable.native && drawable.native instanceof naver.maps.OverlayView) {
565
+ drawable.native.setMap(null);
566
+ return true;
567
+ }
568
+
569
+ return false;
570
+ };
571
+
572
+ NaverMintMapController.prototype.isMapDragged = function () {
573
+ return this.dragged;
574
+ };
575
+
576
+ NaverMintMapController.prototype.setMapDragged = function (value) {
577
+ this.dragged = false;
578
+ };
579
+
580
+ NaverMintMapController.prototype.loadMapApi = function () {
581
+ return tslib.__awaiter(this, void 0, void 0, function () {
582
+ var _this = this;
583
+
584
+ return tslib.__generator(this, function (_a) {
585
+ return [2, new Promise(function (resolve) {
586
+ return tslib.__awaiter(_this, void 0, void 0, function () {
587
+ var callbackName, loaded, params, ok;
588
+ return tslib.__generator(this, function (_a) {
589
+ switch (_a.label) {
590
+ case 0:
591
+ callbackName = "load".concat(new Date().getTime());
592
+ loaded = false;
593
+
594
+ window[callbackName] = function () {
595
+ console.log('naver api loaded');
596
+ loaded = true;
597
+ delete window[callbackName];
598
+ };
599
+
600
+ params = {
601
+ ncpClientId: this.mapProps.mapKey,
602
+ submodules: this.scriptModules.join(','),
603
+ callback: callbackName
604
+ };
605
+ return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'naverscript')];
606
+
607
+ case 1:
608
+ _a.sent();
609
+
610
+ return [4, waiting(function () {
611
+ return loaded;
612
+ })];
613
+
614
+ case 2:
615
+ ok = _a.sent();
616
+
617
+ if (!ok) {
618
+ throw new Error('naver script api load failed!!');
619
+ }
620
+
621
+ this.mapApiLoaded = true;
622
+ resolve(true);
623
+ console.log("".concat(this.type, " map script loaded"));
624
+ return [2];
625
+ }
626
+ });
627
+ });
628
+ })];
629
+ });
630
+ });
631
+ };
632
+
633
+ NaverMintMapController.prototype.initializingMap = function (divElement) {
634
+ return tslib.__awaiter(this, void 0, void 0, function () {
635
+ var _this = this;
636
+
637
+ return tslib.__generator(this, function (_a) {
638
+ return [2, new Promise(function (resolve) {
639
+ return tslib.__awaiter(_this, void 0, void 0, function () {
640
+ var map;
641
+
642
+ var _this = this;
643
+
644
+ var _a, _b;
645
+
646
+ return tslib.__generator(this, function (_c) {
647
+ switch (_c.label) {
648
+ case 0:
649
+ if (this.mapInitialized && this.map) {
650
+ if (this.map.getElement() === divElement) {
651
+ resolve(this.map);
652
+ return [2];
653
+ } else {
654
+ this.map.destroy();
655
+ }
656
+ }
657
+
658
+ if (!!this.mapApiLoaded) return [3, 2];
659
+ return [4, this.loadMapApi()];
660
+
661
+ case 1:
662
+ _c.sent();
663
+
664
+ _c.label = 2;
665
+
666
+ case 2:
667
+ map = new naver.maps.Map(divElement, {
668
+ center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
669
+ zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
670
+ logoControl: false,
671
+ mapDataControl: false,
672
+ mapTypeControl: false,
673
+ scaleControl: false
674
+ });
675
+ map.addListener('dragstart', function (e) {
676
+ _this.dragStartPoint[0] = e.domEvent.clientX;
677
+ _this.dragStartPoint[1] = e.domEvent.clientY;
678
+ });
679
+ map.addListener('dragend', function (e) {
680
+ if (_this.dragStartPoint[0] === e.domEvent.clientX && _this.dragStartPoint[1] === e.domEvent.clientY) {
681
+ _this.dragged = false;
682
+ } else {
683
+ _this.dragged = true;
684
+ }
685
+
686
+ _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
687
+ });
688
+ map.addListener('zoom_changed', function () {
689
+ _this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom());
690
+ _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
691
+ });
692
+ map.addListener('click', function (e) {
693
+ console.log('map click', e);
694
+ var pos = new Position(e.coord.y, e.coord.x);
695
+ pos.offset = new Offset(e.offset.x, e.offset.y);
696
+ _this.mapProps.onClick && _this.mapProps.onClick(pos);
697
+ });
698
+ this.map = map;
699
+ this.mapInitialized = true;
700
+ console.log("".concat(this.type, " map script initialized"), divElement);
701
+ resolve(map);
702
+ return [2];
703
+ }
704
+ });
705
+ });
706
+ })];
707
+ });
708
+ });
709
+ };
710
+
711
+ NaverMintMapController.prototype.destroyMap = function () {
712
+ console.log("".concat(this.type, " map destroyed"));
713
+
714
+ try {
715
+ this.map && this.map.destroy();
716
+ } catch (e) {
717
+ console.log('naver map destroy error', e);
718
+ }
719
+ };
720
+
721
+ NaverMintMapController.prototype.getCurrBounds = function () {
722
+ if (!this.map) {
723
+ throw new Error('Map is not initialized!!');
724
+ }
725
+
726
+ var bounds = this.map.getBounds();
727
+ return new Bounds(new Position(bounds.getMin().y, bounds.getMin().x), new Position(bounds.getMax().y, bounds.getMax().x));
728
+ };
729
+
730
+ NaverMintMapController.prototype.panningTo = function (targetCenter) {
731
+ var _a;
732
+
733
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.panTo(targetCenter, {
734
+ duration: 1000
735
+ });
736
+ };
737
+
738
+ NaverMintMapController.prototype.getZoomLevel = function () {
739
+ var _a;
740
+
741
+ return ((_a = this.map) === null || _a === void 0 ? void 0 : _a.getZoom()) || 13;
742
+ };
743
+
744
+ return NaverMintMapController;
745
+ }(MintMapController);
746
+
747
+ var GoogleMintMapController = function (_super) {
748
+ tslib.__extends(GoogleMintMapController, _super);
749
+
750
+ function GoogleMintMapController(props) {
751
+ var _this = _super.call(this, props) || this;
752
+
753
+ _this.type = 'google';
754
+ _this.map = null;
755
+ _this.scriptUrl = 'https://maps.googleapis.com/maps/api/js';
756
+ _this.scriptModules = ['marker'];
757
+ _this.polylineEvents = ['mouseover', 'mouseout'];
758
+ _this.polygonEvents = ['mouseover', 'mouseout'];
759
+ _this.markerEvents = ['click', 'mouseover', 'mouseout'];
760
+ _this.dragged = false;
761
+
762
+ _this.destroyMap = function () {
763
+ console.log("".concat(_this.type, " map destroy feature is not supported"));
764
+ };
765
+
766
+ console.log("".concat(_this.type, " controller loadded"));
767
+ return _this;
768
+ }
769
+
770
+ GoogleMintMapController.prototype.createPolyline = function (polyline) {
771
+ var _this = this;
772
+
773
+ var _a = polyline.options,
774
+ position = _a.position,
775
+ _b = _a.lineColor,
776
+ lineColor = _b === void 0 ? 'blue' : _b,
777
+ _c = _a.lineSize,
778
+ lineSize = _c === void 0 ? 1 : _c,
779
+ _d = _a.lineOpacity,
780
+ lineOpacity = _d === void 0 ? 1 : _d,
781
+ _e = _a.visible,
782
+ visible = _e === void 0 ? true : _e,
783
+ _f = _a.editable,
784
+ editable = _f === void 0 ? false : _f,
785
+ event = _a.event;
786
+
787
+ if (this.map && Array.isArray(position)) {
788
+ var path = position.map(function (elem) {
789
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
790
+ });
791
+ var pol_1 = new google.maps.Polyline({
792
+ map: this.map,
793
+ path: path,
794
+ strokeColor: lineColor,
795
+ strokeWeight: lineSize,
796
+ strokeOpacity: lineOpacity,
797
+ clickable: true,
798
+ visible: visible,
799
+ editable: editable
800
+ });
801
+ polyline.native = pol_1;
802
+ event && event.forEach(function (handler, key) {
803
+ if (_this.polylineEvents.includes(key)) {
804
+ pol_1.addListener(key, handler);
805
+ }
806
+ });
807
+ }
808
+ };
809
+
810
+ GoogleMintMapController.prototype.updatePolyline = function (polyline, options) {
811
+ if (polyline && polyline.native && polyline.native instanceof google.maps.Polyline) {
812
+ var polylineOption = this.getValidOptions(options);
813
+
814
+ if (this.map && Array.isArray(options.position)) {
815
+ var path = options.position.map(function (elem) {
816
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
817
+ });
818
+ polylineOption.path = path;
819
+ }
820
+
821
+ polyline.native.setOptions(polylineOption);
822
+ }
823
+ };
824
+
825
+ GoogleMintMapController.prototype.createPolygon = function (polygon) {
826
+ var _this = this;
827
+
828
+ var _a = polygon.options,
829
+ position = _a.position,
830
+ innerPositions = _a.innerPositions,
831
+ _b = _a.lineColor,
832
+ lineColor = _b === void 0 ? 'green' : _b,
833
+ _c = _a.lineSize,
834
+ lineSize = _c === void 0 ? 1 : _c,
835
+ _d = _a.lineOpacity,
836
+ lineOpacity = _d === void 0 ? 1 : _d,
837
+ _e = _a.fillColor,
838
+ fillColor = _e === void 0 ? 'lightgreen' : _e,
839
+ _f = _a.fillOpacity,
840
+ fillOpacity = _f === void 0 ? 0.5 : _f,
841
+ _g = _a.visible,
842
+ visible = _g === void 0 ? true : _g,
843
+ _h = _a.editable,
844
+ editable = _h === void 0 ? false : _h,
845
+ event = _a.event;
846
+
847
+ if (this.map && Array.isArray(position)) {
848
+ var outLine = position.map(function (elem) {
849
+ return Array.isArray(elem) ? new Position(elem[1], elem[0]) : elem;
850
+ });
851
+ var paths = innerPositions ? tslib.__spreadArray([outLine], innerPositions, true) : [outLine];
852
+ var pol_2 = new google.maps.Polygon({
853
+ map: this.map,
854
+ paths: paths,
855
+ strokeColor: lineColor,
856
+ strokeWeight: lineSize,
857
+ strokeOpacity: lineOpacity,
858
+ fillColor: fillColor,
859
+ fillOpacity: fillOpacity,
860
+ clickable: true,
861
+ visible: visible,
862
+ editable: editable
863
+ });
864
+ polygon.native = pol_2;
865
+ event && event.forEach(function (handler, key) {
866
+ if (_this.polygonEvents.includes(key)) {
867
+ pol_2.addListener(key, handler);
868
+ }
869
+ });
870
+ }
871
+ };
872
+
873
+ GoogleMintMapController.prototype.updatePolygon = function (polygon, options) {
874
+ if (polygon && polygon.native && polygon.native instanceof google.maps.Polygon) {
875
+ var polygonOption = this.getValidOptions(options);
876
+ polygon.native.setOptions(polygonOption);
877
+ }
878
+ };
879
+
880
+ GoogleMintMapController.prototype.getValidOptions = function (options) {
881
+ var target = {};
882
+
883
+ for (var _i = 0, _a = Object.getOwnPropertyNames(options); _i < _a.length; _i++) {
884
+ var name_1 = _a[_i];
885
+
886
+ if (options[name_1] !== undefined) {
887
+ target[name_1] = options[name_1];
888
+ }
889
+ }
890
+
891
+ return target;
892
+ };
893
+
894
+ GoogleMintMapController.prototype.createMarker = function (marker) {
895
+ var _this = this;
896
+
897
+ var _a;
898
+
899
+ if (this.map) {
900
+ var googleMarker_1;
901
+
902
+ if (marker.element) {
903
+ var options = {
904
+ map: this.map,
905
+ position: marker.options.position
906
+ };
907
+ options.content = marker.element;
908
+ googleMarker_1 = new google.maps.marker.AdvancedMarkerView(options);
909
+ } else {
910
+ var options = {
911
+ map: this.map,
912
+ position: marker.options.position,
913
+ visible: marker.options.visible === undefined || marker.options.visible,
914
+ anchorPoint: marker.options.anchor
915
+ };
916
+ googleMarker_1 = new google.maps.Marker(options);
917
+ }
918
+
919
+ marker.native = googleMarker_1;
920
+ ((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
921
+ if (_this.markerEvents.includes(key)) {
922
+ googleMarker_1.addListener(key, handler);
923
+ }
924
+ });
925
+ }
926
+ };
927
+
928
+ GoogleMintMapController.prototype.updateMarker = function (marker, options) {
929
+ var _a, _b;
930
+
931
+ if (marker && marker.native) {
932
+ if (marker.native instanceof google.maps.Marker) {
933
+ var map = marker.native.getMap();
934
+
935
+ if (map) {
936
+ marker.native.setOptions({
937
+ map: map,
938
+ position: options.position instanceof Position ? options.position : marker.native.getPosition(),
939
+ visible: options.visible === undefined || options.visible
940
+ });
941
+ }
942
+ } else if (marker.native instanceof google.maps.marker.AdvancedMarkerView) {
943
+ if (options.visible !== undefined && marker.native.element) {
944
+ marker.native.element.style.visibility = options.visible ? 'visible' : 'hidden';
945
+ }
946
+
947
+ if (options.position instanceof Position && (((_a = marker.native.position) === null || _a === void 0 ? void 0 : _a.lat) != options.position.lat || ((_b = marker.native.position) === null || _b === void 0 ? void 0 : _b.lng) != options.position.lng)) {
948
+ marker.native.position = options.position;
949
+ }
950
+ }
951
+ }
952
+ };
953
+
954
+ GoogleMintMapController.prototype.getMaxZIndex = function (increment, parent) {
955
+ if (increment === void 0) {
956
+ increment = 0;
957
+ }
958
+
959
+ if (this.map) {
960
+ var targetPane = parent;
961
+ var max = 0;
962
+
963
+ for (var i = 0; i < targetPane.childElementCount; i++) {
964
+ var elem = targetPane.children[i];
965
+
966
+ if (elem instanceof HTMLElement) {
967
+ var index = Number(elem.style.zIndex);
968
+
969
+ if (!isNaN(index) && index > max) {
970
+ max = index;
971
+ }
972
+ }
973
+ }
974
+
975
+ this.markerMaxZIndex = max + increment;
976
+ return this.markerMaxZIndex;
977
+ } else {
978
+ return this.markerMaxZIndex || 1;
979
+ }
980
+ };
981
+
982
+ GoogleMintMapController.prototype.markerToTheTop = function (marker) {
983
+ if (this.map && marker.element && marker.element instanceof HTMLElement) {
984
+ var parent_1 = marker.element.parentElement;
985
+
986
+ if (parent_1) {
987
+ parent_1.style.zIndex = String(this.getMaxZIndex(1, parent_1));
988
+ }
989
+ }
990
+ };
991
+
992
+ GoogleMintMapController.prototype.clearDrawable = function (drawable) {
993
+ if (drawable && drawable.native) {
994
+ if (drawable.native instanceof google.maps.Marker || drawable.native instanceof google.maps.Polygon || drawable.native instanceof google.maps.Polyline) {
995
+ drawable.native.setMap(null);
996
+ return true;
997
+ } else if (drawable.native instanceof google.maps.marker.AdvancedMarkerView) {
998
+ drawable.native.map = null;
999
+ return true;
1000
+ }
1001
+ }
1002
+
1003
+ return false;
1004
+ };
1005
+
1006
+ GoogleMintMapController.prototype.isMapDragged = function () {
1007
+ return this.dragged;
1008
+ };
1009
+
1010
+ GoogleMintMapController.prototype.setMapDragged = function (value) {
1011
+ this.dragged = false;
1012
+ };
1013
+
1014
+ GoogleMintMapController.prototype.loadMapApi = function () {
1015
+ return tslib.__awaiter(this, void 0, void 0, function () {
1016
+ var _this = this;
1017
+
1018
+ return tslib.__generator(this, function (_a) {
1019
+ return [2, new Promise(function (resolve) {
1020
+ return tslib.__awaiter(_this, void 0, void 0, function () {
1021
+ var callbackName, loaded, params, ok;
1022
+ return tslib.__generator(this, function (_a) {
1023
+ switch (_a.label) {
1024
+ case 0:
1025
+ callbackName = "load".concat(new Date().getTime());
1026
+ loaded = false;
1027
+
1028
+ window[callbackName] = function () {
1029
+ console.log('google api loaded');
1030
+ loaded = true;
1031
+ delete window[callbackName];
1032
+ };
1033
+
1034
+ params = {
1035
+ key: this.mapProps.mapKey,
1036
+ libraries: this.scriptModules.join(','),
1037
+ v: 'beta',
1038
+ callback: callbackName
1039
+ };
1040
+ return [4, this.loadScript(this.buildUrl(this.scriptUrl, params), 'googlescript')];
1041
+
1042
+ case 1:
1043
+ _a.sent();
1044
+
1045
+ return [4, waiting(function () {
1046
+ return loaded;
1047
+ })];
1048
+
1049
+ case 2:
1050
+ ok = _a.sent();
1051
+
1052
+ if (!ok) {
1053
+ throw new Error('google script api load failed!!');
1054
+ }
1055
+
1056
+ this.mapApiLoaded = true;
1057
+ resolve(true);
1058
+ console.log("".concat(this.type, " map script api loaded"));
1059
+ return [2];
1060
+ }
1061
+ });
1062
+ });
1063
+ })];
1064
+ });
1065
+ });
1066
+ };
1067
+
1068
+ GoogleMintMapController.prototype.initializingMap = function (divElement) {
1069
+ return tslib.__awaiter(this, void 0, void 0, function () {
1070
+ var _this = this;
1071
+
1072
+ return tslib.__generator(this, function (_a) {
1073
+ return [2, new Promise(function (resolve) {
1074
+ return tslib.__awaiter(_this, void 0, void 0, function () {
1075
+ var map;
1076
+
1077
+ var _this = this;
1078
+
1079
+ var _a, _b;
1080
+
1081
+ return tslib.__generator(this, function (_c) {
1082
+ switch (_c.label) {
1083
+ case 0:
1084
+ if (this.mapInitialized && this.map) {
1085
+ if (this.map.getDiv() === divElement) {
1086
+ resolve(this.map);
1087
+ return [2];
1088
+ }
1089
+ }
1090
+
1091
+ if (!!this.mapApiLoaded) return [3, 2];
1092
+ return [4, this.loadMapApi()];
1093
+
1094
+ case 1:
1095
+ _c.sent();
1096
+
1097
+ _c.label = 2;
1098
+
1099
+ case 2:
1100
+ map = new google.maps.Map(divElement, {
1101
+ mapId: this.mapProps.mapId,
1102
+ center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
1103
+ maxZoom: 21,
1104
+ minZoom: 1,
1105
+ zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel
1106
+ });
1107
+ map.addListener('dragend', function () {
1108
+ console.log('map dragend');
1109
+ _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
1110
+ });
1111
+ map.addListener('zoom_changed', function () {
1112
+ console.log('zoom_changed');
1113
+ _this.map && _this.mapProps.onZoomChanged && _this.mapProps.onZoomChanged(_this.map.getZoom());
1114
+ _this.mapProps.onBoundsChanged && _this.mapProps.onBoundsChanged(_this.getCurrBounds());
1115
+ });
1116
+ map.addListener('click', function (e) {
1117
+ console.log('map click', e);
1118
+ var pos = new Position(e.latLng.lat(), e.latLng.lng());
1119
+ pos.offset = new Offset(e.pixel.x, e.pixel.y);
1120
+ _this.mapProps.onClick && _this.mapProps.onClick(pos);
1121
+ });
1122
+ this.map = map;
1123
+ this.mapInitialized = true;
1124
+ console.log("".concat(this.type, " map script initialized"), divElement);
1125
+ resolve(map);
1126
+ return [2];
1127
+ }
1128
+ });
1129
+ });
1130
+ })];
1131
+ });
1132
+ });
1133
+ };
1134
+
1135
+ GoogleMintMapController.prototype.fromGoogleBounds = function (bounds) {
1136
+ return new Bounds(new Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()), new Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()));
1137
+ };
1138
+
1139
+ GoogleMintMapController.prototype.getCurrBounds = function () {
1140
+ if (!this.map) {
1141
+ throw new Error('Map is not initialized!!');
1142
+ }
1143
+
1144
+ var bounds = this.map.getBounds();
1145
+
1146
+ if (bounds) {
1147
+ return this.fromGoogleBounds(bounds);
1148
+ } else {
1149
+ throw new Error('bounds is not found!!!');
1150
+ }
1151
+ };
1152
+
1153
+ GoogleMintMapController.prototype.panningTo = function (targetCenter) {
1154
+ var _a;
1155
+
1156
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.panTo(targetCenter);
1157
+ };
1158
+
1159
+ GoogleMintMapController.prototype.getZoomLevel = function () {
1160
+ var _a;
1161
+
1162
+ return ((_a = this.map) === null || _a === void 0 ? void 0 : _a.getZoom()) || 13;
1163
+ };
1164
+
1165
+ return GoogleMintMapController;
1166
+ }(MintMapController);
1167
+
1168
+ var Position = function () {
254
1169
  function Position(lat, lng) {
255
1170
  this.lat = 0;
256
1171
  this.lng = 0;
@@ -258,7 +1173,57 @@
258
1173
  this.lng = lng;
259
1174
  }
260
1175
 
261
- return Position;
1176
+ return Position;
1177
+ }();
1178
+
1179
+ var Bounds = function () {
1180
+ function Bounds(nw, se) {
1181
+ this.nw = nw;
1182
+ this.se = se;
1183
+ }
1184
+
1185
+ Bounds.prototype.getCenter = function () {
1186
+ return new Position(this.nw.lat + (this.se.lat - this.nw.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
1187
+ };
1188
+
1189
+ Bounds.prototype.includes = function (positions) {
1190
+ for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
1191
+ var pos = positions_1[_i];
1192
+
1193
+ if (this.nw.lat > pos.lat || this.se.lat < pos.lat || this.nw.lng > pos.lng || this.se.lng < pos.lng) {
1194
+ return false;
1195
+ }
1196
+ }
1197
+
1198
+ return true;
1199
+ };
1200
+
1201
+ Bounds.prototype.includesOnlyOnePoint = function (positions) {
1202
+ for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
1203
+ var pos = positions_2[_i];
1204
+
1205
+ if (!(this.nw.lat > pos.lat || this.se.lat < pos.lat || this.nw.lng > pos.lng || this.se.lng < pos.lng)) {
1206
+ return true;
1207
+ }
1208
+ }
1209
+
1210
+ return false;
1211
+ };
1212
+
1213
+ Bounds.prototype.intersects = function (positions) {
1214
+ return PolygonCalculator.intersects([this.nw, this.se], positions);
1215
+ };
1216
+
1217
+ return Bounds;
1218
+ }();
1219
+
1220
+ var Offset = function () {
1221
+ function Offset(x, y) {
1222
+ this.x = x;
1223
+ this.y = y;
1224
+ }
1225
+
1226
+ return Offset;
262
1227
  }();
263
1228
 
264
1229
  var Drawable = function () {
@@ -267,7 +1232,7 @@
267
1232
  return Drawable;
268
1233
  }();
269
1234
 
270
- var MintMap.Marker = function (_super) {
1235
+ var Marker = function (_super) {
271
1236
  tslib.__extends(Marker, _super);
272
1237
 
273
1238
  function Marker(options) {
@@ -280,7 +1245,7 @@
280
1245
  return Marker;
281
1246
  }(Drawable);
282
1247
 
283
- var MintMap.Polyline = function (_super) {
1248
+ var Polyline = function (_super) {
284
1249
  tslib.__extends(Polyline, _super);
285
1250
 
286
1251
  function Polyline(options) {
@@ -293,7 +1258,7 @@
293
1258
  return Polyline;
294
1259
  }(Drawable);
295
1260
 
296
- var MintMap.Polygon = function (_super) {
1261
+ var Polygon = function (_super) {
297
1262
  tslib.__extends(Polygon, _super);
298
1263
 
299
1264
  function Polygon(options) {
@@ -306,7 +1271,7 @@
306
1271
  Polygon.prototype.getCenter = function () {
307
1272
  if (Array.isArray(this.options.position) && this.options.position.length > 0) {
308
1273
  var paths = this.options.position.map(function (elem) {
309
- return elem instanceof MintMap.Position ? elem : new MintMap.Position(elem[0], elem[1]);
1274
+ return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
310
1275
  });
311
1276
  return PolygonCalculator.getCenter(paths);
312
1277
  }
@@ -318,8 +1283,6 @@
318
1283
  }(Drawable);
319
1284
  var cn$1 = classNames__default["default"].bind(styles$2);
320
1285
  function MintMap(_a) {
321
- var _this = this;
322
-
323
1286
  var mapType = _a.mapType,
324
1287
  children = _a.children,
325
1288
  props = tslib.__rest(_a, ["mapType", "children"]);
@@ -331,29 +1294,19 @@
331
1294
  React.useEffect(function () {
332
1295
  if (mapType && mapType.length > 0) {
333
1296
  setController(undefined);
334
-
335
- (function () {
336
- return tslib.__awaiter(_this, void 0, void 0, function () {
337
- var moduleName, controllerModule, newController;
338
- return tslib.__generator(this, function (_a) {
339
- switch (_a.label) {
340
- case 0:
341
- moduleName = getMapModulePrefix(mapType);
342
- return [4, import("./".concat(mapType, "/").concat(moduleName, "MintMapController"))];
343
-
344
- case 1:
345
- controllerModule = _a.sent();
346
- newController = new controllerModule.default(tslib.__assign({
347
- mapType: mapType
348
- }, props));
349
- newController.loadMapApi().then(function () {
350
- setController(newController);
351
- });
352
- return [2];
353
- }
354
- });
1297
+ var newController_1 = mapType === 'naver' ? new NaverMintMapController(tslib.__assign({
1298
+ mapType: mapType
1299
+ }, props)) : mapType === 'google' ? new GoogleMintMapController(tslib.__assign({
1300
+ mapType: mapType
1301
+ }, props)) : null;
1302
+
1303
+ if (newController_1) {
1304
+ newController_1.loadMapApi().then(function () {
1305
+ setController(newController_1);
355
1306
  });
356
- })();
1307
+ } else {
1308
+ throw new Error("Not Supported Map type ".concat(mapType));
1309
+ }
357
1310
  } else {
358
1311
  setController(undefined);
359
1312
  }
@@ -411,130 +1364,6 @@
411
1364
  }, "".concat(text, " ").concat(pointString)));
412
1365
  }
413
1366
 
414
- var getMapModulePrefix = function (mapType) {
415
- return mapType.substring(0, 1).toUpperCase() + mapType.substring(1).toLowerCase();
416
- };
417
-
418
- var MintMapController = function () {
419
- function MintMapController(props) {
420
- this.mapApiLoaded = false;
421
- this.mapInitialized = false;
422
- this.mapProps = props;
423
- }
424
-
425
- MintMapController.prototype.getMap = function () {
426
- return this.map;
427
- };
428
-
429
- MintMapController.prototype.getMapType = function () {
430
- return this.type;
431
- };
432
-
433
- MintMapController.prototype.loadScript = function (url, id) {
434
- return tslib.__awaiter(this, void 0, void 0, function () {
435
- return tslib.__generator(this, function (_a) {
436
- return [2, new Promise(function (resolve) {
437
- if (id && document.getElementById(id)) {
438
- console.log("already loaded script => ".concat(id));
439
- resolve();
440
- return;
441
- }
442
-
443
- var script = document.createElement('script');
444
- script.src = url;
445
- script.async = true;
446
- script.defer = true;
447
- script.addEventListener('load', function () {
448
- resolve();
449
- });
450
- document.body.appendChild(script);
451
- })];
452
- });
453
- });
454
- };
455
-
456
- MintMapController.prototype.buildUrl = function (baseUrl, param) {
457
- var params = Object.entries(param).map(function (_a) {
458
- var key = _a[0],
459
- value = _a[1];
460
- var temp = encodeURIComponent(Array.isArray(value) ? value.join(',') : value);
461
- return "".concat(key, "=").concat(temp);
462
- }).join('&');
463
- return "".concat(baseUrl, "?").concat(params);
464
- };
465
-
466
- return MintMapController;
467
- }();
468
-
469
- var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n position: absolute;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
470
- var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
471
- styleInject__default["default"](css_248z);
472
-
473
- var cn = classNames__default["default"].bind(styles);
474
-
475
- var getSizeString = function (size) {
476
- return typeof size === 'string' ? size.replace(/ /g, '') : "".concat(size, "px");
477
- };
478
-
479
- var getAlignPosition = function (value, align) {
480
- if (typeof value === 'string') {
481
- var trimmed = value.replace(/ /g, '');
482
- console.log('trimmed:', trimmed);
483
- var isPercent = trimmed.endsWith('%');
484
-
485
- if (!isPercent && !trimmed.endsWith('px')) {
486
- throw new Error("Size [".concat(value, "] is not valid string value."));
487
- }
488
-
489
- var numberPart = isPercent ? trimmed.substring(0, trimmed.length - 2) : trimmed.substring(0, trimmed.length - 3);
490
- var unit = isPercent ? '%' : 'px';
491
- var numberValue = Number(numberPart);
492
-
493
- if (isNaN(numberValue)) {
494
- throw new Error("Size [".concat(value, "] is not valid % or pixel number value."));
495
- }
496
-
497
- if (align === 'center') {
498
- return "calc(50% - ".concat(numberValue / 2).concat(unit, ")");
499
- } else if (align === 'right' || align === 'bottom') {
500
- return "calc(100% - ".concat(numberValue).concat(unit, ")");
501
- } else {
502
- return '0px';
503
- }
504
- } else if (typeof value === 'number') {
505
- if (align === 'center') {
506
- return "calc(50% - ".concat(value / 2, "px)");
507
- } else if (align === 'right' || align === 'bottom') {
508
- return "calc(100% - ".concat(value, "px)");
509
- } else {
510
- return '0px';
511
- }
512
- }
513
-
514
- throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
515
- };
516
-
517
- function MapControlWrapper(_a) {
518
- var _b = _a.width,
519
- width = _b === void 0 ? 100 : _b,
520
- _c = _a.height,
521
- height = _c === void 0 ? 40 : _c,
522
- _d = _a.positionHorizontal,
523
- positionHorizontal = _d === void 0 ? 'left' : _d,
524
- _e = _a.positionVertical,
525
- positionVertical = _e === void 0 ? 'top' : _e,
526
- children = _a.children;
527
- return React__default["default"].createElement("div", {
528
- className: cn('mint-map-control-wrapper'),
529
- style: {
530
- width: getSizeString(width),
531
- height: getSizeString(height),
532
- left: getAlignPosition(width, positionHorizontal),
533
- top: getAlignPosition(height, positionVertical)
534
- }
535
- }, children);
536
- }
537
-
538
1367
  var AnimationPlayer = function () {
539
1368
  function AnimationPlayer(drawFunction, fps) {
540
1369
  this.prevtime = 0;
@@ -627,7 +1456,7 @@
627
1456
  velocity = _h === void 0 ? 10 : _h,
628
1457
  onMovingStart = _a.onMovingStart,
629
1458
  onMovingEnd = _a.onMovingEnd;
630
- var controller = MintMapProvider.useMintMapController();
1459
+ var controller = useMintMapController();
631
1460
  React.useEffect(function () {
632
1461
  contextRef.current && (contextRef.current.velocityKmh = velocity);
633
1462
  }, [velocity]);
@@ -656,7 +1485,7 @@
656
1485
  context_1.elapsedTimeMs = frameGapTime;
657
1486
 
658
1487
  while (true) {
659
- calculate.GeoCalulator.computeNextPositionAndDistances(context_1);
1488
+ GeoCalulator.computeNextPositionAndDistances(context_1);
660
1489
 
661
1490
  if (context_1.nextPos === context_1.pos2) {
662
1491
  if (currTargetIndex_1 === startPositionIndex) {
@@ -752,7 +1581,7 @@
752
1581
  children = _a.children,
753
1582
  options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "children"]);
754
1583
 
755
- var controller = MintMapProvider.useMintMapController();
1584
+ var controller = useMintMapController();
756
1585
  var divRef = React.useRef(document.createElement('div'));
757
1586
  var divElement = divRef.current;
758
1587
  var divCloneRef = React.useRef();
@@ -848,7 +1677,7 @@
848
1677
  controller.updateMarker(markerRef.current, options);
849
1678
  offsetCalibration(controller.getMapType(), divElement, options);
850
1679
  } else {
851
- markerRef.current = new MintMap.Marker(options);
1680
+ markerRef.current = new Marker(options);
852
1681
  markerRef.current.element = divElement;
853
1682
  controller.createMarker(markerRef.current);
854
1683
  offsetCalibration(controller.getMapType(), divElement, options);
@@ -892,7 +1721,7 @@
892
1721
  var children = _a.children,
893
1722
  options = tslib.__rest(_a, ["children"]);
894
1723
 
895
- var controller = MintMapProvider.useMintMapController();
1724
+ var controller = useMintMapController();
896
1725
  React.useEffect(function () {
897
1726
  return function () {
898
1727
  if (polygonRef.current) {
@@ -906,7 +1735,7 @@
906
1735
  if (polygonRef.current) {
907
1736
  controller.updatePolygon(polygonRef.current, options);
908
1737
  } else {
909
- var polygon = new MintMap.Polygon(options);
1738
+ var polygon = new Polygon(options);
910
1739
  polygonRef.current = polygon;
911
1740
  controller.createPolygon(polygon);
912
1741
  }
@@ -915,33 +1744,6 @@
915
1744
  return React__default["default"].createElement(React__default["default"].Fragment, null, options && children);
916
1745
  }
917
1746
 
918
- function MapPolylineWrapper(_a) {
919
- var children = _a.children,
920
- options = tslib.__rest(_a, ["children"]);
921
-
922
- var controller = MintMapProvider.useMintMapController();
923
- React.useEffect(function () {
924
- return function () {
925
- if (polylineRef.current) {
926
- console.log('polyline cleared', controller.clearDrawable(polylineRef.current));
927
- }
928
- };
929
- }, []);
930
- var polylineRef = React.useRef();
931
- React.useEffect(function () {
932
- if (options) {
933
- if (polylineRef.current) {
934
- controller.updatePolyline(polylineRef.current, options);
935
- } else {
936
- var polyline = new MintMap.Polyline(options);
937
- polylineRef.current = polyline;
938
- controller.createPolyline(polyline);
939
- }
940
- }
941
- }, [options]);
942
- return React__default["default"].createElement(React__default["default"].Fragment, null, options && children);
943
- }
944
-
945
1747
  function getMaxLat(items) {
946
1748
  var max;
947
1749
 
@@ -1010,12 +1812,12 @@
1010
1812
  position: basePolygonPath
1011
1813
  };
1012
1814
  var height = numberOfFloor * heightOfFloor;
1013
- var projectionHeight = calculate.GeoCalulator.convertMeterToLatitudeValue(height);
1815
+ var projectionHeight = GeoCalulator.convertMeterToLatitudeValue(height);
1014
1816
  var roofPaths = [];
1015
1817
 
1016
1818
  for (var _i = 0, basePolygonPath_1 = basePolygonPath; _i < basePolygonPath_1.length; _i++) {
1017
1819
  var pos = basePolygonPath_1[_i];
1018
- roofPaths.push(new MintMap.Position(pos.lat + projectionHeight, pos.lng));
1820
+ roofPaths.push(new Position(pos.lat + projectionHeight, pos.lng));
1019
1821
  }
1020
1822
 
1021
1823
  roofPolygon.current = {
@@ -1047,7 +1849,7 @@
1047
1849
  var minLng = getLngMinMax(minLngPos.position, false);
1048
1850
  var mid = minLng.lng + (maxLng.lng - minLng.lng) / 2;
1049
1851
  titlePosition.current = {
1050
- position: new MintMap.Position(maxPos.lat, mid)
1852
+ position: new Position(maxPos.lat, mid)
1051
1853
  };
1052
1854
  } else {
1053
1855
  titlePosition.current = undefined;
@@ -1099,14 +1901,126 @@
1099
1901
  }, "".concat(title, " (").concat(numberOfFloor, "\uCE35)")))));
1100
1902
  }
1101
1903
 
1904
+ var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n position: absolute;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
1905
+ var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
1906
+ styleInject__default["default"](css_248z);
1907
+
1908
+ var cn = classNames__default["default"].bind(styles);
1909
+
1910
+ var getSizeString = function (size) {
1911
+ return typeof size === 'string' ? size.replace(/ /g, '') : "".concat(size, "px");
1912
+ };
1913
+
1914
+ var getAlignPosition = function (value, align) {
1915
+ if (typeof value === 'string') {
1916
+ var trimmed = value.replace(/ /g, '');
1917
+ console.log('trimmed:', trimmed);
1918
+ var isPercent = trimmed.endsWith('%');
1919
+
1920
+ if (!isPercent && !trimmed.endsWith('px')) {
1921
+ throw new Error("Size [".concat(value, "] is not valid string value."));
1922
+ }
1923
+
1924
+ var numberPart = isPercent ? trimmed.substring(0, trimmed.length - 2) : trimmed.substring(0, trimmed.length - 3);
1925
+ var unit = isPercent ? '%' : 'px';
1926
+ var numberValue = Number(numberPart);
1927
+
1928
+ if (isNaN(numberValue)) {
1929
+ throw new Error("Size [".concat(value, "] is not valid % or pixel number value."));
1930
+ }
1931
+
1932
+ if (align === 'center') {
1933
+ return "calc(50% - ".concat(numberValue / 2).concat(unit, ")");
1934
+ } else if (align === 'right' || align === 'bottom') {
1935
+ return "calc(100% - ".concat(numberValue).concat(unit, ")");
1936
+ } else {
1937
+ return '0px';
1938
+ }
1939
+ } else if (typeof value === 'number') {
1940
+ if (align === 'center') {
1941
+ return "calc(50% - ".concat(value / 2, "px)");
1942
+ } else if (align === 'right' || align === 'bottom') {
1943
+ return "calc(100% - ".concat(value, "px)");
1944
+ } else {
1945
+ return '0px';
1946
+ }
1947
+ }
1948
+
1949
+ throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
1950
+ };
1951
+
1952
+ function MapControlWrapper(_a) {
1953
+ var _b = _a.width,
1954
+ width = _b === void 0 ? 100 : _b,
1955
+ _c = _a.height,
1956
+ height = _c === void 0 ? 40 : _c,
1957
+ _d = _a.positionHorizontal,
1958
+ positionHorizontal = _d === void 0 ? 'left' : _d,
1959
+ _e = _a.positionVertical,
1960
+ positionVertical = _e === void 0 ? 'top' : _e,
1961
+ children = _a.children;
1962
+ return React__default["default"].createElement("div", {
1963
+ className: cn('mint-map-control-wrapper'),
1964
+ style: {
1965
+ width: getSizeString(width),
1966
+ height: getSizeString(height),
1967
+ left: getAlignPosition(width, positionHorizontal),
1968
+ top: getAlignPosition(height, positionVertical)
1969
+ }
1970
+ }, children);
1971
+ }
1972
+
1973
+ function MapPolylineWrapper(_a) {
1974
+ var children = _a.children,
1975
+ options = tslib.__rest(_a, ["children"]);
1976
+
1977
+ var controller = useMintMapController();
1978
+ React.useEffect(function () {
1979
+ return function () {
1980
+ if (polylineRef.current) {
1981
+ console.log('polyline cleared', controller.clearDrawable(polylineRef.current));
1982
+ }
1983
+ };
1984
+ }, []);
1985
+ var polylineRef = React.useRef();
1986
+ React.useEffect(function () {
1987
+ if (options) {
1988
+ if (polylineRef.current) {
1989
+ controller.updatePolyline(polylineRef.current, options);
1990
+ } else {
1991
+ var polyline = new Polyline(options);
1992
+ polylineRef.current = polyline;
1993
+ controller.createPolyline(polyline);
1994
+ }
1995
+ }
1996
+ }, [options]);
1997
+ return React__default["default"].createElement(React__default["default"].Fragment, null, options && children);
1998
+ }
1999
+
2000
+ exports.AnimationPlayer = AnimationPlayer;
2001
+ exports.Bounds = Bounds;
2002
+ exports.Drawable = Drawable;
2003
+ exports.GeoCalulator = GeoCalulator;
2004
+ exports.GoogleMintMapController = GoogleMintMapController;
1102
2005
  exports.MapBuildingProjection = MapBuildingProjection;
1103
2006
  exports.MapControlWrapper = MapControlWrapper;
1104
2007
  exports.MapMarkerWrapper = MapMarkerWrapper;
1105
2008
  exports.MapPolygonWrapper = MapPolygonWrapper;
1106
2009
  exports.MapPolylineWrapper = MapPolylineWrapper;
2010
+ exports.Marker = Marker;
1107
2011
  exports.MintMap = MintMap;
1108
2012
  exports.MintMapController = MintMapController;
2013
+ exports.MintMapCore = MintMapCore;
1109
2014
  exports.MintMapProvider = MintMapProvider;
2015
+ exports.NaverMintMapController = NaverMintMapController;
2016
+ exports.Offset = Offset;
2017
+ exports.Polygon = Polygon;
2018
+ exports.PolygonCalculator = PolygonCalculator;
2019
+ exports.Polyline = Polyline;
2020
+ exports.Position = Position;
2021
+ exports.useMarkerMoving = useMarkerMoving;
2022
+ exports.useMintMapController = useMintMapController;
2023
+ exports.waiting = waiting;
1110
2024
 
1111
2025
  Object.defineProperty(exports, '__esModule', { value: true });
1112
2026