force a reflow after pinch

This commit is contained in:
Éric Lemoine
2012-03-23 21:58:25 +01:00
parent 863011b2b7
commit d680cb45a0

View File

@@ -184,6 +184,20 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
location.lon += resolution * ((size.w / 2) - zoomPixel.x);
location.lat -= resolution * ((size.h / 2) - zoomPixel.y);
// Force a reflow before calling setCenter. This is to work
// around an issue occuring in iOS.
//
// See https://github.com/openlayers/openlayers/pull/351.
//
// Without a reflow setting the layer container div's top left
// style properties to "0px" - as done in Map.moveTo when zoom
// is changed - won't actually correctly reposition the layer
// container div.
//
// Also, we need to use a statement that the Google Closure
// compiler won't optimize away.
this.map.div.clientWidth = this.map.div.clientWidth;
this.map.setCenter(location, zoom);
}
},