killlllme / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

markerclusterer - iphone retina display support - code snippet provided #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm providing this minor modification to support retina displays on iPhones.... 
there may be a better way, but it works for me.  This is from the 2.0.1 
release, so there may be a difference for the latest development version... I 
have not checked.

(at or around line 268)
ClusterIcon.prototype.createCss = function (pos) {
  var style = [];
  if (!this.cluster_.printable_) {
    style.push('background-image:url(' + this.url_ + ');');
    style.push('background-size:auto '+ this.height_ +'px;'); //added to support retina
    style.push('background-repeat:no-repeat;'); //added to support retina
    style.push('background-position:' + this.backgroundPosition_ + ';');
  }

Image sources should be the double resolution of the intended end height and 
width on the map.  The icons are clear and crisp on an iPhone4!  There should 
be no bad side affects for those who still provide standard result ion icons 
for desktop browsers.

Thanks for considering it.

Original issue reported on code.google.com by d...@daleshaw.com on 8 Sep 2011 at 5:49

GoogleCodeExporter commented 9 years ago
I'm trying to simplify your code. Can I change the two lines you've added to 
the following single line:

style.push('background-size: ' + this.width_ + 'px ' + this.height_ + 'px;'); 
//added to support retina

It seems to me that the background-repeat statement is redundant because the 
size of the container is exactly the same as the background size.

Original comment by garylitt...@gmail.com on 8 Sep 2011 at 8:59

GoogleCodeExporter commented 9 years ago
style.push('background-size: ' + this.width_ + 'px ' + this.height_ + 'px;'); 
//added to support retina

works fine, and you're right the no-repeat line was unnecessary.

Original comment by d...@daleshaw.com on 9 Sep 2011 at 4:50

GoogleCodeExporter commented 9 years ago
I have now added this line to the trunk version of MarkerClustererPlus.

See:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererpl
us/

Original comment by garylitt...@gmail.com on 9 Sep 2011 at 2:11

GoogleCodeExporter commented 9 years ago

Original comment by garylitt...@gmail.com on 27 Feb 2012 at 4:38