@mint-ui/map 1.0.1 → 1.1.1

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 CHANGED
@@ -0,0 +1,110 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ node: true
5
+ },
6
+ extends: [ 'airbnb', 'airbnb/hooks', 'eslint:recommended', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:storybook/recommended' ],
7
+ ignorePatterns: [ '.storybook', '*.d.ts', 'node_modules', 'build', 'dist', '**/env/*.js' ],
8
+ overrides: [
9
+ {
10
+ files: [ '*.ts', '*.tsx' ],
11
+ rules: { 'no-undef': 'off' }
12
+ }
13
+ ],
14
+ parser: '@typescript-eslint/parser',
15
+ parserOptions: { warnOnUnsupportedTypeScriptVersion: false },
16
+ plugins: [ '@typescript-eslint', 'sort-keys-fix', 'prettier' ],
17
+ rules: {
18
+ '@typescript-eslint/ban-ts-comment': [
19
+ 'error',
20
+ { 'ts-ignore': 'allow-with-description' }
21
+ ],
22
+ '@typescript-eslint/no-explicit-any': 'warn',
23
+ '@typescript-eslint/no-unused-vars': 'error',
24
+ 'array-bracket-spacing': [
25
+ 'error',
26
+ 'always',
27
+ {
28
+ arraysInArrays: false,
29
+ objectsInArrays: false
30
+ }
31
+ ],
32
+ 'brace-style': [ 'error', 'allman' ],
33
+ 'class-methods-use-this': 'off',
34
+ 'comma-dangle': [ 'error', 'never' ],
35
+ 'eol-last': [ 'error', 'never' ],
36
+ 'import/extensions': 'off',
37
+ 'import/named': 'off',
38
+ 'import/no-anonymous-default-export': 'off',
39
+ 'import/no-cycle': 'off',
40
+ 'import/no-extraneous-dependencies': 'off',
41
+ 'import/no-named-as-default': 'off',
42
+ 'import/no-unresolved': 'off',
43
+ 'import/order': [
44
+ 'error',
45
+ {
46
+ alphabetize: {
47
+ caseInsensitive: true,
48
+ order: 'asc'
49
+ },
50
+ groups: [ 'external', 'builtin', 'internal', 'sibling', 'parent', 'index' ],
51
+ 'newlines-between': 'always'
52
+ }
53
+ ],
54
+ indent: [ 'error', 'tab', { SwitchCase: 1 }],
55
+ 'jsx-a11y/control-has-associated-label': 'off',
56
+ 'jsx-quotes': [ 'error', 'prefer-single' ],
57
+ 'linebreak-style': 'off',
58
+ 'max-len': 'off',
59
+ 'no-console': 'off',
60
+ 'no-plusplus': 'off',
61
+ 'no-restricted-exports': 'off',
62
+ 'no-tabs': [ 'error', { allowIndentationTabs: true }],
63
+ 'no-unused-vars': 'off',
64
+ 'object-curly-newline': [ 'error', {
65
+ ExportDeclaration: 'never',
66
+ ImportDeclaration: 'never',
67
+ ObjectExpression: {
68
+ minProperties: 3,
69
+ multiline: true
70
+ },
71
+ ObjectPattern: { multiline: true }
72
+ }],
73
+ 'react-hooks/exhaustive-deps': 'off',
74
+ 'react/button-has-type': 'off',
75
+ 'react/destructuring-assignment': 'off',
76
+ 'react/function-component-definition': 'off',
77
+ 'react/jsx-curly-brace-presence': [
78
+ 'error',
79
+ {
80
+ children: 'never',
81
+ props: 'never'
82
+ }
83
+ ],
84
+ 'react/jsx-filename-extension': 'off',
85
+ 'react/jsx-indent': [ 'error', 'tab' ],
86
+ 'react/jsx-indent-props': [ 2, 'tab' ],
87
+ 'react/jsx-props-no-spreading': 'off',
88
+ 'react/jsx-sort-props': [
89
+ 'error',
90
+ {
91
+ callbacksLast: true,
92
+ ignoreCase: true,
93
+ multiline: 'last',
94
+ noSortAlphabetically: false,
95
+ reservedFirst: false,
96
+ shorthandFirst: false,
97
+ shorthandLast: true
98
+ }
99
+ ],
100
+ 'react/prop-types': 'off',
101
+ 'react/react-in-jsx-scope': 'off',
102
+ 'react/require-default-props': 'off',
103
+ 'require-jsdoc': 'off',
104
+ 'sort-keys-fix/sort-keys-fix': 'error'
105
+ },
106
+ settings: {
107
+ 'import/parsers': { '@typescript-eslint/parser': [ '.ts', '.tsx', '.js' ] },
108
+ react: { version: 'detect' }
109
+ }
110
+ };
@@ -1,7 +1,7 @@
1
1
  import { MapType, MapVendorType } from '../types/CommonTypes';
2
2
  import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from '../types/MapDrawables';
3
3
  import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from '../types/MapEventTypes';
4
- import { Bounds, Offset, Position } from '../types/MapTypes';
4
+ import { Bounds, Offset, Position, Spacing } from '../types/MapTypes';
5
5
  import { MintMapProps } from '../types/MintMapProps';
6
6
  import { Property } from "csstype";
7
7
  export declare abstract class MintMapController {
@@ -19,7 +19,7 @@ export declare abstract class MintMapController {
19
19
  abstract getCenter(): Position;
20
20
  abstract setCenter(position: Position): void;
21
21
  abstract setMapCursor(cursor: Property.Cursor): void;
22
- abstract focusPositionsToFitViewport(positions: Position[]): void;
22
+ abstract focusPositionsToFitViewport(positions: Position[], spacing?: number | Spacing): void;
23
23
  abstract createMarker(marker: Marker): void;
24
24
  abstract updateMarker(marker: Marker, options: MarkerOptions): void;
25
25
  abstract clearDrawable(drawable: Drawable): boolean;
@@ -41,7 +41,7 @@ export declare abstract class MintMapController {
41
41
  mapInitialized: boolean;
42
42
  mapDivElement: HTMLDivElement;
43
43
  constructor(props: MintMapProps);
44
- getMap(): MapVendorType | null;
44
+ getMap(): any;
45
45
  getMapType(): MapType;
46
46
  positionToOffset(position: Position): Offset;
47
47
  offsetToPosition(offset: Offset): Position;
@@ -3,7 +3,7 @@ import { MintMapController } from "../core/MintMapController";
3
3
  import { MapType, MapVendorType } from "../types/CommonTypes";
4
4
  import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
5
5
  import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
6
- import { Bounds, Position } from "../types/MapTypes";
6
+ import { Bounds, Position, Spacing } from '../types/MapTypes';
7
7
  import { MintMapProps } from "../types/MintMapProps";
8
8
  import { Property } from "csstype";
9
9
  export declare class GoogleMintMapController extends MintMapController {
@@ -45,7 +45,7 @@ export declare class GoogleMintMapController extends MintMapController {
45
45
  getCenter(): Position;
46
46
  setCenter(position: Position): void;
47
47
  setMapCursor(cursor: Property.Cursor): void;
48
- focusPositionsToFitViewport(posiitons: Position[]): void;
48
+ focusPositionsToFitViewport(positions: Position[], spacing?: number | Spacing): void;
49
49
  private eventMap;
50
50
  addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
51
51
  removeEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
@@ -612,17 +612,17 @@ function (_super) {
612
612
  });
613
613
  };
614
614
 
615
- GoogleMintMapController.prototype.focusPositionsToFitViewport = function (posiitons) {
615
+ GoogleMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
616
616
  var _a;
617
617
 
618
- var markerBounds = polygon.PolygonCalculator.getRegionInfo(posiitons);
618
+ var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
619
619
 
620
620
  if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
621
621
  throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
622
622
  }
623
623
 
624
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);
625
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds, spacing);
626
626
  };
627
627
 
628
628
  GoogleMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -652,7 +652,7 @@ function (_super) {
652
652
  return latLng ? new MapTypes.Position(latLng.getLat(), latLng.getLng()) : new MapTypes.Position(0, 0);
653
653
  };
654
654
 
655
- KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
655
+ KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
656
656
  var _a;
657
657
 
658
658
  var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
@@ -662,7 +662,16 @@ function (_super) {
662
662
  }
663
663
 
664
664
  var pointBounds = new kakao.maps.LatLngBounds(new kakao.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new kakao.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
665
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds);
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);
666
675
  };
667
676
 
668
677
  KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -3,7 +3,7 @@ import { MintMapController } from "../core/MintMapController";
3
3
  import { ObjectPool } from '@mint-ui/tools';
4
4
  import { MapType, MapVendorType } from "../types/CommonTypes";
5
5
  import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
6
- import { Bounds, Offset, Position } from "../types/MapTypes";
6
+ import { Bounds, Offset, Position, Spacing } from '../types/MapTypes';
7
7
  import { MintMapProps } from "../types/MintMapProps";
8
8
  import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
9
9
  import { Property } from "csstype";
@@ -46,7 +46,7 @@ export declare class NaverMintMapController extends MintMapController {
46
46
  getCenter(): Position;
47
47
  setCenter(position: Position): void;
48
48
  setMapCursor(cursor: Property.Cursor): void;
49
- focusPositionsToFitViewport(positions: Position[]): void;
49
+ focusPositionsToFitViewport(positions: Position[], spacing?: number | Spacing): void;
50
50
  naverPositionToOffset(position: Position): Offset;
51
51
  private eventMap;
52
52
  addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
@@ -412,7 +412,7 @@ function (_super) {
412
412
  };
413
413
 
414
414
  params = tslib.__assign({
415
- ncpClientId: this.mapProps.mapKey,
415
+ ncpKeyId: this.mapProps.mapKey,
416
416
  submodules: this.scriptModules.join(','),
417
417
  callback: callbackName
418
418
  }, this.mapProps.scriptParams);
@@ -656,7 +656,7 @@ function (_super) {
656
656
  target && (target.style.cursor = cursor);
657
657
  };
658
658
 
659
- NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
659
+ NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
660
660
  var _a;
661
661
 
662
662
  var markerBounds = polygon.PolygonCalculator.getRegionInfo(positions);
@@ -666,9 +666,22 @@ function (_super) {
666
666
  }
667
667
 
668
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
+
669
682
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.panToBounds(pointBounds, {
670
683
  duration: 500
671
- });
684
+ }, marginOptions);
672
685
  };
673
686
 
674
687
  NaverMintMapController.prototype.naverPositionToOffset = function (position) {
@@ -58,3 +58,9 @@ export declare class Offset {
58
58
  constructor(x: number, y: number);
59
59
  equals(other?: Offset): boolean | undefined;
60
60
  }
61
+ export declare class Spacing {
62
+ top?: number;
63
+ right?: number;
64
+ bottom?: number;
65
+ left?: number;
66
+ }
@@ -150,6 +150,15 @@ function () {
150
150
  return Offset;
151
151
  }();
152
152
 
153
+ var Spacing =
154
+ /** @class */
155
+ function () {
156
+ function Spacing() {}
157
+
158
+ return Spacing;
159
+ }();
160
+
153
161
  exports.Bounds = Bounds;
154
162
  exports.Offset = Offset;
155
163
  exports.Position = Position;
164
+ exports.Spacing = Spacing;
package/dist/index.es.js CHANGED
@@ -619,6 +619,14 @@ function () {
619
619
  return Offset;
620
620
  }();
621
621
 
622
+ var Spacing =
623
+ /** @class */
624
+ function () {
625
+ function Spacing() {}
626
+
627
+ return Spacing;
628
+ }();
629
+
622
630
  var MintMapControllerContext = createContext(null);
623
631
  function MintMapProvider(_a) {
624
632
  var controller = _a.controller,
@@ -3931,7 +3939,7 @@ function (_super) {
3931
3939
  };
3932
3940
 
3933
3941
  params = __assign({
3934
- ncpClientId: this.mapProps.mapKey,
3942
+ ncpKeyId: this.mapProps.mapKey,
3935
3943
  submodules: this.scriptModules.join(','),
3936
3944
  callback: callbackName
3937
3945
  }, this.mapProps.scriptParams);
@@ -4175,7 +4183,7 @@ function (_super) {
4175
4183
  target && (target.style.cursor = cursor);
4176
4184
  };
4177
4185
 
4178
- NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
4186
+ NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
4179
4187
  var _a;
4180
4188
 
4181
4189
  var markerBounds = PolygonCalculator.getRegionInfo(positions);
@@ -4185,9 +4193,22 @@ function (_super) {
4185
4193
  }
4186
4194
 
4187
4195
  var pointBounds = naver.maps.PointBounds.bounds(new naver.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new naver.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
4196
+ var marginOptions;
4197
+
4198
+ if (typeof spacing === 'number') {
4199
+ marginOptions = {
4200
+ top: spacing,
4201
+ right: spacing,
4202
+ bottom: spacing,
4203
+ left: spacing
4204
+ };
4205
+ } else if (spacing instanceof Spacing) {
4206
+ marginOptions = spacing;
4207
+ }
4208
+
4188
4209
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.panToBounds(pointBounds, {
4189
4210
  duration: 500
4190
- });
4211
+ }, marginOptions);
4191
4212
  };
4192
4213
 
4193
4214
  NaverMintMapController.prototype.naverPositionToOffset = function (position) {
@@ -4886,17 +4907,17 @@ function (_super) {
4886
4907
  });
4887
4908
  };
4888
4909
 
4889
- GoogleMintMapController.prototype.focusPositionsToFitViewport = function (posiitons) {
4910
+ GoogleMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
4890
4911
  var _a;
4891
4912
 
4892
- var markerBounds = PolygonCalculator.getRegionInfo(posiitons);
4913
+ var markerBounds = PolygonCalculator.getRegionInfo(positions);
4893
4914
 
4894
4915
  if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
4895
4916
  throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
4896
4917
  }
4897
4918
 
4898
4919
  var pointBounds = new google.maps.LatLngBounds(new google.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new google.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
4899
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds);
4920
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds, spacing);
4900
4921
  };
4901
4922
 
4902
4923
  GoogleMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -5640,7 +5661,7 @@ function (_super) {
5640
5661
  return latLng ? new Position(latLng.getLat(), latLng.getLng()) : new Position(0, 0);
5641
5662
  };
5642
5663
 
5643
- KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
5664
+ KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
5644
5665
  var _a;
5645
5666
 
5646
5667
  var markerBounds = PolygonCalculator.getRegionInfo(positions);
@@ -5650,7 +5671,16 @@ function (_super) {
5650
5671
  }
5651
5672
 
5652
5673
  var pointBounds = new kakao.maps.LatLngBounds(new kakao.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new kakao.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
5653
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds);
5674
+ var topSpacing, rightSpacing, bottomSpacing, leftSpacing;
5675
+
5676
+ if (typeof spacing === 'number') {
5677
+ topSpacing = rightSpacing = bottomSpacing = leftSpacing = spacing;
5678
+ } else if (spacing instanceof Spacing) {
5679
+ topSpacing = spacing.top, rightSpacing = spacing.right, bottomSpacing = spacing.bottom, leftSpacing = spacing.left;
5680
+ } // 카카오 지도는 setBounds 함수를 실행 할 때 애니메이션 효과가 없다.
5681
+
5682
+
5683
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds, topSpacing, rightSpacing, bottomSpacing, leftSpacing);
5654
5684
  };
5655
5685
 
5656
5686
  KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -5881,4 +5911,4 @@ function MintMap(_a) {
5881
5911
  }), loading));
5882
5912
  }
5883
5913
 
5884
- export { AnimationPlayer, Bounds, CanvasMarker, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, Status, getClusterInfo, getMapOfType, log, useMarkerMoving, useMintMapController, waiting };
5914
+ export { AnimationPlayer, Bounds, CanvasMarker, CircleMarker, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapEvent, MapLoadingWithImage, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, MapUIEvent, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, PointLoading, Polygon, PolygonCalculator, PolygonMarker, Polyline, Position, SVGCircle, SVGPolygon, SVGRect, Spacing, Status, getClusterInfo, getMapOfType, log, useMarkerMoving, useMintMapController, waiting };
package/dist/index.js CHANGED
@@ -77,5 +77,6 @@ exports.Polyline = MapDrawables.Polyline;
77
77
  exports.Bounds = MapTypes.Bounds;
78
78
  exports.Offset = MapTypes.Offset;
79
79
  exports.Position = MapTypes.Position;
80
+ exports.Spacing = MapTypes.Spacing;
80
81
  exports.MapEvent = MapEventTypes.MapEvent;
81
82
  exports.MapUIEvent = MapEventTypes.MapUIEvent;
package/dist/index.umd.js CHANGED
@@ -623,6 +623,14 @@
623
623
  return Offset;
624
624
  }();
625
625
 
626
+ var Spacing =
627
+ /** @class */
628
+ function () {
629
+ function Spacing() {}
630
+
631
+ return Spacing;
632
+ }();
633
+
626
634
  var MintMapControllerContext = React.createContext(null);
627
635
  function MintMapProvider(_a) {
628
636
  var controller = _a.controller,
@@ -3935,7 +3943,7 @@
3935
3943
  };
3936
3944
 
3937
3945
  params = tslib.__assign({
3938
- ncpClientId: this.mapProps.mapKey,
3946
+ ncpKeyId: this.mapProps.mapKey,
3939
3947
  submodules: this.scriptModules.join(','),
3940
3948
  callback: callbackName
3941
3949
  }, this.mapProps.scriptParams);
