diff --git a/lib/OpenLayers/Control/MousePosition.js b/lib/OpenLayers/Control/MousePosition.js index 4faab3b244..b0f0c007eb 100644 --- a/lib/OpenLayers/Control/MousePosition.js +++ b/lib/OpenLayers/Control/MousePosition.js @@ -130,6 +130,21 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, { } + var newHtml = this.formatOutput(lonLat); + + if (newHtml != this.element.innerHTML) { + this.element.innerHTML = newHtml; + } + }, + + /** + * Method: formatOutput + * Override to provide custom display output + * + * Parameters: + * lonLat - {} Location to display + */ + formatOutput: function(lonLat) { var digits = parseInt(this.numdigits); var newHtml = this.prefix + @@ -137,11 +152,8 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, { this.separator + lonLat.lat.toFixed(digits) + this.suffix; - - if (newHtml != this.element.innerHTML) { - this.element.innerHTML = newHtml; - } - }, + return newHtml; + }, /** * Method: setMap