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({ this.handTool = new GrabToPan({
element: options.container, element: options.container,
onActiveChanged: function(isActive) { onActiveChanged: function(isActive) {
if (!toggleHandTool) {
return;
}
if (isActive) { if (isActive) {
toggleHandTool.title = toggleHandTool.title =
mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool'); mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
@ -38,7 +41,9 @@ var HandTool = {
} }
} }
}); });
if (toggleHandTool) {
toggleHandTool.addEventListener('click', this.handTool.toggle, false); toggleHandTool.addEventListener('click', this.handTool.toggle, false);
}
// TODO: Read global prefs and call this.handTool.activate() if needed. // TODO: Read global prefs and call this.handTool.activate() if needed.
}, },

View File

@ -41,7 +41,10 @@ var SecondaryToolbar = {
// Attach the event listeners. // Attach the event listeners.
var elements = [ var elements = [
// Button to toggle the visibility of the secondary toolbar:
{ element: this.toggleButton, handler: this.toggle }, { 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, { element: this.presentationModeButton,
handler: this.presentationModeClick }, handler: this.presentationModeClick },
{ element: this.openFile, handler: this.openFileClick }, { element: this.openFile, handler: this.openFileClick },