[Pkg-javascript-commits] [pdf.js] 23/141: Add preference to automatically enable the Hand Tool when the viewer loads

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 42f9541081c3e9757d8540e9e9f2020c7c4561cf
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Mon Mar 17 02:11:41 2014 +0100

     Add preference to automatically enable the Hand Tool when the viewer loads
---
 web/default_preferences.js |  3 ++-
 web/hand_tool.js           | 11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/web/default_preferences.js b/web/default_preferences.js
index e6417e5..8ef7ad9 100644
--- a/web/default_preferences.js
+++ b/web/default_preferences.js
@@ -21,5 +21,6 @@
 var DEFAULT_PREFERENCES = {
   showPreviousViewOnLoad: true,
   defaultZoomValue: '',
-  ifAvailableShowOutlineOnLoad: false
+  ifAvailableShowOutlineOnLoad: false,
+  enableHandToolOnLoad: false
 };
diff --git a/web/hand_tool.js b/web/hand_tool.js
index 7b8f3eb..0405a68 100644
--- a/web/hand_tool.js
+++ b/web/hand_tool.js
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals mozL10n, GrabToPan, PDFView, SecondaryToolbar */
+/* globals mozL10n, GrabToPan, PDFView, Preferences, SecondaryToolbar */
 
 'use strict';
 
@@ -43,8 +43,15 @@ var HandTool = {
     });
     if (toggleHandTool) {
       toggleHandTool.addEventListener('click', this.toggle.bind(this), false);
+
+      window.addEventListener('localized', function (evt) {
+        Preferences.get('enableHandToolOnLoad').then(function (prefValue) {
+          if (prefValue) {
+            this.handTool.activate();
+          }
+        }.bind(this));
+      }.bind(this));
     }
-    // TODO: Read global prefs and call this.handTool.activate() if needed.
   },
 
   toggle: function handToolToggle() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list