mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Test if toggleHandTool is null before using it
Do not break the viewer if the buttons are not available for some reason.
This commit is contained in:
parent
4d01ff4079
commit
f2d13a2e2c
1 changed files with 7 additions and 2 deletions
|
@ -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.
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue