Remove unneeded scroll when we first load a page.
This commit is contained in:
		
							parent
							
								
									ffc27bca1e
								
							
						
					
					
						commit
						ed7a10a8d5
					
				| @ -275,7 +275,7 @@ var PDFView = { | |||||||
|     }, true); |     }, true); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   setScale: function pdfViewSetScale(val, resetAutoSettings) { |   setScale: function pdfViewSetScale(val, resetAutoSettings, noScroll) { | ||||||
|     if (val == this.currentScale) |     if (val == this.currentScale) | ||||||
|       return; |       return; | ||||||
| 
 | 
 | ||||||
| @ -283,7 +283,7 @@ var PDFView = { | |||||||
|     for (var i = 0; i < pages.length; i++) |     for (var i = 0; i < pages.length; i++) | ||||||
|       pages[i].update(val * kCssUnits); |       pages[i].update(val * kCssUnits); | ||||||
| 
 | 
 | ||||||
|     if (this.currentScale != val) |     if (!noScroll && this.currentScale != val) | ||||||
|       this.pages[this.page - 1].scrollIntoView(); |       this.pages[this.page - 1].scrollIntoView(); | ||||||
|     this.currentScale = val; |     this.currentScale = val; | ||||||
| 
 | 
 | ||||||
| @ -294,14 +294,14 @@ var PDFView = { | |||||||
|     window.dispatchEvent(event); |     window.dispatchEvent(event); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   parseScale: function pdfViewParseScale(value, resetAutoSettings) { |   parseScale: function pdfViewParseScale(value, resetAutoSettings, noScroll) { | ||||||
|     if ('custom' == value) |     if ('custom' == value) | ||||||
|       return; |       return; | ||||||
| 
 | 
 | ||||||
|     var scale = parseFloat(value); |     var scale = parseFloat(value); | ||||||
|     this.currentScaleValue = value; |     this.currentScaleValue = value; | ||||||
|     if (scale) { |     if (scale) { | ||||||
|       this.setScale(scale, true); |       this.setScale(scale, true, noScroll); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -313,22 +313,22 @@ var PDFView = { | |||||||
|                            currentPage.height * currentPage.scale / kCssUnits; |                            currentPage.height * currentPage.scale / kCssUnits; | ||||||
|     switch (value) { |     switch (value) { | ||||||
|       case 'page-actual': |       case 'page-actual': | ||||||
|         this.setScale(1, resetAutoSettings); |         scale = 1; | ||||||
|         break; |         break; | ||||||
|       case 'page-width': |       case 'page-width': | ||||||
|         this.setScale(pageWidthScale, resetAutoSettings); |         scale = pageWidthScale; | ||||||
|         break; |         break; | ||||||
|       case 'page-height': |       case 'page-height': | ||||||
|         this.setScale(pageHeightScale, resetAutoSettings); |         scale = pageHeightScale; | ||||||
|         break; |         break; | ||||||
|       case 'page-fit': |       case 'page-fit': | ||||||
|         this.setScale( |         scale = Math.min(pageWidthScale, pageHeightScale); | ||||||
|             Math.min(pageWidthScale, pageHeightScale), resetAutoSettings); |  | ||||||
|         break; |         break; | ||||||
|       case 'auto': |       case 'auto': | ||||||
|         this.setScale(Math.min(1.0, pageWidthScale), resetAutoSettings); |         scale = Math.min(1.0, pageWidthScale); | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|  |     this.setScale(scale, resetAutoSettings, noScroll); | ||||||
| 
 | 
 | ||||||
|     selectScaleOption(value); |     selectScaleOption(value); | ||||||
|   }, |   }, | ||||||
| @ -1245,9 +1245,9 @@ var PageView = function pageView(container, pdfPage, id, scale, | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (scale && scale !== PDFView.currentScale) |       if (scale && scale !== PDFView.currentScale) | ||||||
|         PDFView.parseScale(scale, true); |         PDFView.parseScale(scale, true, true); | ||||||
|       else if (PDFView.currentScale === kUnknownScale) |       else if (PDFView.currentScale === kUnknownScale) | ||||||
|         PDFView.parseScale(kDefaultScale, true); |         PDFView.parseScale(kDefaultScale, true, true); | ||||||
| 
 | 
 | ||||||
|       var boundingRect = [ |       var boundingRect = [ | ||||||
|         this.viewport.convertToViewportPoint(x, y), |         this.viewport.convertToViewportPoint(x, y), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user