Skip to content

Commit

Permalink
* Prevent Marker from redrawing clusters when being added / removed
Browse files Browse the repository at this point in the history
  • Loading branch information
amangeot committed Nov 25, 2016
1 parent 7c049d3 commit 414f676
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ var controlledPropTypes = {

label: _react.PropTypes.any,

noRedraw: _react.PropTypes.bool,

opacity: _react.PropTypes.number,

options: _react.PropTypes.object,
Expand Down Expand Up @@ -236,7 +238,7 @@ exports.default = (0, _flowRight3.default)(_react2.default.createClass, (0, _enh
var marker = new google.maps.Marker((0, _enhanceElement.collectUncontrolledAndControlledProps)(defaultUncontrolledPropTypes, controlledPropTypes, this.props));
var markerClusterer = this.context[_constants.MARKER_CLUSTERER];
if (markerClusterer) {
markerClusterer.addMarker(marker, true);
markerClusterer.addMarker(marker, !!this.props.noRedraw);
} else {
marker.setMap(this.context[_constants.MAP]);
}
Expand All @@ -250,7 +252,7 @@ exports.default = (0, _flowRight3.default)(_react2.default.createClass, (0, _enh
if (marker) {
var markerClusterer = this.context[_constants.MARKER_CLUSTERER];
if (markerClusterer) {
markerClusterer.removeMarker(marker, true);
markerClusterer.removeMarker(marker, !!this.props.noRedraw);
}
marker.setMap(null);
}
Expand Down
6 changes: 4 additions & 2 deletions src/lib/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const controlledPropTypes = {

label: PropTypes.any,

noRedraw: PropTypes.bool,

opacity: PropTypes.number,

options: PropTypes.object,
Expand Down Expand Up @@ -211,7 +213,7 @@ export default _.flowRight(
);
const markerClusterer = this.context[MARKER_CLUSTERER];
if (markerClusterer) {
markerClusterer.addMarker(marker, true);
markerClusterer.addMarker(marker, !!this.props.noRedraw);
} else {
marker.setMap(this.context[MAP]);
}
Expand All @@ -231,7 +233,7 @@ export default _.flowRight(
if (marker) {
const markerClusterer = this.context[MARKER_CLUSTERER];
if (markerClusterer) {
markerClusterer.removeMarker(marker, true);
markerClusterer.removeMarker(marker, !!this.props.noRedraw);
}
marker.setMap(null);
}
Expand Down

0 comments on commit 414f676

Please sign in to comment.