OpenLayers OpenLayers

Ticket #778: mp.patch

File mp.patch, 1.1 kB (added by kleptog, 1 year ago)

Patch to seperate formatting out into a seperate overrideable function

  • lib/OpenLayers/Control/MousePosition.js

    old new  
    130130             
    131131        } 
    132132         
     133        var newHtml = this.formatOutput(lonLat); 
     134 
     135        if (newHtml != this.element.innerHTML) { 
     136            this.element.innerHTML = newHtml; 
     137        } 
     138    }, 
     139 
     140    /** 
     141     * Method: formatOutput 
     142     * Override to provide custom display output 
     143     * 
     144     * Parameters: 
     145     * lonLat - {<OpenLayers.LonLat>} Location to display 
     146     */ 
     147    formatOutput: function(lonLat) { 
    133148        var digits = parseInt(this.numdigits); 
    134149        var newHtml = 
    135150            this.prefix + 
     
    137152            this.separator +  
    138153            lonLat.lat.toFixed(digits) + 
    139154            this.suffix; 
     155        return newHtml; 
     156     }, 
    140157 
    141         if (newHtml != this.element.innerHTML) { 
    142             this.element.innerHTML = newHtml; 
    143         } 
    144     }, 
    145  
    146158    /**  
    147159     * Method: setMap 
    148160     */