mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 09:20:03 +02:00
zoom level fixed
This commit is contained in:
parent
953bd49ee2
commit
ebdf188c1d
3 changed files with 35 additions and 2 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue