r65776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65775‎ | r65776 | r65777 >
Date:02:06, 2 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Applied solution of AlHooton for correct marker sizes
Modified paths:
  • /trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.js
@@ -21,18 +21,32 @@
2222 * Returns GMarker object on the provided location. It will show a popup baloon
2323 * with title and label when clicked, if either of these is set.
2424 */
25 -function createGMarker(point, title, label, icon) {
 25+function createGMarker( point, title, label, icon ) {
2626 var marker;
2727
28 - if (icon != '') {
29 - var iconObj = new GIcon(G_DEFAULT_ICON);
 28+ if ( icon != '' ) {
 29+ var iconObj = new GIcon( G_DEFAULT_ICON );
3030 iconObj.image = icon;
31 - marker = new GMarker(point, {icon:iconObj});
 31+
 32+ /* Determine size of icon and pass it in */
 33+ var newimg = new Image();
 34+ newimg.src = icon;
 35+ iconObj.iconSize.width = newimg.width;
 36+ iconObj.iconSize.height = newimg.height;
 37+ iconObj.shadow = null;
 38+
 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+
 45+ marker = new GMarker( point, { icon:iconObj } );
3246 } else {
33 - marker = new GMarker(point);
 47+ marker = new GMarker( point );
3448 }
3549
36 - if ((title + label).length > 0) {
 50+ if ( ( title + label ).length > 0 ) {
3751 var bothTxtAreSet = title.length > 0 && label.length > 0;
3852 var popupText = bothTxtAreSet ? '<b>' + title + '</b><hr />' + label : title + label;
3953 popupText = '<div style="overflow:auto;max-height:140px;">' + popupText + '</div>';

Status & tagging log