improve actual and perceived performance

This commit is contained in:
Stefan Breunig
2013-02-02 00:35:15 +01:00
parent 1369422ce3
commit 0a2890f196
3 changed files with 33 additions and 10 deletions

View File

@ -98,3 +98,17 @@ window.reportPortalIssue = function(info) {
if(prompt(t, info) !== null)
location.href = 'https://support.google.com/ingress?hl=en';
}
window._storedPaddedBounds = undefined;
window.getPaddedBounds = function() {
if(_storedPaddedBounds === undefined) {
map.on('zoomstart zoomend movestart moveend', function() {
window._storedPaddedBounds = null;
});
}
if(window._storedPaddedBounds) return window._storedPaddedBounds;
var p = window.map.getBounds().pad(VIEWPORT_PAD_RATIO);
window._storedPaddedBounds = p;
return p;
}