Using an array for the transitionend event names

This commit is contained in:
ahocevar
2012-12-21 13:07:36 +01:00
parent 43c646b6da
commit fcd8586883

View File

@@ -285,6 +285,15 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
rowSign: null,
/**
* Property: transitionendEvents
* {Array} Event names for transitionend
*/
transitionendEvents: [
'transitionend', 'webkitTransitionEnd', 'otransitionend',
'oTransitionEnd'
],
/**
* Constructor: OpenLayers.Layer.Grid
* Create a new grid layer
@@ -759,10 +768,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
removeBackBuffer: function() {
if (this._transitionElement) {
OpenLayers.Event.stopObserving(this._transitionElement, 'transitionend', this._removeBackBuffer);
OpenLayers.Event.stopObserving(this._transitionElement, 'webkitTransitionEnd', this._removeBackBuffer);
OpenLayers.Event.stopObserving(this._transitionElement, 'otransitionend', this._removeBackBuffer);
OpenLayers.Event.stopObserving(this._transitionElement, 'oTransitionEnd', this._removeBackBuffer);
for (var i=this.transitionendEvents.length-1; i>=0; --i) {
OpenLayers.Event.stopObserving(this._transitionElement,
this.transitionendEvents[i], this._removeBackBuffer);
}
delete this._transitionElement;
}
if(this.backBuffer) {
@@ -1129,10 +1138,11 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.events.triggerEvent("loadend");
if(this.backBuffer) {
this._transitionElement = tile.imgDiv;
OpenLayers.Event.observe(this._transitionElement, 'transitionend', this._removeBackBuffer);
OpenLayers.Event.observe(this._transitionElement, 'webkitTransitionEnd', this._removeBackBuffer);
OpenLayers.Event.observe(this._transitionElement, 'otransitionend', this._removeBackBuffer);
OpenLayers.Event.observe(this._transitionElement, 'oTransitionEnd', this._removeBackBuffer);
for (var i=this.transitionendEvents.length-1; i>=0; --i) {
OpenLayers.Event.observe(this._transitionElement,
this.transitionendEvents[i],
this._removeBackBuffer);
}
// the removal of the back buffer is delayed to prevent // flash effects due to the animation of tile displaying
this.backBufferTimerId = window.setTimeout(
this._removeBackBuffer, this.removeBackBufferDelay