Merge pull request #4088 from Rob--W/handtool-button-is-null

Allow hand tool toggle button to be optional
This commit is contained in:
Tim van der Meij 2014-01-08 14:41:20 -08:00
commit ae117c296a
2 changed files with 10 additions and 2 deletions

View File

@ -25,6 +25,9 @@ var HandTool = {
this.handTool = new GrabToPan({
element: options.container,
onActiveChanged: function(isActive) {
if (!toggleHandTool) {
return;
}
if (isActive) {
toggleHandTool.title =
mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
@ -36,9 +39,11 @@ var HandTool = {
toggleHandTool.firstElementChild.textContent =
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
}
}
}
});
toggleHandTool.addEventListener('click', this.handTool.toggle, false);
if (toggleHandTool) {
toggleHandTool.addEventListener('click', this.handTool.toggle, false);
}
// TODO: Read global prefs and call this.handTool.activate() if needed.
},

View File

@ -41,7 +41,10 @@ var SecondaryToolbar = {
// Attach the event listeners.
var elements = [
// Button to toggle the visibility of the secondary toolbar:
{ element: this.toggleButton, handler: this.toggle },
// All items within the secondary toolbar
// (except for toggleHandTool, hand_tool.js is responsible for it):
{ element: this.presentationModeButton,
handler: this.presentationModeClick },
{ element: this.openFile, handler: this.openFileClick },