Merge pull request #3 from tschaub/fade

increase timeout for backbuffer removal and dispense with extra map property
This commit is contained in:
Éric Lemoine
2012-01-02 21:10:33 -08:00
7 changed files with 25 additions and 48 deletions

View File

@@ -25,9 +25,8 @@
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script src="fullScreen.js"></script>
</head>
<body onload="init()">
<body>
<div id="map"></div>
<div id="text">
@@ -38,7 +37,7 @@
</div>
<p id="shortdesc">
Demonstrate a map that fill the entire browser window.
Demonstrate a map that fills the entire browser window.
</p>
<div id="docs">
@@ -48,6 +47,7 @@
<a href="fullScreen.js" target="_blank">fullScreen.js source</a>
to see how this is done.</p>
</div>
<script src="fullScreen.js"></script>
</div>
</body>
</html>

View File

@@ -1,15 +1,21 @@
var map;
function init(){
map = new OpenLayers.Map('map');
var urls = [
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
];
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'} );
var ol_wms_nobuffer = new OpenLayers.Layer.WMS( "OpenLayers WMS (no tile buffer)",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'}, {buffer: 0});
var map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.XYZ("OSM (with buffer)", urls, {
transitionEffect: "resize", buffer: 2, sphericalMercator: true
}),
new OpenLayers.Layer.XYZ("OSM (without buffer)", urls, {
transitionEffect: "resize", buffer: 0, sphericalMercator: true
})
],
center: [0, 0],
zoom: 3
});
map.addLayers([ol_wms, ol_wms_nobuffer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 6);
}
map.addControl(new OpenLayers.Control.LayerSwitcher());

View File

@@ -549,7 +549,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
window.clearTimeout(this.backBufferTimerId);
}
this.backBufferTimerId = window.setTimeout(
OpenLayers.Function.bind(this.removeBackBuffer, this), 800);
OpenLayers.Function.bind(this.removeBackBuffer, this), 2500);
},
/**

View File

@@ -395,14 +395,6 @@ OpenLayers.Map = OpenLayers.Class({
* the popup from getting too close to the map border.
*/
paddingForPopups : null,
/**
* APIProperty: tileAnimation
* {Boolean} If set to true the olMapTileAnim class is assigned to the
* map div. This, with OpenLayers' default CSS, results in fade-in
* effects when image tiles are displayed.
*/
tileAnimation: true,
/**
* Property: minPx
@@ -508,9 +500,6 @@ OpenLayers.Map = OpenLayers.Class({
}
OpenLayers.Element.addClass(this.div, 'olMap');
if (this.tileAnimation) {
OpenLayers.Element.addClass(this.div, 'olMapTileAnim');
}
// the viewPortDiv is the outermost div we modify
var id = this.id + "_OpenLayers_ViewPort";

View File

@@ -128,7 +128,7 @@
function test_loadEvents(t) {
t.plan(3);
var map = new OpenLayers.Map('map', {tileAnimation: false});
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Image(
'Test', '../../img/blank.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),

View File

@@ -115,24 +115,6 @@
map.destroy();
}
function test_Map_constructor_tileanim(t) {
t.plan(4);
map = new OpenLayers.Map("map");
t.eq(map.tileAnimation, true,
'tileAnimation is true by default');
t.ok(OpenLayers.Element.hasClass(map.div, 'olMapTileAnim'),
'map div is assigned the olMapTileAnim class by default');
map.destroy();
map = new OpenLayers.Map("map", {tileAnimation: false});
t.eq(map.tileAnimation, false,
'tileAnimation is false if option is false');
t.ok(OpenLayers.Element.hasClass(map.div, 'olMapTileAnim'),
'map div not assigned the olMapTileAnim class if tileAnimation is false');
map.destroy();
}
function test_Map_setOptions(t) {
t.plan(2);
map = new OpenLayers.Map('map', {maxExtent: new OpenLayers.Bounds(100, 200, 300, 400)});

View File

@@ -433,7 +433,7 @@ span.olGoogleAttribution.hybrid a, span.olGoogleAttribution.satellite a {
* Animations
*/
.olMapTileAnim .olTileImage {
.olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;