[OpenLayers-Commits] r10901 - in
sandbox/bjornharrtell/posttransition: examples lib/OpenLayers/Tile
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Nov 16 19:39:20 EST 2010
Author: bjornharrtell
Date: 2010-11-16 16:39:20 -0800 (Tue, 16 Nov 2010)
New Revision: 10901
Modified:
sandbox/bjornharrtell/posttransition/examples/posttransition.html
sandbox/bjornharrtell/posttransition/lib/OpenLayers/Tile/Image.js
Log:
Fix excess post transitions by triggering on loadend instead of on show
No tile buffer in example
Modified: sandbox/bjornharrtell/posttransition/examples/posttransition.html
===================================================================
--- sandbox/bjornharrtell/posttransition/examples/posttransition.html 2010-11-16 18:49:27 UTC (rev 10900)
+++ sandbox/bjornharrtell/posttransition/examples/posttransition.html 2010-11-17 00:39:20 UTC (rev 10901)
@@ -29,7 +29,7 @@
"WMS tiled resize",
"http://vmap0.tiles.osgeo.org/wms/vmap0?",
{layers: 'basic'},
- {transitionEffect: 'resize'}
+ {transitionEffect: 'resize', buffer: 0}
);
map.addLayers([tiled_resize_effect]);
Modified: sandbox/bjornharrtell/posttransition/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/bjornharrtell/posttransition/lib/OpenLayers/Tile/Image.js 2010-11-16 18:49:27 UTC (rev 10900)
+++ sandbox/bjornharrtell/posttransition/lib/OpenLayers/Tile/Image.js 2010-11-17 00:39:20 UTC (rev 10901)
@@ -208,6 +208,7 @@
// potentially end any transition effects when the tile loads
this.events.register('loadend', this, this.resetBackBuffer);
+ this.events.register('loadend', this, this.fadeInTile);
// clear transition back buffer tile only after all tiles in
// this layer have loaded to avoid visual glitches
@@ -225,6 +226,7 @@
} else {
if (drawTile && this.isFirstDraw) {
this.events.register('loadend', this, this.showTile);
+ this.events.register('loadend', this, this.fadeInTile);
this.isFirstDraw = false;
}
}
@@ -579,6 +581,22 @@
},
+ fadeInTile: function() {
+ if (!this.isBackBuffer) {
+ this.opacity = 0.0;
+ this.frame.style.opacity = this.opacity;
+ var that = this;
+ var callback = function() {
+ that.opacity += 0.05;
+ that.frame.style.opacity = that.opacity;
+ if (that.opacity<1) {
+ setTimeout(callback, 10);
+ }
+ };
+ setTimeout(callback, 10);
+ }
+ },
+
/**
* Method: show
* Show the tile by showing its frame.
@@ -593,20 +611,6 @@
this.frame.scrollLeft = this.frame.scrollLeft;
}
}
-
- if (!this.isBackBuffer) {
- this.opacity = 0.0;
- this.frame.style.opacity = this.opacity;
- var that = this;
- var callback = function() {
- that.opacity += 0.05;
- that.frame.style.opacity = that.opacity;
- if (that.opacity<1) {
- setTimeout(callback, 10);
- }
- };
- setTimeout(callback, 10);
- }
},
/**
More information about the Commits
mailing list