Skip to content

Commit

Permalink
map添加forceUpdate参数
Browse files Browse the repository at this point in the history
  • Loading branch information
hinikai committed Sep 5, 2017
1 parent 9168361 commit e2d09a2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/dist/react-bmap.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/examples/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18691,13 +18691,13 @@ var Map = function (_Component) {
this.map.centerAndZoom(center);
}
} else {
if (preCenter.lng != center.lng || preCenter.lat != center.lat) {
if (preCenter.lng != center.lng || preCenter.lat != center.lat || this.props.forceUpdate) {
this.map.setCenter(new BMap.Point(center.lng, center.lat));
}
}
}

if (prevProps.zoom !== this.props.zoom && this.props.zoom) {
if (prevProps.zoom !== this.props.zoom && this.props.zoom || this.props.forceUpdate) {
this.map.zoomTo(this.props.zoom);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-bmap",
"version": "1.0.42",
"version": "1.0.43",
"description": "react-bmap",
"main": "lib/index.js",
"contributors": [
Expand Down
4 changes: 2 additions & 2 deletions src/components/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ export default class Map extends Component {
this.map.centerAndZoom(center);
}
} else {
if (preCenter.lng != center.lng || preCenter.lat != center.lat) {
if (preCenter.lng != center.lng || preCenter.lat != center.lat || this.props.forceUpdate) {
this.map.setCenter(new BMap.Point(center.lng, center.lat));
}
}
}

if (prevProps.zoom !== this.props.zoom && this.props.zoom) {
if (prevProps.zoom !== this.props.zoom && this.props.zoom || this.props.forceUpdate) {
this.map.zoomTo(this.props.zoom);
}
}
Expand Down

0 comments on commit e2d09a2

Please sign in to comment.