Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the hand tool to a class #7207

Merged
merged 1 commit into from
Apr 16, 2016

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Apr 16, 2016

Furthermore we add more comments to the file.


if (this.toggleHandTool) {
this.toggleHandTool.addEventListener('click', this.toggle.bind(this),
false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters, false is the default here, so can't we just remove that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the new commit.

function HandTool(options) {
this.container = options.container;
this.toggleHandTool = options.toggleHandTool;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we usually add all the various members, with suitable defaults, when initializing classes, you may want to add this.wasActive here as well. Please refer to the {enter,exit}PresentationMode code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the new commit. It was also a bit weird that the value of the member variable was either true or null, so I changed that to true and false.

@Snuffleupagus
Copy link
Collaborator

You need to update https://github.com/mozilla/pdf.js/blob/master/web/app.js#L2151 as well, otherwise pressing H throws an error.

r=me, with the above comments and questions answered/fixed.

Thank you for doing this!


(Also, I'd really like to get rid of e.g. the Preferences/SecondaryToolbar dependencies here, but that would require a lot more changes elsewhere as well, so we can probably hold off on that for now.)

@timvandermeij
Copy link
Contributor Author

The shortcut line has also been updated.

@timvandermeij
Copy link
Contributor Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/a2ec67e382692be/output.txt

@timvandermeij timvandermeij merged commit a093d75 into mozilla:master Apr 16, 2016
@timvandermeij timvandermeij deleted the hand-tool-class branch April 16, 2016 17:33
@timvandermeij
Copy link
Contributor Author

Thank you for reviewing this, @Snuffleupagus!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants