diff --git a/dist/Map.js b/dist/Map.js index 76ad7a8..5f3a598 100644 --- a/dist/Map.js +++ b/dist/Map.js @@ -18,8 +18,11 @@ export class Map extends React.PureComponent { const { options } = this.props; const { map } = this.state; if (map) { + if (prevOptions.center == null) { + map.setCenter(options.center) + } if (!prevOptions.center.equals(options.center)) { - map.setCenter(options.center); + map.panTo(options.center); } if (prevOptions.mapTypeId !== options.mapTypeId) { map.setMapTypeId(options.mapTypeId || daum.maps.MapTypeId.SKYVIEW); diff --git a/src/Map.tsx b/src/Map.tsx index 06a9b16..7665f80 100644 --- a/src/Map.tsx +++ b/src/Map.tsx @@ -39,8 +39,12 @@ export class Map extends React.PureComponent { const { options } = this.props const { map } = this.state if (map) { + if (prevOptions.center == null) { + map.setCenter(options.center) + } + if (!prevOptions.center.equals(options.center)) { - map.setCenter(options.center) + map.panTo(options.center); } if (prevOptions.mapTypeId !== options.mapTypeId) {