abhinandanramesh / google-maps-utility-library-v3

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

Style's textColor, anchor, textSize incorrectly documented and not obfuscated correctly in compiled js #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Just a few small nits a I noticed when using this library.

Version: 3

Browser / Operating System: Any

Additional comments:

Refer to http://google-maps-utility-library-
v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js

Documentation lists 'anchor', 'textColor' and 'textSize':

 *     'styles': (object) An object that has style properties:
 *       'url': (string) The image url.
 *       'height': (number) The image height.
 *       'width': (number) The image width.
 *       'anchor': (Array) The anchor position of the label text.
 *       'textColor': (string) The text color.
 *       'textSize': (number) The text size.

But the code uses opt_textColor, opt_anchor, opt_textSize:

ClusterIcon.prototype.useStyle = function() {
  var index = Math.max(0, this.sums_.index - 1);
  index = Math.min(this.styles_.length - 1, index);
  var style = this.styles_[index];
  this.url_ = style.url;
  this.height_ = style.height;
  this.width_ = style.width;
  this.textColor_ = style.opt_textColor;
  this.anchor = style.opt_anchor;
  this.textSize_ = style.opt_textSize;
};

Further, look at http://google-maps-utility-library-
v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js

You can find the compiled version of ClusterIcon.prototype.useStyle by 
inspection:

a.G=b.url;a.g=b.height;a.n=b.width;a.D=b.Y;a.anchor=b.X;a.F=b.Z;

Notice that opt_textColor is referred to as 'Y', opt_anchor as 'X' and 
opt_textSize as 'Z'.  That means to pass in an array of styles in the 
constructor while using the compiled js, you have to use X, Y, and Z as 
property names instead of their real names, which is not robust in the face 
of changes to the obfuscator.

Original issue reported on code.google.com by shak...@google.com on 16 Apr 2010 at 3:33

GoogleCodeExporter commented 9 years ago
It looks like this has been fixed now, thanks!  Feel free to close the bug.

Original comment by shak...@google.com on 19 Aug 2010 at 9:01

GoogleCodeExporter commented 9 years ago
I found a similar bug. textColor and textSize doesn't work in the compiled 
version of markerclusterer, but it does in the uncompiled version. So I guess 
its not fixed then.

Original comment by henk.sch...@gmail.com on 8 Sep 2010 at 1:27

GoogleCodeExporter commented 9 years ago

Original comment by lu...@google.com on 6 Oct 2010 at 12:00