Chromium Code Reviews| Index: chrome/browser/resources/pdf/viewport.js |
| diff --git a/chrome/browser/resources/pdf/viewport.js b/chrome/browser/resources/pdf/viewport.js |
| index b42206c77a74dc84fe9092b2931eaf062933e7b3..e642d2203c66e8f183e18c4b1a234efaea0a5f79 100644 |
| --- a/chrome/browser/resources/pdf/viewport.js |
| +++ b/chrome/browser/resources/pdf/viewport.js |
| @@ -77,6 +77,11 @@ Viewport.ZOOM_FACTORS = [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1, |
| 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; |
| /** |
| + * The minimum and maximum range to be used to clip zoom factor. |
| + */ |
| +Viewport.ZOOM_FACTOR_RANGE = {min: 0.1, max: 10.0}; |
|
raymes
2014/08/22 01:02:23
could we set min to Viewport.ZOOM_FACTORS[0] and m
Nikhil
2014/08/22 03:07:42
Hmm, I've set min to 0.1 and max to 10.0 based on
Nikhil
2014/08/22 04:59:04
Done.
|
| + |
| +/** |
| * The width of the page shadow around pages in pixels. |
| */ |
| Viewport.PAGE_SHADOW = {top: 3, bottom: 7, left: 5, right: 5}; |
| @@ -231,6 +236,8 @@ Viewport.prototype = { |
| * @param {number} newZoom the zoom level to zoom to. |
| */ |
| setZoom: function(newZoom) { |
| + newZoom = Math.max(Viewport.ZOOM_FACTOR_RANGE.min, |
| + Math.min(newZoom, Viewport.ZOOM_FACTOR_RANGE.max)); |
| this.mightZoom_(function() { |
| this.setZoomInternal_(newZoom); |
| this.updateViewport_(); |