resize handler: run only one loop and trigger the handler when zoom level changes
This commit is contained in:
parent
9ef7a63520
commit
7cb7c806c3
2 changed files with 6 additions and 3 deletions
|
|
@ -44,6 +44,7 @@ var scrolls = function(){
|
|||
document.documentElement.style.setProperty("--pixel-scale",'')
|
||||
document.documentElement.style.setProperty("--pixel-scale",PXSCALE)
|
||||
|
||||
$(window).resize()
|
||||
}
|
||||
})
|
||||
$(document).on('keydown.resetzoom', function(e){
|
||||
|
|
@ -51,6 +52,8 @@ var scrolls = function(){
|
|||
PXSCALE = INITIALZOOM
|
||||
document.documentElement.style.setProperty("--pixel-scale",'')
|
||||
document.documentElement.style.setProperty("--pixel-scale",PXSCALE)
|
||||
|
||||
$(window).resize()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -80,16 +80,16 @@
|
|||
|
||||
}
|
||||
|
||||
// Loop.
|
||||
resizePollingLoop()
|
||||
}
|
||||
|
||||
function resizePollingLoop() {
|
||||
// yep, setTimeout, 'cuz requestAnimation doesn't seem to perform that well
|
||||
resizeTimeout = window.setTimeout(checkResizes, pollInterval)
|
||||
checkResizes()
|
||||
resizeTimeout = window.setTimeout(resizePollingLoop, pollInterval)
|
||||
|
||||
}
|
||||
|
||||
$(window).resize(checkResizes)
|
||||
resizePollingLoop()
|
||||
|
||||
})(jQuery)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue