Ticket #2941 (closed bug: fixed)
OpenLayers.Control.Navigation with documentDrag enabled removes all document events.
|Reported by:||mgleahy||Owned by:|
Currently, the OpenLayers.Handler.Drag class used by the Navigation control uses the OpenLayers.Events.destroy() method when the documentDrag option is enabled after a user drags the map outside of the map element's boundaries.
This destroy() method has the result of removing all events for the element in question (in this case, the document element). As a result, other controls that rely on document events (e.g., the KeyboardDefaults control) will stop working once this has happened at least once.
The patch that I'll attach to this ticket switches tactics in the Drag class, such that it uses the OpenLayers.Events.un() method to unregister the only the events used by the Navigation control, and instead of creating the documentEvents object each time the user leaves the map, it keeps it and just calls the on() un() methods as users move the mouse out of the map when dragging.