From 0307d4868a8d822c2931613da90b774beb72843e Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 21 Sep 2007 11:44:36 +0000 Subject: [PATCH] Fix to mouseposition destroy from fredj git-svn-id: http://svn.openlayers.org/trunk/openlayers@4431 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/MousePosition.js | 10 ++++++ tests/Control/test_MousePosition.html | 45 +++++++++++++++++++++++++ tests/list-tests.html | 1 + 3 files changed, 56 insertions(+) create mode 100644 tests/Control/test_MousePosition.html 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