Confirmed with Tim Coulter that forcing the reflow here leads to a cleaner
refresh on FF2-based browsers. FF3 seems unaffected either way, as does Safari. (Closes #1390) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7578 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -290,10 +290,6 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
|||||||
|
|
||||||
if (!dragging) {
|
if (!dragging) {
|
||||||
this.renderer.root.style.visibility = "hidden";
|
this.renderer.root.style.visibility = "hidden";
|
||||||
// force a reflow on gecko based browsers to actually hide the svg
|
|
||||||
if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
|
|
||||||
this.div.scrollLeft = this.div.scrollLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
|
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
|
||||||
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
|
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
|
||||||
@@ -301,6 +297,13 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
|||||||
this.renderer.setExtent(extent);
|
this.renderer.setExtent(extent);
|
||||||
|
|
||||||
this.renderer.root.style.visibility = "visible";
|
this.renderer.root.style.visibility = "visible";
|
||||||
|
|
||||||
|
// Force a reflow on gecko based browsers to prevent jump/flicker.
|
||||||
|
// This seems to happen on only certain configurations; it was originally
|
||||||
|
// noticed in FF 2.0 and Linux.
|
||||||
|
if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
|
||||||
|
this.div.scrollLeft = this.div.scrollLeft;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.drawn || zoomChanged) {
|
if (!this.drawn || zoomChanged) {
|
||||||
|
|||||||
59
tests/manual/reflow.html
Normal file
59
tests/manual/reflow.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 800px;
|
||||||
|
height: 475px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="../../lib/OpenLayers.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var map;
|
||||||
|
var vectors;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map('map');
|
||||||
|
var wms = new OpenLayers.Layer.WMS(
|
||||||
|
"OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0",
|
||||||
|
{layers: 'basic'}
|
||||||
|
);
|
||||||
|
|
||||||
|
vectors = new OpenLayers.Layer.Vector(
|
||||||
|
"Simple Geometry",
|
||||||
|
{
|
||||||
|
styleMap: new OpenLayers.StyleMap({
|
||||||
|
externalGraphic: "../../img/marker-gold.png",
|
||||||
|
pointRadius: 10
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
map.addLayers([wms, vectors]);
|
||||||
|
|
||||||
|
var features = [];
|
||||||
|
var x = -111.04;
|
||||||
|
var y = 45.68;
|
||||||
|
for(var i = 0; i < 10; i++){
|
||||||
|
x += i * .5;
|
||||||
|
y += i * .1;
|
||||||
|
features.push(
|
||||||
|
new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point(x, y)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.setCenter(new OpenLayers.LonLat(x, y), 5);
|
||||||
|
vectors.addFeatures(features);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<div id="map"></div>
|
||||||
|
<p>Use the pan buttons. See flicker at end of animated pan.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user