r67290 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67289‎ | r67290 | r67291 >
Date:18:11, 3 June 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed javascript issue with Google Maps markers
Modified paths:
  • /trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.js
@@ -28,19 +28,25 @@
2929 var iconObj = new GIcon( G_DEFAULT_ICON );
3030 iconObj.image = icon;
3131
32 - /* Determine size of icon and pass it in */
 32+
3333 var newimg = new Image();
3434 newimg.src = icon;
35 - iconObj.iconSize.width = newimg.width;
36 - iconObj.iconSize.height = newimg.height;
37 - iconObj.shadow = null;
 35+
 36+ // Only do these things when there is an actual width, which there won,t the first time the image is loaded.
 37+ // TODO: this means the image won't have it's correct size when it differs from the default on first load!
 38+ if ( newimg.width > 0 ) {
 39+ /* Determine size of icon and pass it in */
 40+ iconObj.iconSize.width = newimg.width;
 41+ iconObj.iconSize.height = newimg.height;
 42+ iconObj.shadow = null;
 43+
 44+ /* Anchor the icon on bottom middle */
 45+ var anchor = new GPoint();
 46+ anchor.x = Math.floor( newimg.width / 2 );
 47+ anchor.y = newimg.height;
 48+ iconObj.iconAnchor = anchor;
 49+ }
3850
39 - /* Anchor the icon on center */
40 - var anchor = new GPoint();
41 - anchor.x = Math.floor( newimg.width / 2 );
42 - anchor.y = Math.floor( newimg.height / 2 );
43 - iconObj.iconAnchor = anchor;
44 -
4551 marker = new GMarker( point, { icon:iconObj } );
4652 } else {
4753 marker = new GMarker( point );

Status & tagging log