From 6632ceb1d767a215859d9987ed4114513995dfdb Mon Sep 17 00:00:00 2001 From: yabby Date: Tue, 6 Apr 2021 13:41:41 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EC=A2=8C=ED=91=9C=20?= =?UTF-8?q?=EC=9E=AC=EC=84=A4=EC=A0=95=EC=8B=9C=20setCenter=20=EB=8C=80?= =?UTF-8?q?=EC=8B=A0=20panTo=EB=A1=9C=20=EC=A2=8C=ED=91=9C=20=EB=B6=80?= =?UTF-8?q?=EB=93=9C=EB=9F=BD=EA=B2=8C=20=EC=9D=B4=EB=8F=99=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/Map.js | 5 ++++- src/Map.tsx | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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) {