Implement hand tool

The logic for the hand tool is implemented in a separate project,
maintained at https://github.com/Rob--W/grab-to-pan.js

Integration notes
- Added toggle as an entry under the Secondary toolbar
- Added shortcut "h" to toggle hand tool (to-do: document this in wiki
  after merge). This shortcut is also used in Adobe's Acrobat Reader.

To-do: localizations for:
hand_tool_enable.title=
hand_tool_enable_label=
hand_tool_disable.title=
hand_tool_disable_label=

To-do (wish): persistence of hand tool preference, preferably a global setting.

secondaryToolbarButton-handTool.png created by Stephen Horlander <shorlander@mozilla.com>
This commit is contained in:
Rob Wu 2013-10-02 22:09:43 +02:00
parent f0c830dba2
commit 3914768085
10 changed files with 330 additions and 2 deletions

View file

@ -18,7 +18,7 @@
PDFFindController, ProgressBar, TextLayerBuilder, DownloadManager,
getFileName, scrollIntoView, getPDFFileNameFromURL, PDFHistory,
Preferences, Settings, PageView, ThumbnailView, noContextMenuHandler,
SecondaryToolbar, PasswordPrompt, PresentationMode */
SecondaryToolbar, PasswordPrompt, PresentationMode, HandTool */
'use strict';
@ -87,6 +87,7 @@ var currentPageNumber = 1;
//#include secondary_toolbar.js
//#include password_prompt.js
//#include presentation_mode.js
//#include hand_tool.js
var PDFView = {
pages: [],
@ -140,6 +141,11 @@ var PDFView = {
integratedFind: this.supportsIntegratedFind
});
HandTool.initialize({
container: container,
toggleHandTool: document.getElementById('toggleHandTool')
});
SecondaryToolbar.initialize({
toolbar: document.getElementById('secondaryToolbar'),
presentationMode: PresentationMode,
@ -2138,6 +2144,11 @@ window.addEventListener('keydown', function keydown(evt) {
}
break;
case 72: // 'h'
if (!PresentationMode.active) {
HandTool.toggle();
}
break;
case 82: // 'r'
PDFView.rotatePages(90);
break;