Merge pull request #4140 from timvandermeij/close-secondary-toolbar
Close the secondary toolbar when an action is performed once
This commit is contained in:
		
						commit
						e13500e46b
					
				| @ -14,7 +14,7 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals mozL10n, GrabToPan, PDFView */ | /* globals mozL10n, GrabToPan, PDFView, SecondaryToolbar */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -42,13 +42,14 @@ var HandTool = { | |||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|     if (toggleHandTool) { |     if (toggleHandTool) { | ||||||
|       toggleHandTool.addEventListener('click', this.handTool.toggle, false); |       toggleHandTool.addEventListener('click', this.toggle.bind(this), false); | ||||||
|     } |     } | ||||||
|     // TODO: Read global prefs and call this.handTool.activate() if needed.
 |     // TODO: Read global prefs and call this.handTool.activate() if needed.
 | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   toggle: function handToolToggle() { |   toggle: function handToolToggle() { | ||||||
|     this.handTool.toggle(); |     this.handTool.toggle(); | ||||||
|  |     SecondaryToolbar.close(); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   enterPresentationMode: function handToolEnterPresentationMode() { |   enterPresentationMode: function handToolEnterPresentationMode() { | ||||||
|  | |||||||
| @ -34,6 +34,7 @@ var SecondaryToolbar = { | |||||||
|     this.openFile = options.openFile; |     this.openFile = options.openFile; | ||||||
|     this.print = options.print; |     this.print = options.print; | ||||||
|     this.download = options.download; |     this.download = options.download; | ||||||
|  |     this.viewBookmark = options.viewBookmark; | ||||||
|     this.firstPage = options.firstPage; |     this.firstPage = options.firstPage; | ||||||
|     this.lastPage = options.lastPage; |     this.lastPage = options.lastPage; | ||||||
|     this.pageRotateCw = options.pageRotateCw; |     this.pageRotateCw = options.pageRotateCw; | ||||||
| @ -50,6 +51,7 @@ var SecondaryToolbar = { | |||||||
|       { element: this.openFile, handler: this.openFileClick }, |       { element: this.openFile, handler: this.openFileClick }, | ||||||
|       { element: this.print, handler: this.printClick }, |       { element: this.print, handler: this.printClick }, | ||||||
|       { element: this.download, handler: this.downloadClick }, |       { element: this.download, handler: this.downloadClick }, | ||||||
|  |       { element: this.viewBookmark, handler: this.viewBookmarkClick }, | ||||||
|       { element: this.firstPage, handler: this.firstPageClick }, |       { element: this.firstPage, handler: this.firstPageClick }, | ||||||
|       { element: this.lastPage, handler: this.lastPageClick }, |       { element: this.lastPage, handler: this.lastPageClick }, | ||||||
|       { element: this.pageRotateCw, handler: this.pageRotateCwClick }, |       { element: this.pageRotateCw, handler: this.pageRotateCwClick }, | ||||||
| @ -85,12 +87,18 @@ var SecondaryToolbar = { | |||||||
|     this.close(evt.target); |     this.close(evt.target); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |   viewBookmarkClick: function secondaryToolbarViewBookmarkClick(evt) { | ||||||
|  |     this.close(); | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|   firstPageClick: function secondaryToolbarFirstPageClick(evt) { |   firstPageClick: function secondaryToolbarFirstPageClick(evt) { | ||||||
|     PDFView.page = 1; |     PDFView.page = 1; | ||||||
|  |     this.close(); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   lastPageClick: function secondaryToolbarLastPageClick(evt) { |   lastPageClick: function secondaryToolbarLastPageClick(evt) { | ||||||
|     PDFView.page = PDFView.pdfDocument.numPages; |     PDFView.page = PDFView.pdfDocument.numPages; | ||||||
|  |     this.close(); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) { |   pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) { | ||||||
|  | |||||||
| @ -158,6 +158,7 @@ var PDFView = { | |||||||
|       openFile: document.getElementById('secondaryOpenFile'), |       openFile: document.getElementById('secondaryOpenFile'), | ||||||
|       print: document.getElementById('secondaryPrint'), |       print: document.getElementById('secondaryPrint'), | ||||||
|       download: document.getElementById('secondaryDownload'), |       download: document.getElementById('secondaryDownload'), | ||||||
|  |       viewBookmark: document.getElementById('secondaryViewBookmark'), | ||||||
|       firstPage: document.getElementById('firstPage'), |       firstPage: document.getElementById('firstPage'), | ||||||
|       lastPage: document.getElementById('lastPage'), |       lastPage: document.getElementById('lastPage'), | ||||||
|       pageRotateCw: document.getElementById('pageRotateCw'), |       pageRotateCw: document.getElementById('pageRotateCw'), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user