zoom level fixed

This commit is contained in:
Peter Cottle 2013-01-05 15:07:09 -08:00
parent 953bd49ee2
commit ebdf188c1d
3 changed files with 35 additions and 2 deletions

View file

@ -21,14 +21,25 @@ function detectZoom() {
return window.outerWidth / window.innerWidth;
}
var locked = true;
var setupZoomPoll = function(callback, context) {
var currentZoom = 0;
setInterval(function() {
var newZoom = detectZoom();
if (newZoom !== currentZoom) {
// we need to wait one more before issuing callback
// to avoid window resize issues
if (locked) {
locked = false;
return;
}
currentZoom = newZoom;
callback.apply(context, [newZoom]);
} else {
locked = true;
}
}, 500);
};