@mint-ui/map 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +109 -109
- package/LICENSE +21 -21
- package/README.md +81 -81
- package/dist/components/mint-map/MintMap.d.ts +10 -10
- package/dist/components/mint-map/MintMap.js +6 -6
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapController.d.ts +70 -70
- package/dist/components/mint-map/core/MintMapController.js +10 -62
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -17
- package/dist/components/mint-map/core/advanced/canvas/CanvasMarker.d.ts +18 -18
- package/dist/components/mint-map/core/advanced/canvas/draw/canvas-util.d.ts +5 -5
- package/dist/components/mint-map/core/advanced/canvas/index.d.ts +1 -1
- package/dist/components/mint-map/core/advanced/index.d.ts +4 -4
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +22 -22
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +6 -6
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +28 -28
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +6 -6
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -8
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -12
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -10
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -3
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
- package/dist/components/mint-map/core/index.d.ts +8 -8
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
- package/dist/components/mint-map/core/provider/index.d.ts +1 -1
- package/dist/components/mint-map/core/util/animation.d.ts +16 -16
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/geo.d.ts +38 -38
- package/dist/components/mint-map/core/util/index.d.ts +8 -8
- package/dist/components/mint-map/core/util/log.d.ts +1 -1
- package/dist/components/mint-map/core/util/map.d.ts +2 -2
- package/dist/components/mint-map/core/util/polygon.d.ts +42 -42
- package/dist/components/mint-map/core/util/status.d.ts +9 -9
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -27
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -11
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +20 -20
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +51 -51
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +54 -53
- package/dist/components/mint-map/google/GoogleMintMapController.js +25 -1
- package/dist/components/mint-map/index.d.ts +5 -5
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +40 -7
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +56 -55
- package/dist/components/mint-map/naver/NaverMintMapController.js +45 -7
- package/dist/components/mint-map/types/MapDrawables.d.ts +118 -118
- package/dist/components/mint-map/types/MapDrawables.js +8 -8
- package/dist/components/mint-map/types/MapEventTypes.d.ts +44 -44
- package/dist/components/mint-map/types/MapTypes.d.ts +66 -60
- package/dist/components/mint-map/types/MapTypes.js +22 -13
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -25
- package/dist/components/mint-map/types/MintMapProps.d.ts +111 -111
- package/dist/components/mint-map/types/index.d.ts +6 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.es.js +3684 -3665
- package/dist/index.js +1 -0
- package/dist/index.umd.js +3683 -3663
- package/package.json +77 -77
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +0 -57
- package/dist/components/mint-map/types/CommonTypes.d.ts +0 -11
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
/// <reference types="google.maps" />
|
|
2
|
-
import { MintMapController } from "../core/MintMapController";
|
|
3
|
-
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
4
|
-
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
5
|
-
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
|
|
6
|
-
import { Bounds, Position } from
|
|
7
|
-
import { MintMapProps } from "../types/MintMapProps";
|
|
8
|
-
import { Property } from "csstype";
|
|
9
|
-
export declare class GoogleMintMapController extends MintMapController {
|
|
10
|
-
type: MapType;
|
|
11
|
-
map: google.maps.Map | null;
|
|
12
|
-
scriptUrl: string;
|
|
13
|
-
scriptModules: string[];
|
|
14
|
-
protected mapEvent: MapEvent;
|
|
15
|
-
protected mapUIEvent: MapUIEvent;
|
|
16
|
-
constructor(props: MintMapProps);
|
|
17
|
-
polylineEvents: string[];
|
|
18
|
-
createPolyline(polyline: Polyline): void;
|
|
19
|
-
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
20
|
-
polygonEvents: string[];
|
|
21
|
-
createPolygon(polygon: Polygon): void;
|
|
22
|
-
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
23
|
-
private getValidOptions;
|
|
24
|
-
markerEvents: string[];
|
|
25
|
-
createMarker(marker: Marker): void;
|
|
26
|
-
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
27
|
-
private markerMaxZIndex;
|
|
28
|
-
private getMaxZIndex;
|
|
29
|
-
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
30
|
-
markerToTheTop(marker: Marker): void;
|
|
31
|
-
clearDrawable(drawable: Drawable): boolean;
|
|
32
|
-
private dragged;
|
|
33
|
-
isMapDragged(): boolean;
|
|
34
|
-
setMapDragged(value: boolean): void;
|
|
35
|
-
private checkLoaded;
|
|
36
|
-
loadMapApi(): Promise<boolean>;
|
|
37
|
-
lastMousePosition: Position | null;
|
|
38
|
-
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
39
|
-
destroyMap: () => void;
|
|
40
|
-
private fromGoogleBounds;
|
|
41
|
-
getCurrBounds(): Bounds;
|
|
42
|
-
panningTo(targetCenter: Position): void;
|
|
43
|
-
getZoomLevel(): number;
|
|
44
|
-
setZoomLevel(zoom: number): void;
|
|
45
|
-
getCenter(): Position;
|
|
46
|
-
setCenter(position: Position): void;
|
|
47
|
-
setMapCursor(cursor: Property.Cursor): void;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import { MintMapController } from "../core/MintMapController";
|
|
3
|
+
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
4
|
+
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
5
|
+
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
|
|
6
|
+
import { Bounds, Position, Spacing } from '../types/MapTypes';
|
|
7
|
+
import { MintMapProps } from "../types/MintMapProps";
|
|
8
|
+
import { Property } from "csstype";
|
|
9
|
+
export declare class GoogleMintMapController extends MintMapController {
|
|
10
|
+
type: MapType;
|
|
11
|
+
map: google.maps.Map | null;
|
|
12
|
+
scriptUrl: string;
|
|
13
|
+
scriptModules: string[];
|
|
14
|
+
protected mapEvent: MapEvent;
|
|
15
|
+
protected mapUIEvent: MapUIEvent;
|
|
16
|
+
constructor(props: MintMapProps);
|
|
17
|
+
polylineEvents: string[];
|
|
18
|
+
createPolyline(polyline: Polyline): void;
|
|
19
|
+
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
20
|
+
polygonEvents: string[];
|
|
21
|
+
createPolygon(polygon: Polygon): void;
|
|
22
|
+
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
23
|
+
private getValidOptions;
|
|
24
|
+
markerEvents: string[];
|
|
25
|
+
createMarker(marker: Marker): void;
|
|
26
|
+
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
27
|
+
private markerMaxZIndex;
|
|
28
|
+
private getMaxZIndex;
|
|
29
|
+
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
30
|
+
markerToTheTop(marker: Marker): void;
|
|
31
|
+
clearDrawable(drawable: Drawable): boolean;
|
|
32
|
+
private dragged;
|
|
33
|
+
isMapDragged(): boolean;
|
|
34
|
+
setMapDragged(value: boolean): void;
|
|
35
|
+
private checkLoaded;
|
|
36
|
+
loadMapApi(): Promise<boolean>;
|
|
37
|
+
lastMousePosition: Position | null;
|
|
38
|
+
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
39
|
+
destroyMap: () => void;
|
|
40
|
+
private fromGoogleBounds;
|
|
41
|
+
getCurrBounds(): Bounds;
|
|
42
|
+
panningTo(targetCenter: Position): void;
|
|
43
|
+
getZoomLevel(): number;
|
|
44
|
+
setZoomLevel(zoom: number): void;
|
|
45
|
+
getCenter(): Position;
|
|
46
|
+
setCenter(position: Position): void;
|
|
47
|
+
setMapCursor(cursor: Property.Cursor): void;
|
|
48
|
+
focusPositionsToFitViewport(positions: Position[], spacing?: number | Spacing): void;
|
|
49
|
+
private eventMap;
|
|
50
|
+
addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
51
|
+
removeEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
52
|
+
removeAllEventListener(eventName?: MapEventName | undefined): void;
|
|
53
|
+
private clearEventListener;
|
|
54
|
+
}
|
|
@@ -9,6 +9,17 @@ var MintMapController = require('../core/MintMapController.js');
|
|
|
9
9
|
var waiting = require('../core/util/waiting.js');
|
|
10
10
|
var MapEventTypes = require('../types/MapEventTypes.js');
|
|
11
11
|
var MapTypes = require('../types/MapTypes.js');
|
|
12
|
+
require('../core/MintMapCore.js');
|
|
13
|
+
require('react');
|
|
14
|
+
require('../types/MapDrawables.js');
|
|
15
|
+
require('../core/provider/MintMapProvider.js');
|
|
16
|
+
require('react-dom');
|
|
17
|
+
require('../core/util/animation.js');
|
|
18
|
+
require('../core/util/geo.js');
|
|
19
|
+
var polygon = require('../core/util/polygon.js');
|
|
20
|
+
require('../naver/NaverMintMapController.js');
|
|
21
|
+
require('../core/advanced/MapLoadingComponents.js');
|
|
22
|
+
require('../core/wrapper/MapControlWrapper.js');
|
|
12
23
|
|
|
13
24
|
var GoogleMintMapController =
|
|
14
25
|
/** @class */
|
|
@@ -445,7 +456,7 @@ function (_super) {
|
|
|
445
456
|
return tslib.__generator(this, function (_g) {
|
|
446
457
|
switch (_g.label) {
|
|
447
458
|
case 0:
|
|
448
|
-
//이미 생성했으면
|
|
459
|
+
//이미 생성했으면
|
|
449
460
|
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
450
461
|
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
451
462
|
if (this.mapInitialized && this.map) {
|
|
@@ -601,6 +612,19 @@ function (_super) {
|
|
|
601
612
|
});
|
|
602
613
|
};
|
|
603
614
|
|
|
615
|
+
GoogleMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
|
|
616
|
+
var _a;
|
|
617
|
+
|
|
618
|
+
var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
|
|
619
|
+
|
|
620
|
+
if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
|
|
621
|
+
throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
var pointBounds = new google.maps.LatLngBounds(new google.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new google.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
|
|
625
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds, spacing);
|
|
626
|
+
};
|
|
627
|
+
|
|
604
628
|
GoogleMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
605
629
|
var _this = this;
|
|
606
630
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './MintMap';
|
|
2
|
-
export * from './core';
|
|
3
|
-
export * from './naver/NaverMintMapController';
|
|
4
|
-
export * from './google/GoogleMintMapController';
|
|
5
|
-
export * from './types';
|
|
1
|
+
export * from './MintMap';
|
|
2
|
+
export * from './core';
|
|
3
|
+
export * from './naver/NaverMintMapController';
|
|
4
|
+
export * from './google/GoogleMintMapController';
|
|
5
|
+
export * from './types';
|
|
@@ -10,6 +10,17 @@ var MapTypes = require('../types/MapTypes.js');
|
|
|
10
10
|
var MapEventTypes = require('../types/MapEventTypes.js');
|
|
11
11
|
var log = require('../core/util/log.js');
|
|
12
12
|
var status = require('../core/util/status.js');
|
|
13
|
+
require('../core/MintMapCore.js');
|
|
14
|
+
require('react');
|
|
15
|
+
require('../types/MapDrawables.js');
|
|
16
|
+
require('../core/provider/MintMapProvider.js');
|
|
17
|
+
require('react-dom');
|
|
18
|
+
require('../core/util/animation.js');
|
|
19
|
+
require('../core/util/geo.js');
|
|
20
|
+
var polygon = require('../core/util/polygon.js');
|
|
21
|
+
require('../naver/NaverMintMapController.js');
|
|
22
|
+
require('../core/advanced/MapLoadingComponents.js');
|
|
23
|
+
require('../core/wrapper/MapControlWrapper.js');
|
|
13
24
|
|
|
14
25
|
var KakaoMintMapController =
|
|
15
26
|
/** @class */
|
|
@@ -560,13 +571,13 @@ function (_super) {
|
|
|
560
571
|
};
|
|
561
572
|
|
|
562
573
|
KakaoMintMapController.prototype.getSafeZoomValue = function (value) {
|
|
563
|
-
/**
|
|
564
|
-
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
565
|
-
* - 가장 확대된 값 : 1
|
|
566
|
-
* - 가장 축소된 값 : 14
|
|
567
|
-
*
|
|
568
|
-
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
569
|
-
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
574
|
+
/**
|
|
575
|
+
* 카카오는 구글/네이버와 다르게 줌레벨이 작아질수록 확대된다 (가장 확대된 것이 0)
|
|
576
|
+
* - 가장 확대된 값 : 1
|
|
577
|
+
* - 가장 축소된 값 : 14
|
|
578
|
+
*
|
|
579
|
+
* 그래서 세계지도가 없는 카카오는 동일한 사정인 네이버와 매핑하기로 한다.
|
|
580
|
+
* 문제는 둘 간의 줌 레벨별 축척이 일치하지 않는다. 그래서 가장 유사한 레벨 끼리 매핑이 필요하다
|
|
570
581
|
*/
|
|
571
582
|
var mapValue = this.getBaseToMapZoom(value);
|
|
572
583
|
|
|
@@ -641,6 +652,28 @@ function (_super) {
|
|
|
641
652
|
return latLng ? new MapTypes.Position(latLng.getLat(), latLng.getLng()) : new MapTypes.Position(0, 0);
|
|
642
653
|
};
|
|
643
654
|
|
|
655
|
+
KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
|
|
656
|
+
var _a;
|
|
657
|
+
|
|
658
|
+
var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
|
|
659
|
+
|
|
660
|
+
if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
|
|
661
|
+
throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var pointBounds = new kakao.maps.LatLngBounds(new kakao.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new kakao.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
|
|
665
|
+
var topSpacing, rightSpacing, bottomSpacing, leftSpacing;
|
|
666
|
+
|
|
667
|
+
if (typeof spacing === 'number') {
|
|
668
|
+
topSpacing = rightSpacing = bottomSpacing = leftSpacing = spacing;
|
|
669
|
+
} else if (spacing instanceof MapTypes.Spacing) {
|
|
670
|
+
topSpacing = spacing.top, rightSpacing = spacing.right, bottomSpacing = spacing.bottom, leftSpacing = spacing.left;
|
|
671
|
+
} // 카카오 지도는 setBounds 함수를 실행 할 때 애니메이션 효과가 없다.
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds, topSpacing, rightSpacing, bottomSpacing, leftSpacing);
|
|
675
|
+
};
|
|
676
|
+
|
|
644
677
|
KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
645
678
|
var _this = this;
|
|
646
679
|
|
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
/// <reference types="navermaps" />
|
|
2
|
-
import { MintMapController } from "../core/MintMapController";
|
|
3
|
-
import { ObjectPool } from '@mint-ui/tools';
|
|
4
|
-
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
5
|
-
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
6
|
-
import { Bounds, Offset, Position } from
|
|
7
|
-
import { MintMapProps } from "../types/MintMapProps";
|
|
8
|
-
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
|
|
9
|
-
import { Property } from "csstype";
|
|
10
|
-
export declare class NaverMintMapController extends MintMapController {
|
|
11
|
-
type: MapType;
|
|
12
|
-
map: naver.maps.Map | null;
|
|
13
|
-
scriptUrl: string;
|
|
14
|
-
scriptModules: string[];
|
|
15
|
-
protected mapEvent: MapEvent;
|
|
16
|
-
protected mapUIEvent: MapUIEvent;
|
|
17
|
-
markerPool?: ObjectPool<naver.maps.Marker>;
|
|
18
|
-
constructor(props: MintMapProps);
|
|
19
|
-
private initMarkerPool;
|
|
20
|
-
polylineEvents: string[];
|
|
21
|
-
createPolyline(polyline: Polyline): void;
|
|
22
|
-
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
23
|
-
polygonEvents: string[];
|
|
24
|
-
createPolygon(polygon: Polygon): void;
|
|
25
|
-
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
26
|
-
markerEvents: string[];
|
|
27
|
-
createMarker(marker: Marker): void;
|
|
28
|
-
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
29
|
-
private markerMaxZIndex;
|
|
30
|
-
private getMaxZIndex;
|
|
31
|
-
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
32
|
-
markerToTheTop(marker: Marker): void;
|
|
33
|
-
clearDrawable(drawable: Drawable): boolean;
|
|
34
|
-
private dragged;
|
|
35
|
-
isMapDragged(): boolean;
|
|
36
|
-
setMapDragged(value: boolean): void;
|
|
37
|
-
private checkLoaded;
|
|
38
|
-
loadMapApi(): Promise<boolean>;
|
|
39
|
-
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
40
|
-
private getSafeZoomValue;
|
|
41
|
-
destroyMap(): void;
|
|
42
|
-
getCurrBounds(): Bounds;
|
|
43
|
-
panningTo(targetCenter: Position): void;
|
|
44
|
-
getZoomLevel(): number;
|
|
45
|
-
setZoomLevel(zoom: number): void;
|
|
46
|
-
getCenter(): Position;
|
|
47
|
-
setCenter(position: Position): void;
|
|
48
|
-
setMapCursor(cursor: Property.Cursor): void;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
/// <reference types="navermaps" />
|
|
2
|
+
import { MintMapController } from "../core/MintMapController";
|
|
3
|
+
import { ObjectPool } from '@mint-ui/tools';
|
|
4
|
+
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
5
|
+
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
6
|
+
import { Bounds, Offset, Position, Spacing } from '../types/MapTypes';
|
|
7
|
+
import { MintMapProps } from "../types/MintMapProps";
|
|
8
|
+
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
|
|
9
|
+
import { Property } from "csstype";
|
|
10
|
+
export declare class NaverMintMapController extends MintMapController {
|
|
11
|
+
type: MapType;
|
|
12
|
+
map: naver.maps.Map | null;
|
|
13
|
+
scriptUrl: string;
|
|
14
|
+
scriptModules: string[];
|
|
15
|
+
protected mapEvent: MapEvent;
|
|
16
|
+
protected mapUIEvent: MapUIEvent;
|
|
17
|
+
markerPool?: ObjectPool<naver.maps.Marker>;
|
|
18
|
+
constructor(props: MintMapProps);
|
|
19
|
+
private initMarkerPool;
|
|
20
|
+
polylineEvents: string[];
|
|
21
|
+
createPolyline(polyline: Polyline): void;
|
|
22
|
+
updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
23
|
+
polygonEvents: string[];
|
|
24
|
+
createPolygon(polygon: Polygon): void;
|
|
25
|
+
updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
26
|
+
markerEvents: string[];
|
|
27
|
+
createMarker(marker: Marker): void;
|
|
28
|
+
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
29
|
+
private markerMaxZIndex;
|
|
30
|
+
private getMaxZIndex;
|
|
31
|
+
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
32
|
+
markerToTheTop(marker: Marker): void;
|
|
33
|
+
clearDrawable(drawable: Drawable): boolean;
|
|
34
|
+
private dragged;
|
|
35
|
+
isMapDragged(): boolean;
|
|
36
|
+
setMapDragged(value: boolean): void;
|
|
37
|
+
private checkLoaded;
|
|
38
|
+
loadMapApi(): Promise<boolean>;
|
|
39
|
+
initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
40
|
+
private getSafeZoomValue;
|
|
41
|
+
destroyMap(): void;
|
|
42
|
+
getCurrBounds(): Bounds;
|
|
43
|
+
panningTo(targetCenter: Position): void;
|
|
44
|
+
getZoomLevel(): number;
|
|
45
|
+
setZoomLevel(zoom: number): void;
|
|
46
|
+
getCenter(): Position;
|
|
47
|
+
setCenter(position: Position): void;
|
|
48
|
+
setMapCursor(cursor: Property.Cursor): void;
|
|
49
|
+
focusPositionsToFitViewport(positions: Position[], spacing?: number | Spacing): void;
|
|
50
|
+
naverPositionToOffset(position: Position): Offset;
|
|
51
|
+
private eventMap;
|
|
52
|
+
addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
53
|
+
removeEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
54
|
+
removeAllEventListener(eventName?: MapEventName | undefined): void;
|
|
55
|
+
private clearEventListener;
|
|
56
|
+
}
|
|
@@ -10,6 +10,16 @@ var MapTypes = require('../types/MapTypes.js');
|
|
|
10
10
|
var MapEventTypes = require('../types/MapEventTypes.js');
|
|
11
11
|
var log = require('../core/util/log.js');
|
|
12
12
|
var status = require('../core/util/status.js');
|
|
13
|
+
require('../core/MintMapCore.js');
|
|
14
|
+
require('react');
|
|
15
|
+
require('../types/MapDrawables.js');
|
|
16
|
+
require('../core/provider/MintMapProvider.js');
|
|
17
|
+
require('react-dom');
|
|
18
|
+
require('../core/util/animation.js');
|
|
19
|
+
require('../core/util/geo.js');
|
|
20
|
+
var polygon = require('../core/util/polygon.js');
|
|
21
|
+
require('../core/advanced/MapLoadingComponents.js');
|
|
22
|
+
require('../core/wrapper/MapControlWrapper.js');
|
|
13
23
|
|
|
14
24
|
var NaverMintMapController =
|
|
15
25
|
/** @class */
|
|
@@ -258,11 +268,11 @@ function (_super) {
|
|
|
258
268
|
var map = marker.native.getMap();
|
|
259
269
|
|
|
260
270
|
if (map) {
|
|
261
|
-
/** 중요!!!!
|
|
262
|
-
* naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
|
|
263
|
-
* setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
|
|
264
|
-
* (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
|
|
265
|
-
* 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
|
|
271
|
+
/** 중요!!!!
|
|
272
|
+
* naver 마커의 setOption(MarkerOptions) 은 내부적으로 setMap 을 무조건 강제 처리한다!!!
|
|
273
|
+
* setMap 을 처리하면 맵의 이벤트리스너 등등이 모두 초기화 되고 다시 맵을 add 하면서 마커관련된 모든 초기화가 다시 일어난다.
|
|
274
|
+
* (심지어 map 이 기존과 같은 객체인데도 초기화 처리함)
|
|
275
|
+
* 그래서 민트맵에서는 update 를 지원하는 항목별로 명시적으로 각각 처리한다.
|
|
266
276
|
*/
|
|
267
277
|
//Position
|
|
268
278
|
if (options.position && options.position instanceof MapTypes.Position) {
|
|
@@ -402,7 +412,7 @@ function (_super) {
|
|
|
402
412
|
};
|
|
403
413
|
|
|
404
414
|
params = tslib.__assign({
|
|
405
|
-
|
|
415
|
+
ncpKeyId: this.mapProps.mapKey,
|
|
406
416
|
submodules: this.scriptModules.join(','),
|
|
407
417
|
callback: callbackName
|
|
408
418
|
}, this.mapProps.scriptParams);
|
|
@@ -465,7 +475,7 @@ function (_super) {
|
|
|
465
475
|
return tslib.__generator(this, function (_g) {
|
|
466
476
|
switch (_g.label) {
|
|
467
477
|
case 0:
|
|
468
|
-
//이미 생성했으면
|
|
478
|
+
//이미 생성했으면
|
|
469
479
|
//1. divElement 가 그대로인 경우 기존 map 객체 리턴
|
|
470
480
|
//2. divElement 가 바뀐경우 기존 map 객체 destroy 하고 새로 생성
|
|
471
481
|
if (this.mapInitialized && this.map) {
|
|
@@ -646,6 +656,34 @@ function (_super) {
|
|
|
646
656
|
target && (target.style.cursor = cursor);
|
|
647
657
|
};
|
|
648
658
|
|
|
659
|
+
NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
|
|
660
|
+
var _a;
|
|
661
|
+
|
|
662
|
+
var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
|
|
663
|
+
|
|
664
|
+
if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
|
|
665
|
+
throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
var pointBounds = naver.maps.PointBounds.bounds(new naver.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new naver.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
|
|
669
|
+
var marginOptions;
|
|
670
|
+
|
|
671
|
+
if (typeof spacing === 'number') {
|
|
672
|
+
marginOptions = {
|
|
673
|
+
top: spacing,
|
|
674
|
+
right: spacing,
|
|
675
|
+
bottom: spacing,
|
|
676
|
+
left: spacing
|
|
677
|
+
};
|
|
678
|
+
} else if (spacing instanceof MapTypes.Spacing) {
|
|
679
|
+
marginOptions = spacing;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.panToBounds(pointBounds, {
|
|
683
|
+
duration: 500
|
|
684
|
+
}, marginOptions);
|
|
685
|
+
};
|
|
686
|
+
|
|
649
687
|
NaverMintMapController.prototype.naverPositionToOffset = function (position) {
|
|
650
688
|
if (!this.map) {
|
|
651
689
|
return new MapTypes.Offset(0, 0);
|