Skip to content

Commit

Permalink
MarkerClustererPlus 2.1.1: Fix for Issue 266 + Cleaned up label styli…
Browse files Browse the repository at this point in the history
…ng code.

git-svn-id: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus@456 b4c4f48c-70f0-11de-9ad3-cbed566d3045
  • Loading branch information
garylittleRLP authored and garylittleRLP committed Nov 4, 2013
1 parent f61a951 commit 9e9dd4e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/examples.html
Expand Up @@ -66,13 +66,13 @@ <h1>MarkerClustererPlus Examples</h1>
var map = new google.maps.Map(document.getElementById("map"), options);

var mcOptions = {gridSize: 50, maxZoom: 15};
var markers = [...]; // Create the markers you want to add and collect them into a array.
var markers = [...]; // Create the markers you want to add and collect them into an array.
var mc = new MarkerClusterer(map, markers, mcOptions);
</pre>

<h2><a name="Marker_Clusterer" id="Marker_Clusterer"></a>Simple Example</h2>

<p>This example will show 100 markers on map.</p>
<p>This example will show 100 markers on a map.</p>

<pre class="prettyprint">
var center = new google.maps.LatLng(37.4419, -122.1419);
Expand Down
2 changes: 1 addition & 1 deletion docs/reference.html
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MarkerClustererPlus for Google Maps V3 v2.1 [November 3, 2013] Reference</title>
<title>MarkerClustererPlus for Google Maps V3 v2.1.1 [November 4, 2013] Reference</title>
<link rel="stylesheet" type="text/css" href="http://code.google.com/css/codesite.css"></link>
<link rel="stylesheet" type="text/css" href="../../util/docs/template/local_extensions.css"></link>
</head>
Expand Down
9 changes: 4 additions & 5 deletions examples/advanced_example.html
Expand Up @@ -70,7 +70,6 @@
url: '../images/people55.png',
width: 55,
height: 55,
backgroundPosition: "0 0",
textColor: '#ffffff',
textSize: 12
}], [{
Expand Down Expand Up @@ -206,7 +205,6 @@ <h3>An example of MarkerClustererPlus</h3>
<option value="13">13</option>
<option value="14">14</option>
</select>

</span>
<span class="item">Cluster size:
<select id="size">
Expand All @@ -223,9 +221,10 @@ <h3>An example of MarkerClustererPlus</h3>
<option value="0">People</option>
<option value="1">Conversation</option>
<option value="2">Heart</option>
</select>
<input id="refresh" type="button" value="Refresh Map" class="item"/>
<a href="#" id="clear">Clear</a>
</select>
</span>
<input id="refresh" type="button" value="Refresh Map" class="item"/>
<a href="#" id="clear">Clear</a>
</div>
</body>
</html>
41 changes: 24 additions & 17 deletions src/markerclusterer.js
@@ -1,6 +1,6 @@
/**
* @name MarkerClustererPlus for Google Maps V3
* @version 2.1 [November 3, 2013]
* @version 2.1.1 [November 4, 2013]
* @author Gary Little
* @fileoverview
* The library creates and manages per-zoom-level clusters for large amounts of markers.
Expand Down Expand Up @@ -254,11 +254,20 @@ ClusterIcon.prototype.show = function () {
((-1 * spriteV) + this.height_) + "px, " + (-1 * spriteH) + "px);";
}
img += "'>";
// (Would like to use "width: inherit;" below, but doesn't work with MSIE)
this.div_.innerHTML = img + "<div style='position: absolute; " +
"top: " + this.anchorText_[0] + "px; " +
"left: " + this.anchorText_[1] + "px; " +
"width: " + this.width_ + "px;'>" + this.sums_.text + "</div>";
this.div_.innerHTML = img + "<div style='" +
"position: absolute;" +
"top: " + this.anchorText_[0] + "px;" +
"left: " + this.anchorText_[1] + "px;" +
"color: " + this.textColor_ + ";" +
"font-size: " + this.textSize_ + "px;" +
"font-family: " + this.fontFamily_ + ";" +
"font-weight: " + this.fontWeight_ + ";" +
"font-style: " + this.fontStyle_ + ";" +
"text-decoration: " + this.textDecoration_ + ";" +
"text-align: center;" +
"width: " + this.width_ + "px;" +
"line-height:" + this.height_ + "px;" +
"'>" + this.sums_.text + "</div>";
if (typeof this.sums_.title === "undefined" || this.sums_.title === "") {
this.div_.title = this.cluster_.getMarkerClusterer().getTitle();
} else {
Expand Down Expand Up @@ -313,13 +322,9 @@ ClusterIcon.prototype.setCenter = function (center) {
*/
ClusterIcon.prototype.createCss = function (pos) {
var style = [];
style.push('width:' + this.width_ + 'px; height:' + this.height_ + 'px;');
style.push('text-align:center; line-height:' + this.height_ + 'px;');
style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
pos.x + 'px; color:' + this.textColor_ + '; position:absolute; font-size:' +
this.textSize_ + 'px; font-family:' + this.fontFamily_ + '; font-weight:' +
this.fontWeight_ + '; font-style:' + this.fontStyle_ + '; text-decoration:' +
this.textDecoration_ + ';');
style.push("cursor: pointer;");
style.push("position: absolute; top: " + pos.y + "px; left: " + pos.x + "px;");
style.push("width: " + this.width_ + "px; height: " + this.height_ + "px;");
return style.join("");
};

Expand Down Expand Up @@ -1183,10 +1188,12 @@ MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
*/
MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) {
var i;
for (i = 0; i < markers.length; i++) {
this.pushMarkerTo_(markers[i]);
}
var key;
for (key in markers) {
if (markers.hasOwnProperty(key)) {
this.pushMarkerTo_(markers[key]);
}
}
if (!opt_nodraw) {
this.redraw_();
}
Expand Down

0 comments on commit 9e9dd4e

Please sign in to comment.