[OpenLayers-Commits] r4738 - in sandbox/pagameba/transition/lib/OpenLayers: . Tile
commits at openlayers.org
commits at openlayers.org
Mon Oct 1 15:01:57 EDT 2007
Author: pagameba
Date: 2007-10-01 15:01:57 -0400 (Mon, 01 Oct 2007)
New Revision: 4738
Modified:
sandbox/pagameba/transition/lib/OpenLayers/Tile.js
sandbox/pagameba/transition/lib/OpenLayers/Tile/Image.js
Log:
remove syncBackBufferTile in favour of putting the implementation into endTransition, clean up transition effect in 'normal' case by calculating the before and after resolution.
Modified: sandbox/pagameba/transition/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/pagameba/transition/lib/OpenLayers/Tile/Image.js 2007-10-01 18:58:26 UTC (rev 4737)
+++ sandbox/pagameba/transition/lib/OpenLayers/Tile/Image.js 2007-10-01 19:01:57 UTC (rev 4738)
@@ -185,7 +185,6 @@
var offset = this.layer.imageOffset;
var size = this.layer.getImageSize();
-
if (this.layer.alpha) {
this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
offset,
@@ -233,7 +232,7 @@
//bind a listener to the onload of the image div so that we
// can register when a tile has finished loading.
var onload = function() {
-
+
//normally isLoading should always be true here but there are some
// right funky conditions where loading and then reloading a tile
// with the same url *really*fast*. this check prevents sending
@@ -243,7 +242,7 @@
this.isLoading = false;
this.events.triggerEvent("loadend");
}
- }
+ };
OpenLayers.Event.observe(this.imgDiv, 'load',
OpenLayers.Function.bind(onload, this));
@@ -278,6 +277,10 @@
},
startTransition: function() {
+ var ratio = 1;
+ if (this.backBufferTile.resolution) {
+ ratio = this.layer.getResolution() / this.backBufferTile.resolution;
+ }
switch (this.layer.transitionEffect) {
case "resize":
break;
@@ -288,19 +291,15 @@
// until the new one loads if this is a singleTile and
// there was no change in resolution. Otherwise we
// don't bother to show the backBufferTile at all
- if (this.layer.singleTile /* && some resolution test */) {
- if (this.backBufferTile && this.backBufferTile.imgDiv) {
+ if (this.backBufferTile && this.backBufferTile.imgDiv) {
+ if (this.layer.singleTile && ratio == 1) {
OpenLayers.Element.show(this.backBufferTile.imgDiv);
+ } else {
+ OpenLayers.Element.hide(this.backBufferTile.imgDiv);
}
}
}
},
-
- endTransition: function() {
- if (this.backBufferTile && this.backBufferTile.imgDiv) {
- OpenLayers.Element.hide(this.backBufferTile.imgDiv);
- }
- },
/** @final @type String */
CLASS_NAME: "OpenLayers.Tile.Image"
Modified: sandbox/pagameba/transition/lib/OpenLayers/Tile.js
===================================================================
--- sandbox/pagameba/transition/lib/OpenLayers/Tile.js 2007-10-01 18:58:26 UTC (rev 4737)
+++ sandbox/pagameba/transition/lib/OpenLayers/Tile.js 2007-10-01 19:01:57 UTC (rev 4738)
@@ -174,7 +174,6 @@
// clear transition back buffer tile only after all tiles in this
// layer have loaded to avoid visual glitches
this.layer.events.register("loadend", this, this.endTransition);
- this.events.register("loadend", this, this.syncBackBufferTile);
}
//allow for custom buffering as we transition the tile to its
@@ -260,20 +259,26 @@
return bounds;
},
- syncBackBufferTile: function() {
- this.backBufferTile.position = this.position.clone();
- this.backBufferTile.bounds = this.bounds.clone();
- this.backBufferTile.size = this.size.clone();
- this.backBufferTile.renderTile();
- },
-
transition: function() {
this.startTransition();
},
startTransition: function() {},
- endTransition: function() {},
+ /**
+ * Method: endTransition
+ *
+ * at the end of a transition, reset the backBufferTile to correspond to the
+ * current position/bounds and hide it for the next transition
+ */
+ endTransition: function() {
+ this.backBufferTile.position = this.position.clone();
+ this.backBufferTile.bounds = this.bounds.clone();
+ this.backBufferTile.size = this.size.clone();
+ this.backBufferTile.resolution = this.layer.getResolution();
+ this.backBufferTile.renderTile();
+ this.backBufferTile.clear();
+ },
CLASS_NAME: "OpenLayers.Tile"
});
More information about the Commits
mailing list