mdeutch3 / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

anchorPoint is incorrect if you have a style href in the kml #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a KML file that includes a style that has an href
2. Load the file into a map
3. Open the .html file in any browser

What is the expected output? What do you see instead?
Load the KML of all the markers. Notice that the marker is not centered over 
the desired lat/long

What version of the product are you using? On what operating system?
r=44. Windows Vista

Please provide any additional information below.
Line 632 has an incorrect anchor point, currently it is 12 should be 32!

var processStyleID = function (style) {
      var zeroPoint = new google.maps.Point(0,0);
      if (!!style.href) {
        var markerRegEx = /\/(red|blue|green|yellow|lightblue|purple|pink|orange|pause|go|stop)(-dot)?\.png/;
        if (markerRegEx.test(style.href)) {
         //bottom middle
      var anchorPoint = new google.maps.Point(16*style.scale, 32*style.scale);
    } else {
         //incorrect anchor point below 
     // var anchorPoint = new google.maps.Point(16*style.scale, 12*style.scale);
 //It should be 32 to be the middle center of the default size 
 var anchorPoint = new google.maps.Point(16*style.scale, 32*style.scale);

    }
        // Init the style object with a standard KML icon
        style.icon =  new google.maps.MarkerImage(
          style.href,
          new google.maps.Size(32*style.scale, 32*style.scale),
          zeroPoint,
          // bottom middle 
          anchorPoint,
          new google.maps.Size(32,32)

        );

Original issue reported on code.google.com by ruth.vil...@gmail.com on 3 Feb 2011 at 6:27

GoogleCodeExporter commented 9 years ago
The default size is 32x32.  It probably should be 16, not 12.  Do you have a 
link to an example that shows the problem?  Or a link to an icon that shows the 
problem?

Original comment by geocodezip on 4 Feb 2011 at 8:07

GoogleCodeExporter commented 9 years ago

Original comment by geocodezip on 4 Feb 2011 at 8:08

GoogleCodeExporter commented 9 years ago
Changed to 16*style.size.  Fixes icon centering for stars in this example:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_us_states_AK_kml_test_local.ht
ml
(makes them the same as KmlLayer)

Original comment by geocodezip on 4 Feb 2011 at 8:20