From ccc43f2a1a5294bcf703cf8774bacca7b320e070 Mon Sep 17 00:00:00 2001 From: Alberto Acevedo Date: Thu, 13 Oct 2022 10:04:12 -0400 Subject: [PATCH] Update L.Control.MousePosition.js The onRemove is failing to remove the _onMouseMove event because the context is missing. In Leaflet 1.8.0 it logs the following warning: listener not found. The fix is to include the context (this) in the onRemove function. --- src/L.Control.MousePosition.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/L.Control.MousePosition.js b/src/L.Control.MousePosition.js index ce92b38..87cade4 100644 --- a/src/L.Control.MousePosition.js +++ b/src/L.Control.MousePosition.js @@ -24,7 +24,7 @@ L.Control.MousePosition = L.Control.extend({ }, onRemove: function (map) { - map.off('mousemove', this._onMouseMove) + map.off('mousemove', this._onMouseMove, this) }, getLatLng: function() {