[Editor] Add the ability to make multiple selections (bug 1779582)

- several editors can be selected/unselected using ctrl+click;
- and then they can be copied, pasted, their properties can be changed.
This commit is contained in:
Calixte Denizet 2022-07-21 10:42:15 +02:00
parent 9fe4a667bd
commit d6b9ca48a5
7 changed files with 490 additions and 150 deletions

View file

@ -123,8 +123,16 @@ class InkEditor extends AnnotationEditor {
/** @inheritdoc */
get propertiesToUpdate() {
return [
[AnnotationEditorParamsType.INK_THICKNESS, this.thickness],
[AnnotationEditorParamsType.INK_COLOR, this.color],
[
AnnotationEditorParamsType.INK_THICKNESS,
this.thickness || InkEditor._defaultThickness,
],
[
AnnotationEditorParamsType.INK_COLOR,
this.color ||
InkEditor._defaultColor ||
AnnotationEditor._defaultLineColor,
],
];
}
@ -174,6 +182,7 @@ class InkEditor extends AnnotationEditor {
/** @inheritdoc */
rebuild() {
super.rebuild();
if (this.div === null) {
return;
}
@ -284,6 +293,7 @@ class InkEditor extends AnnotationEditor {
* @param {number} y
*/
#startDrawing(x, y) {
this.isEditing = true;
if (!this.#isCanvasInitialized) {
this.#isCanvasInitialized = true;
this.#setCanvasDims();
@ -390,6 +400,7 @@ class InkEditor extends AnnotationEditor {
return;
}
this.isEditing = false;
this.disableEditMode();
// This editor must be on top of the main ink editor.
@ -408,8 +419,8 @@ class InkEditor extends AnnotationEditor {
}
/** @inheritdoc */
focusin(/* event */) {
super.focusin();
focusin(event) {
super.focusin(event);
this.enableEditMode();
}