@@ -4179,7 +4187,7 @@
4179
4187
  target && (target.style.cursor = cursor);
4180
4188
  };
4181
4189
 
4182
- NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
4190
+ NaverMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
4183
4191
  var _a;
4184
4192
 
4185
4193
  var markerBounds = PolygonCalculator.getRegionInfo(positions);
@@ -4189,9 +4197,22 @@
4189
4197
  }
4190
4198
 
4191
4199
  var pointBounds = naver.maps.PointBounds.bounds(new naver.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new naver.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
4200
+ var marginOptions;
4201
+
4202
+ if (typeof spacing === 'number') {
4203
+ marginOptions = {
4204
+ top: spacing,
4205
+ right: spacing,
4206
+ bottom: spacing,
4207
+ left: spacing
4208
+ };
4209
+ } else if (spacing instanceof Spacing) {
4210
+ marginOptions = spacing;
4211
+ }
4212
+
4192
4213
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.panToBounds(pointBounds, {
4193
4214
  duration: 500
4194
- });
4215
+ }, marginOptions);
4195
4216
  };
4196
4217
 
4197
4218
  NaverMintMapController.prototype.naverPositionToOffset = function (position) {
@@ -4890,17 +4911,17 @@
4890
4911
  });
4891
4912
  };
4892
4913
 
4893
- GoogleMintMapController.prototype.focusPositionsToFitViewport = function (posiitons) {
4914
+ GoogleMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
4894
4915
  var _a;
4895
4916
 
4896
- var markerBounds = PolygonCalculator.getRegionInfo(posiitons);
4917
+ var markerBounds = PolygonCalculator.getRegionInfo(positions);
4897
4918
 
4898
4919
  if (!markerBounds.maxLat || !markerBounds.minLat || !markerBounds.maxLng || !markerBounds.minLng) {
4899
4920
  throw new Error('markerBounds is invalid! in focusPositionsToFitViewport');
4900
4921
  }
4901
4922
 
4902
4923
  var pointBounds = new google.maps.LatLngBounds(new google.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new google.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
4903
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds);
4924
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.fitBounds(pointBounds, spacing);
4904
4925
  };
4905
4926
 
4906
4927
  GoogleMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -5644,7 +5665,7 @@
5644
5665
  return latLng ? new Position(latLng.getLat(), latLng.getLng()) : new Position(0, 0);
5645
5666
  };
5646
5667
 
5647
- KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions) {
5668
+ KakaoMintMapController.prototype.focusPositionsToFitViewport = function (positions, spacing) {
5648
5669
  var _a;
5649
5670
 
5650
5671
  var markerBounds = PolygonCalculator.getRegionInfo(positions);
@@ -5654,7 +5675,16 @@
5654
5675
  }
5655
5676
 
5656
5677
  var pointBounds = new kakao.maps.LatLngBounds(new kakao.maps.LatLng(markerBounds.minLat, markerBounds.minLng), new kakao.maps.LatLng(markerBounds.maxLat, markerBounds.maxLng));
5657
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds);
5678
+ var topSpacing, rightSpacing, bottomSpacing, leftSpacing;
5679
+
5680
+ if (typeof spacing === 'number') {
5681
+ topSpacing = rightSpacing = bottomSpacing = leftSpacing = spacing;
5682
+ } else if (spacing instanceof Spacing) {
5683
+ topSpacing = spacing.top, rightSpacing = spacing.right, bottomSpacing = spacing.bottom, leftSpacing = spacing.left;
5684
+ } // 카카오 지도는 setBounds 함수를 실행 할 때 애니메이션 효과가 없다.
5685
+
5686
+
5687
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.setBounds(pointBounds, topSpacing, rightSpacing, bottomSpacing, leftSpacing);
5658
5688
  };
5659
5689
 
