Skip to content

Commit

Permalink
Add preference to automatically enable the Hand Tool when the viewer…
Browse files Browse the repository at this point in the history
… loads
  • Loading branch information
Snuffleupagus committed Apr 3, 2014
1 parent 4c9c43f commit 42f9541
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/default_preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
var DEFAULT_PREFERENCES = {
showPreviousViewOnLoad: true,
defaultZoomValue: '',
ifAvailableShowOutlineOnLoad: false
ifAvailableShowOutlineOnLoad: false,
enableHandToolOnLoad: false
};
11 changes: 9 additions & 2 deletions web/hand_tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 42f9541

Please sign in to comment.