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

[Editor] - Add the ability to directly draw after selecting ink tool #15050

Merged
merged 1 commit into from
Jun 16, 2022

Conversation

calixteman
Copy link
Contributor

  • Right now, we must select the tool, then click to select a page and
    click to start drawing and it's a bit painful;
  • so just create a new ink editor when we're hovering a page without one.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, with comments addressed (mostly grammar nits) and passing tests; thank you!

Comment on lines 103 to 104
// We want to have the ink editor covering all the page
// and no click to create it: it must be here when we start to draw.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// We want to have the ink editor covering all the page
// and no click to create it: it must be here when we start to draw.
// We want to have the ink editor covering all of the page without having
// to click to create it: it must be here when we start to draw.

}

/**
* mouseover callback.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* mouseover callback.
* Mouseover callback.

// The div is the target so there is no ink editor, hence we can
// create a new one.
// event.buttons === 0 is here to avoid adding a new ink editor
// when we drop and editor.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you actually mean the following?

Suggested change
// when we drop and editor.
// when we drop an editor.

Comment on lines 131 to 132
* @param {boolean} mustExec - if true the command is executed after having
* been added.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that this is optional:

Suggested change
* @param {boolean} mustExec - if true the command is executed after having
* been added.
* @param {boolean} [mustExec] - If true the command is executed after having
* been added.

*/
addCommands(cmd, undo) {
this.#uiManager.addCommands(cmd, undo);
addCommands(cmd, undo, mustExec = true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to another recent PR, can we please have the default value be false instead?
(Since having undefined => true feels quite surprising.)

Comment on lines 280 to 281
// This editor must be on top of the main ink
// editor.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Fits on one line.

Comment on lines 307 to 308
// Since it the last children there is no need to give
// a higher z-index.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Since it the last children there is no need to give
// a higher z-index.
// Since it's the last child, there's no need to give it a higher z-index.

Comment on lines 339 to 341
// Since the ink editor covers all the page and we
// want to be able to select an other editor, we
// just put this one in background.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Since the ink editor covers all the page and we
// want to be able to select an other editor, we
// just put this one in background.
// Since the ink editor covers all of the page and we want to be able
// to select another editor, we just put this one in the background.

*/
addCommands(cmd, undo) {
this.#commandManager.add(cmd, undo);
addCommands(cmd, undo, mustExec = true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to another recent PR, can we please have the default value be false instead?
(Since having undefined => true feels quite surprising.)

*/
add(cmd, undo) {
add(cmd, undo, mustExec) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please mark the new parameter as optional with mustExec = falsem and also indicate that in the JSDoc (using * @param {boolean} [mustExec]).

- Right now, we must select the tool, then click to select a page and
  click to start drawing and it's a bit painful;
- so just create a new ink editor when we're hovering a page without one.
@calixteman
Copy link
Contributor Author

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/6d64997aaa346b7/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_unittest from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/fe0f6e31978ce32/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/6d64997aaa346b7/output.txt

Total script time: 3.16 mins

  • Unit Tests: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/fe0f6e31978ce32/output.txt

Total script time: 6.26 mins

  • Unit Tests: Passed

@calixteman
Copy link
Contributor Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/8735927338ade28/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/30175c2f8a70079/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/8735927338ade28/output.txt

Total script time: 4.47 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/30175c2f8a70079/output.txt

Total script time: 7.30 mins

  • Integration Tests: Passed

@calixteman calixteman merged commit b868812 into mozilla:master Jun 16, 2022
@calixteman calixteman deleted the make_ink_better branch June 16, 2022 18:35
This pull request was closed.
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