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