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 make multiple selections (bug 1779582) #15200

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

calixteman
Copy link
Contributor

  • several editors can be selected/unselected using ctrl+click;
  • and then they can be copied, pasted, their properties can be changed.

@marco-c marco-c linked an issue Jul 21, 2022 that may be closed by this pull request
return this.#isEditing;
}

set isEditing(value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a JSDoc-comment for the value parameter.

src/display/editor/freetext.js Show resolved Hide resolved
setSelected(editor) {
if (!this.#isMultipleSelection) {
if (this.#selectedEditors.has(editor)) {
if (this.#selectedEditors.size >= 2) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional-nit:

Suggested change
if (this.#selectedEditors.size >= 2) {
if (this.#selectedEditors.size > 1) {

}
this.#selectedEditors.clear();
this.#selectedEditors.add(editor);
this.#dispatchUpdateUI(editor.propertiesToUpdate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't you also need a dispatchUpdateStates-call in this case too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's useless because the only value we could update is hasSelectedEditor but its value won't change since we already know that the #selectedEditors is non-empty, and after the removal it's still non-empty (we let the select editor inside).

src/display/editor/tools.js Show resolved Hide resolved
src/display/editor/tools.js Show resolved Hide resolved
}

.annotationEditorLayer .inkEditor:not(:focus) {
.annotationEditorLayer .inkEditor.disabled:not(.selectedEditor) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the last part actually necessary here, or does the following work (given the rule just below which override it when necessary)?

Suggested change
.annotationEditorLayer .inkEditor.disabled:not(.selectedEditor) {
.annotationEditorLayer .inkEditor.disabled {

Comment on lines 127 to 128
.annotationEditorLayer .background {
z-index: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was just removed, in another PR, so is this perhaps a rebase mistake?


/**
* If true then the editor is currently edited.
* @return {boolean}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at our other getters, elsewhere in the code-base, I believe that you want the following for things to work generally:

Suggested change
* @return {boolean}
* @type {boolean}

await page.keyboard.press("v");
await page.keyboard.up("Control");

// 0,1,3 are unselected and new paster editors are selected.
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Jul 21, 2022

Choose a reason for hiding this comment

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

Nit: Did you mean the following?

Suggested change
// 0,1,3 are unselected and new paster editors are selected.
// 0,1,3 are unselected and new pasted editors are selected.

Comment on lines 418 to 419
// Select that all the editors are correctly selected (and the focus
// didn't move on the body when the empty editor has been removed).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Did you mean the following?

Suggested change
// Select that all the editors are correctly selected (and the focus
// didn't move on the body when the empty editor has been removed).
// Check that all the editors are correctly selected (and the focus
// didn't move to the body when the empty editor was removed).

.withContext(`In ${browserName}`)
.toEqual([7]);

// Get the focus to 2 and check that only 2 is selected.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Did you mean the following?

Suggested change
// Get the focus to 2 and check that only 2 is selected.
// Set the focus to 2 and check that only 2 is selected.


/**
* An editor just got a mousedown with ctrl key pressed.
* @param {boolean}} isMultiple
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
* @param {boolean}} isMultiple
* @param {boolean} isMultiple


/**
* An editor just got a mousedown with ctrl key pressed.
* @param {boolean}} isMultiple
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
* @param {boolean}} isMultiple
* @param {boolean} isMultiple

- several editors can be selected/unselected using ctrl+click;
- and then they can be copied, pasted, their properties can be changed.
@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/ca5e8e0d1bda87b/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/761cc3dfb7ee27b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/ca5e8e0d1bda87b/output.txt

Total script time: 4.73 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/761cc3dfb7ee27b/output.txt

Total script time: 7.25 mins

  • Integration Tests: FAILED

@calixteman calixteman merged commit 6138e16 into mozilla:master Jul 21, 2022
@calixteman calixteman deleted the multiple_selection branch July 21, 2022 21:15
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.

Support selecting multiple drawn elements
3 participants