Skip to content

Commit

Permalink
feat(OverlayView): allow rendered as children of MarkerCluster
Browse files Browse the repository at this point in the history
* Let `OverlayView` be clusterd in `MarkerClusterer`
* Thanks to @ziad-saab 
* Closes #187
  • Loading branch information
ziad-saab authored and tomchentw committed May 29, 2016
1 parent 19585b8 commit 435961a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/creators/OverlayViewCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ export default class OverlayViewCreator extends Component {
}
};

// If we're inside a MarkerClusterer, allow ourselves to be clustered
if (overlayViewProps.anchorHolderRef) {
if (`MarkerClusterer` === overlayViewProps.anchorHolderRef.getAnchorType()) {
overlayView.getDraggable = function getDraggable() {
return !!overlayViewProps.draggable;
};

overlayView.getPosition = function getPosition() {
return new google.maps.LatLng(this.position);
};

overlayViewProps.anchorHolderRef.getAnchor().addMarker(overlayView);
}
}

return overlayView;
}

Expand Down

0 comments on commit 435961a

Please sign in to comment.