Ox.Map: add markerTooltip option (custom format function)

This commit is contained in:
rolux 2012-08-31 09:22:15 +02:00
parent 6f545969e4
commit 3e57cbd785
2 changed files with 5 additions and 1 deletions

View file

@ -14,6 +14,7 @@ Ox.Map <f> Basic map object
keys <a|[]> Additional place properties to be requested
markerColor <[n]|f|s|'auto'> Color of place markers ([r, g, b])
markerSize <n|f||s|'auto'> Size of place markers in px
markerTooltip <f> Format function for place marker tooltips
maxMarkers <n|100> Maximum number of markers to be displayed
places <[o]|f|null> Array of, or function that returns, place objects
countryCode <s> ISO 3166 country code
@ -94,6 +95,9 @@ Ox.Map = function(options, self) {
keys: [],
markerColor: 'auto',
markerSize: 'auto',
markerTooltip: function(place) {
return place.name || '<span class="OxLight">Unnamed</span>';
},
maxMarkers: 100,
places: null,
selected: '',

View file

@ -256,7 +256,7 @@ Ox.MapMarker = function(options) {
+ Ox.getFlagByGeoname(that.place.geoname, 16)
+ '" style="float: left; margin: 1px 0 1px -1px; border-radius: 4px"/>'
+ '<div style="float: left; margin: 4px -1px 0 4px; font-size: 9px;">'
+ (that.place.name || '<span class="OxLight">Unnamed</span>') + '</div>'
+ that.map.options('markerTooltip')(that.place) + '</div>'
})
.addClass('OxMapMarkerTooltip');
}