Skip to content

Commit febf048

Browse files
committed
Merge pull request openlayers#351 from elemoine/pinch2
After great sleuthing from @elemoine, we have a solution closer to the heart of the problem. In a funny twist, the excessive call to `updateSize` ended up hinting at the solution. Thanks to `git bisect` for making things a bit easier.
2 parents 863011b + d680cb4 commit febf048

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/OpenLayers/Control/PinchZoom.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,20 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
184184
location.lon += resolution * ((size.w / 2) - zoomPixel.x);
185185
location.lat -= resolution * ((size.h / 2) - zoomPixel.y);
186186

187+
// Force a reflow before calling setCenter. This is to work
188+
// around an issue occuring in iOS.
189+
//
190+
// See https://github.com/openlayers/openlayers/pull/351.
191+
//
192+
// Without a reflow setting the layer container div's top left
193+
// style properties to "0px" - as done in Map.moveTo when zoom
194+
// is changed - won't actually correctly reposition the layer
195+
// container div.
196+
//
197+
// Also, we need to use a statement that the Google Closure
198+
// compiler won't optimize away.
199+
this.map.div.clientWidth = this.map.div.clientWidth;
200+
187201
this.map.setCenter(location, zoom);
188202
}
189203
},

0 commit comments

Comments
 (0)