From 83d54617964bbb53544dc8c28e61fc85da019627 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sun, 27 Jan 2008 02:26:36 +0000 Subject: [PATCH] Add a seperate method which actually does the formatting in the MousePosition control in order to allow easier changes in formatting at the application level (with less duplication of code). Patch from Kleptog, r=me. (Closes #778) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5906 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/MousePosition.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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