Store a reference to the bound mouse cache clearer so we can unregister it as a listener later. This solves an issue with slider events on the PanZoomBar. r=crschmidt (pullup #2054)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9401 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -435,6 +435,14 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
*/
|
*/
|
||||||
includeXY: false,
|
includeXY: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: clearMouseListener
|
||||||
|
* A version of <clearMouseCache> that is bound to this instance so that
|
||||||
|
* it can be used with <OpenLayers.Event.observe> and
|
||||||
|
* <OpenLayers.Event.stopObserving>.
|
||||||
|
*/
|
||||||
|
clearMouseListener: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Events
|
* Constructor: OpenLayers.Events
|
||||||
* Construct an OpenLayers.Events object.
|
* Construct an OpenLayers.Events object.
|
||||||
@@ -459,6 +467,11 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
this.handleBrowserEvent, this
|
this.handleBrowserEvent, this
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// to be used with observe and stopObserving
|
||||||
|
this.clearMouseListener = OpenLayers.Function.bind(
|
||||||
|
this.clearMouseCache, this
|
||||||
|
);
|
||||||
|
|
||||||
// if eventTypes is specified, create a listeners list for each
|
// if eventTypes is specified, create a listeners list for each
|
||||||
// custom application event.
|
// custom application event.
|
||||||
this.eventTypes = [];
|
this.eventTypes = [];
|
||||||
@@ -481,6 +494,11 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
destroy: function () {
|
destroy: function () {
|
||||||
if (this.element) {
|
if (this.element) {
|
||||||
OpenLayers.Event.stopObservingElement(this.element);
|
OpenLayers.Event.stopObservingElement(this.element);
|
||||||
|
if(this.element.hasScrollEvent) {
|
||||||
|
OpenLayers.Event.stopObserving(
|
||||||
|
window, "scroll", this.clearMouseListener
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.element = null;
|
this.element = null;
|
||||||
|
|
||||||
@@ -773,8 +791,7 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
if (!this.includeXY) {
|
if (!this.includeXY) {
|
||||||
this.clearMouseCache();
|
this.clearMouseCache();
|
||||||
} else if (!this.element.hasScrollEvent) {
|
} else if (!this.element.hasScrollEvent) {
|
||||||
OpenLayers.Event.observe(window, 'scroll',
|
OpenLayers.Event.observe(window, "scroll", this.clearMouseListener);
|
||||||
OpenLayers.Function.bind(this.clearMouseCache, this));
|
|
||||||
this.element.hasScrollEvent = true;
|
this.element.hasScrollEvent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user