/ Published in: JavaScript
URL: http://code.google.com/p/wordpress-geo-mashup/wiki/Documentation#Custom_JavaScript
Some common custom javascript for customizing geo mashup map markers for Mapstraction map providers (any other than Google v2). The marker images used are 24 x 24 pixels, anchored at the bottom center, with no shadow. You'd put images in wp_content/plugins/geo-mashup-custom/images to work with this snippet.
Expand |
Embed | Plain Text
(function() { GeoMashup.addAction( 'colorIcon', function( properties, icon, color_name ) { // For single category icons use the Geo Mashup color icon names, // but the 24x24 ones in the custom image directory icon.image = properties.custom_url_path + '/images/mm_20_' + color_name + '.png'; icon.iconShadow = ''; icon.iconSize = [ 24, 24 ]; icon.iconAnchor = [ 12, 24 ]; icon.iconInfoWindowAnchor = [ 12, 1 ]; } ); GeoMashup.addAction( 'objectIcon', function( properties, obj ) { if ( obj.categories.length == 0 ) { // When there are no categories - mm_20_uncategorised.png obj.icon.image = properties.custom_url_path + '/images/mm_20_uncategorised.png'; obj.icon.iconShadow = ''; obj.icon.iconSize = [ 24, 24 ]; obj.icon.iconAnchor = [ 12, 24 ]; obj.icon.iconInfoWindowAnchor = [ 12, 1 ]; } else if ( obj.categories.length > 1 ) { // When there is more than one category - mm_20_mixed.png obj.icon.image = properties.custom_url_path + '/images/mm_20_mixed.png'; obj.icon.iconShadow = ''; obj.icon.iconSize = [ 24, 24 ]; obj.icon.iconAnchor = [ 12, 24 ]; obj.icon.iconInfoWindowAnchor = [ 12, 1 ]; } } ); GeoMashup.addAction( 'multiObjectMarker', function( properties, marker ) { // When there is more than one marker assigned to the same location - mm_20_plus.png marker.setIcon( properties.custom_url_path + '/images/mm_20_plus.png' ); } ); GeoMashup.addAction( 'singleMarkerOptions', function ( properties, options ) { // When the map is a single object map with just one marker options.icon.image = properties.custom_url_path + '/images/mm_20_uncategorised.png'; options.icon.iconShadow = ''; options.icon.iconSize = [ 24, 24 ]; options.icon.iconAnchor = [ 12, 24 ]; options.icon.iconInfoWindowAnchor = [ 12, 1 ]; } ); }());
You need to login to post a comment.