5660
5690
  KakaoMintMapController.prototype.addEventListener = function (eventName, callback) {
@@ -5919,6 +5949,7 @@
5919
5949
  exports.SVGCircle = SVGCircle;
5920
5950
  exports.SVGPolygon = SVGPolygon;
5921
5951
  exports.SVGRect = SVGRect;
5952
+ exports.Spacing = Spacing;
5922
5953
  exports.Status = Status;
5923
5954
  exports.getClusterInfo = getClusterInfo;
5924
5955
  exports.getMapOfType = getMapOfType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mint-ui/map",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "browser": "./dist/index.umd.js",
@@ -1,94 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <JSCodeStyleSettings version="0">
4
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
5
- <option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
6
- <option name="USE_DOUBLE_QUOTES" value="false" />
7
- <option name="FORCE_QUOTE_STYlE" value="true" />
8
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
9
- <option name="VAR_DECLARATION_WRAP" value="2" />
10
- <option name="OBJECT_LITERAL_WRAP" value="2" />
11
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
12
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
13
- <option name="FUNCTION_EXPRESSION_BRACE_STYLE" value="2" />
14
- </JSCodeStyleSettings>
15
- <TypeScriptCodeStyleSettings version="0">
16
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
- <option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
18
- <option name="USE_DOUBLE_QUOTES" value="false" />
19
- <option name="FORCE_QUOTE_STYlE" value="true" />
20
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
21
- <option name="VAR_DECLARATION_WRAP" value="2" />
22
- <option name="OBJECT_LITERAL_WRAP" value="2" />
23
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
24
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
25
- </TypeScriptCodeStyleSettings>
26
- <codeStyleSettings language="CSS">
27
- <indentOptions>
28
- <option name="USE_TAB_CHARACTER" value="true" />
29
- <option name="SMART_TABS" value="true" />
30
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
31
- </indentOptions>
32
- </codeStyleSettings>
33
- <codeStyleSettings language="HTML">
34
- <indentOptions>
35
- <option name="USE_TAB_CHARACTER" value="true" />
36
- <option name="SMART_TABS" value="true" />
37
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
38
- </indentOptions>
39
- </codeStyleSettings>
40
- <codeStyleSettings language="JSON">
41
- <indentOptions>
42
- <option name="USE_TAB_CHARACTER" value="true" />
43
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
44
- </indentOptions>
45
- </codeStyleSettings>
46
- <codeStyleSettings language="JavaScript">
47
- <option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
48
- <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
49
- <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
50
- <option name="BRACE_STYLE" value="2" />
51
- <option name="CLASS_BRACE_STYLE" value="2" />
52
- <option name="METHOD_BRACE_STYLE" value="2" />
53
- <option name="ELSE_ON_NEW_LINE" value="true" />
54
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
55
- <option name="ALIGN_MULTILINE_FOR" value="false" />
56
- <option name="METHOD_CALL_CHAIN_WRAP" value="2" />
57
- <option name="IF_BRACE_FORCE" value="1" />
58
- <option name="DOWHILE_BRACE_FORCE" value="1" />
59
- <option name="WHILE_BRACE_FORCE" value="1" />
60
- <option name="FOR_BRACE_FORCE" value="1" />
61
- <indentOptions>
62
- <option name="SMART_TABS" value="true" />
63
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
64
- </indentOptions>
65
- </codeStyleSettings>
66
- <codeStyleSettings language="TypeScript">
67
- <option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
68
- <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
69
- <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
70
- <option name="ELSE_ON_NEW_LINE" value="true" />
71
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
72
- <option name="ALIGN_MULTILINE_FOR" value="false" />
73
- <option name="METHOD_CALL_CHAIN_WRAP" value="2" />
74
- <option name="IF_BRACE_FORCE" value="1" />
75
- <option name="DOWHILE_BRACE_FORCE" value="1" />
76
- <option name="WHILE_BRACE_FORCE" value="1" />
77
- <option name="FOR_BRACE_FORCE" value="1" />
78
- <indentOptions>
79
- <option name="INDENT_SIZE" value="2" />
80
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
81
- <option name="TAB_SIZE" value="2" />
82
- <option name="SMART_TABS" value="true" />
83
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
84
- </indentOptions>
85
- </codeStyleSettings>
86
- <codeStyleSettings language="XML">
87
- <indentOptions>
88
- <option name="USE_TAB_CHARACTER" value="true" />
89
- <option name="SMART_TABS" value="true" />
90
- <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
91
- </indentOptions>
92
- </codeStyleSettings>
93
- </code_scheme>
94
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,15 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GitToolBoxProjectSettings">
4
- <option name="commitMessageIssueKeyValidationOverride">
5
- <BoolValueOverride>
6
- <option name="enabled" value="true" />
7
- </BoolValueOverride>
8
- </option>
9
- <option name="commitMessageValidationEnabledOverride">
10
- <BoolValueOverride>
11
- <option name="enabled" value="true" />
12
- </BoolValueOverride>
13
- </option>
14
- </component>
15
- </project>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>