Skip to content

Instantly share code, notes, and snippets.

@s2ar
Last active June 10, 2016 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s2ar/bf765f111e80b8d48592524481fd6186 to your computer and use it in GitHub Desktop.
Save s2ar/bf765f111e80b8d48592524481fd6186 to your computer and use it in GitHub Desktop.
Оформление иконки кластера (markerclustererplus library)
/**
* Adding the cluster icon to the dom.
* @ignore
*/
ClusterIcon.prototype.onAdd = function() {
this.div_ = document.createElement('DIV');
if (this.visible_) {
var pos = this.getPosFromLatLng_(this.center_);
this.div_.style.cssText = this.createCss(pos);
var innerHtml;
if (this.cluster_.markers_.length > 0) {
innerHtml = "<div><p class='clusterIconText'>" + this.sums_.text + "</p></div>";
}
this.div_.innerHTML = innerHtml;
}
var panes = this.getPanes();
panes.overlayMouseTarget.appendChild(this.div_);
var that = this;
google.maps.event.addDomListener(this.div_, 'click', function() {
that.triggerClusterClick();
});
};
.clusterIconText
{
margin-top:-70px;
margin-left:-70px;
color:#f2f2f2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment