diff --git a/lib/OpenLayers/Control/MousePosition.js b/lib/OpenLayers/Control/MousePosition.js index d7e310f0ec..e51fa2da1d 100644 --- a/lib/OpenLayers/Control/MousePosition.js +++ b/lib/OpenLayers/Control/MousePosition.js @@ -61,6 +61,16 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.prototype.initialize.apply(this, arguments); }, + /** + * Method: destroy + */ + destroy: function() { + if (this.map) { + this.map.events.unregister('mousemove', this, this.redraw); + } + OpenLayers.Control.prototype.destroy.apply(this, arguments); + }, + /** * Method: draw * {DOMElement} diff --git a/tests/Control/test_MousePosition.html b/tests/Control/test_MousePosition.html new file mode 100644 index 0000000000..20b470914e --- /dev/null +++ b/tests/Control/test_MousePosition.html @@ -0,0 +1,45 @@ + + + + + + +
+ + diff --git a/tests/list-tests.html b/tests/list-tests.html index b13a295001..afa23de227 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -71,6 +71,7 @@
  • Control/test_OverviewMap.html
  • Control/test_NavToolbar.html
  • Control/test_MouseToolbar.html
  • +
  • Control/test_MousePosition.html
  • Control/test_LayerSwitcher.html
  • Control/test_Panel.html
  • Control/test_PanZoom.html