markerclustererplus-rails 2.0.1 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,7 +5,7 @@ The files will be added to the asset pipeline and available for you to use.
5
5
 
6
6
  For info on how to use the library see the original documentation:
7
7
 
8
- [MarkerClustererPlus for Google Maps V3](http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.1/docs/reference.html)
8
+ [MarkerClustererPlus for Google Maps V3](http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.3/docs/reference.html)
9
9
 
10
10
  ## Installation
11
11
 
@@ -1,5 +1,5 @@
1
1
  module Markerclustererplus
2
2
  module Rails
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.3"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  /**
5
5
  * @name MarkerClustererPlus for Google Maps V3
6
- * @version 2.0.1 [July 27, 2011]
6
+ * @version 2.0.3 [September 21, 2011]
7
7
  * @author Gary Little
8
8
  * @fileoverview
9
9
  * The library creates and manages per-zoom-level clusters for large amounts of markers.
@@ -61,6 +61,11 @@
61
61
  * and less than <code>height</code> and the <code>xoffset</code> must be positive and less
62
62
  * than <code>width</code>. The default is to anchor the label text so that it is centered
63
63
  * on the icon.
64
+ * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the
65
+ * spot on the cluster icon that is to be aligned with the cluster position. The format is
66
+ * <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and
67
+ * <code>xoffset</code> increases to the right. The default anchor position is the center of the
68
+ * cluster icon.
64
69
  * @property {string} [textColor="black"] The color of the label text shown on the
65
70
  * cluster icon.
66
71
  * @property {number} [textSize=11] The size (in pixels) of the label text shown on the
@@ -243,6 +248,7 @@ ClusterIcon.prototype.useStyle = function (sums) {
243
248
  this.height_ = style.height;
244
249
  this.width_ = style.width;
245
250
  this.anchor_ = style.anchor;
251
+ this.anchorIcon_ = style.anchorIcon || [parseInt(this.height_ / 2, 10), parseInt(this.width_ / 2, 10)];
246
252
  this.textColor_ = style.textColor || "black";
247
253
  this.textSize_ = style.textSize || 11;
248
254
  this.textDecoration_ = style.textDecoration || "none";
@@ -273,6 +279,7 @@ ClusterIcon.prototype.createCss = function (pos) {
273
279
  var style = [];
274
280
  if (!this.cluster_.printable_) {
275
281
  style.push('background-image:url(' + this.url_ + ');');
282
+ style.push('background-size:' + this.width_ + 'px ' + this.height_ + 'px;'); //For iPhone retina display
276
283
  style.push('background-position:' + this.backgroundPosition_ + ';');
277
284
  }
278
285
 
@@ -314,8 +321,8 @@ ClusterIcon.prototype.createCss = function (pos) {
314
321
  */
315
322
  ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
316
323
  var pos = this.getProjection().fromLatLngToDivPixel(latlng);
317
- pos.x -= parseInt(this.width_ / 2, 10);
318
- pos.y -= parseInt(this.height_ / 2, 10);
324
+ pos.x -= this.anchorIcon_[1];
325
+ pos.y -= this.anchorIcon_[0];
319
326
  return pos;
320
327
  };
321
328
 
@@ -438,6 +445,7 @@ Cluster.prototype.remove = function () {
438
445
  Cluster.prototype.addMarker = function (marker) {
439
446
  var i;
440
447
  var mCount;
448
+ var mz;
441
449
 
442
450
  if (this.isMarkerAlreadyAdded_(marker)) {
443
451
  return false;
@@ -460,7 +468,8 @@ Cluster.prototype.addMarker = function (marker) {
460
468
  this.markers_.push(marker);
461
469
 
462
470
  mCount = this.markers_.length;
463
- if (this.map_.getZoom() > this.markerClusterer_.getMaxZoom()) {
471
+ mz = this.markerClusterer_.getMaxZoom();
472
+ if (mz !== null && this.map_.getZoom() > mz) {
464
473
  // Zoomed in past max zoom, so show the marker.
465
474
  if (marker.getMap() !== this.map_) {
466
475
  marker.setMap(this.map_);
@@ -510,8 +519,9 @@ Cluster.prototype.calculateBounds_ = function () {
510
519
  */
511
520
  Cluster.prototype.updateIcon_ = function () {
512
521
  var mCount = this.markers_.length;
522
+ var mz = this.markerClusterer_.getMaxZoom();
513
523
 
514
- if (this.map_.getZoom() > this.markerClusterer_.getMaxZoom()) {
524
+ if (mz !== null && this.map_.getZoom() > mz) {
515
525
  this.clusterIcon_.hide();
516
526
  return;
517
527
  }
@@ -845,7 +855,7 @@ MarkerClusterer.prototype.setMinimumClusterSize = function (minimumClusterSize)
845
855
  * @return {number} The maximum zoom level.
846
856
  */
847
857
  MarkerClusterer.prototype.getMaxZoom = function () {
848
- return this.maxZoom_ || this.getMap().mapTypes[this.getMap().getMapTypeId()].maxZoom;
858
+ return this.maxZoom_;
849
859
  };
850
860
 
851
861
 
@@ -1497,7 +1507,7 @@ MarkerClusterer.prototype.extend = function (obj1, obj2) {
1497
1507
  * The default function for determining the label text and style
1498
1508
  * for a cluster icon.
1499
1509
  *
1500
- * @param {Array.<google.maps.Marker>} markers The array of represented by the cluster.
1510
+ * @param {Array.<google.maps.Marker>} markers The array of markers represented by the cluster.
1501
1511
  * @param {number} numStyles The number of marker styles available.
1502
1512
  * @return {ClusterIconInfo} The information resource for the cluster.
1503
1513
  * @constant
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markerclustererplus-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 1
10
- version: 2.0.1
9
+ - 3
10
+ version: 2.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - RogerE