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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user