From 3e57cbd7859b5fb404cfa174eb57d3ab097017f7 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 31 Aug 2012 09:22:15 +0200 Subject: [PATCH] Ox.Map: add markerTooltip option (custom format function) --- source/Ox.UI/js/Map/Map.js | 4 ++++ source/Ox.UI/js/Map/MapMarker.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Ox.UI/js/Map/Map.js b/source/Ox.UI/js/Map/Map.js index 00ab4157..c67c131d 100644 --- a/source/Ox.UI/js/Map/Map.js +++ b/source/Ox.UI/js/Map/Map.js @@ -14,6 +14,7 @@ Ox.Map Basic map object keys Additional place properties to be requested markerColor <[n]|f|s|'auto'> Color of place markers ([r, g, b]) markerSize Size of place markers in px + markerTooltip Format function for place marker tooltips maxMarkers Maximum number of markers to be displayed places <[o]|f|null> Array of, or function that returns, place objects countryCode ISO 3166 country code @@ -94,6 +95,9 @@ Ox.Map = function(options, self) { keys: [], markerColor: 'auto', markerSize: 'auto', + markerTooltip: function(place) { + return place.name || 'Unnamed'; + }, maxMarkers: 100, places: null, selected: '', diff --git a/source/Ox.UI/js/Map/MapMarker.js b/source/Ox.UI/js/Map/MapMarker.js index 6ad1551e..0b1be55e 100644 --- a/source/Ox.UI/js/Map/MapMarker.js +++ b/source/Ox.UI/js/Map/MapMarker.js @@ -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"/>' + '
' - + (that.place.name || 'Unnamed') + '
' + + that.map.options('markerTooltip')(that.place) + '' }) .addClass('OxMapMarkerTooltip'); }