Fix initing of zoomLevel to NaN during slow page load.

This commit is contained in:
Roy Frostig 2009-07-29 15:44:41 -07:00
parent 544af1f196
commit 5f8fc47b99
2 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,8 @@ BrowserView.Util = {
clampZoomLevel: function clampZoomLevel(zl) {
let bounded = Math.min(Math.max(kBrowserViewZoomLevelMin, zl), kBrowserViewZoomLevelMax);
return Math.round(bounded * kBrowserViewZoomLevelPrecision) / kBrowserViewZoomLevelPrecision;
let rounded = Math.round(bounded * kBrowserViewZoomLevelPrecision) / kBrowserViewZoomLevelPrecision;
return (rounded) ? rounded : 1.0;
},
pageZoomLevel: function pageZoomLevel(visibleRect, browserW, browserH) {

View File

@ -167,6 +167,7 @@ function onKeyPress(e) {
const m = 109; // fix mouseout
const r = 114; // reset visible rect
const t = 116; // debug given list of tiles separated by space
const z = 122; // set zoom level to 1
switch (e.charCode) {
case r:
@ -221,6 +222,9 @@ function onKeyPress(e) {
case m:
bv.resumeRendering();
break;
case z:
bv.setZoomLevel(1.0);
break;
default:
break;
}