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
This commit is contained in:
crschmidt
2008-01-27 02:26:36 +00:00
parent cd266a99e0
commit 83d5461796

View File

@@ -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 - {<OpenLayers.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