NavigationHistory - move the code for getting the current state from an anonymous function to a method of the class, r=bartvde (closes #2377)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9867 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -126,12 +126,7 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
|
||||
this.registry = OpenLayers.Util.extend({
|
||||
"moveend": function() {
|
||||
return {
|
||||
center: this.map.getCenter(),
|
||||
resolution: this.map.getResolution()
|
||||
};
|
||||
}
|
||||
"moveend": this.getState
|
||||
}, this.registry);
|
||||
|
||||
this.clear();
|
||||
@@ -288,6 +283,20 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.nextStack = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getState
|
||||
* Get the current state and return it.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} An object representing the current state.
|
||||
*/
|
||||
getState: function() {
|
||||
return {
|
||||
center: this.map.getCenter(),
|
||||
resolution: this.map.getResolution()
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: restore
|
||||
* Update the state with the given object.
|
||||
|
||||
Reference in New Issue
Block a user