[Editor] Change the cursor when we switch to FreeText mode (bug 1787297)

This commit is contained in:
Calixte Denizet 2022-09-02 14:42:35 +02:00
parent 51035194d9
commit 1b14b06e4c
3 changed files with 23 additions and 1 deletions

View File

@ -103,6 +103,12 @@ class AnnotationEditorLayer {
this.enableClick();
}
this.#uiManager.unselectAll();
this.div.classList.toggle(
"freeTextEditing",
mode === AnnotationEditorType.FREETEXT
);
this.div.classList.toggle("inkEditing", mode === AnnotationEditorType.INK);
}
addInkEditorIfNeeded(isCommitting) {

View File

@ -230,6 +230,7 @@ class FreeTextEditor extends AnnotationEditor {
this.editorDiv.addEventListener("keydown", this.#boundEditorDivKeydown);
this.editorDiv.addEventListener("focus", this.#boundEditorDivFocus);
this.editorDiv.addEventListener("blur", this.#boundEditorDivBlur);
this.parent.div.classList.remove("freeTextEditing");
}
/** @inheritdoc */
@ -254,6 +255,7 @@ class FreeTextEditor extends AnnotationEditor {
// In case the blur callback hasn't been called.
this.isEditing = false;
this.parent.div.classList.add("freeTextEditing");
}
/** @inheritdoc */
@ -283,6 +285,7 @@ class FreeTextEditor extends AnnotationEditor {
remove() {
this.isEditing = false;
this.parent.setEditingState(true);
this.parent.div.classList.add("freeTextEditing");
super.remove();
}

View File

@ -20,8 +20,11 @@
--freetext-padding: 2px;
/*#if COMPONENTS*/
--editorInk-editing-cursor: pointer;
--editorFreeText-editing-cursor: text;
/*#else*/
--editorInk-editing-cursor: url(images/cursor-editorInk.svg) 0 16;
--editorFreeText-editing-cursor: url(images/toolbarButton-editorFreeText.svg)
8 16;
/*#endif*/
}
@ -49,6 +52,15 @@
left: 0;
font-size: calc(100px * var(--scale-factor));
transform-origin: 0 0;
cursor: auto;
}
.annotationEditorLayer.freeTextEditing {
cursor: var(--editorFreeText-editing-cursor), text;
}
.annotationEditorLayer.inkEditing {
cursor: var(--editorInk-editing-cursor), pointer;
}
.annotationEditorLayer .selectedEditor {
@ -67,6 +79,7 @@
z-index: 1;
transform-origin: 0 0;
touch-action: none;
cursor: auto;
}
.annotationEditorLayer .freeTextEditor .internal {
@ -131,7 +144,7 @@
.annotationEditorLayer .inkEditor.editing {
resize: none;
cursor: var(--editorInk-editing-cursor), pointer;
cursor: inherit;
}
.annotationEditorLayer .inkEditor .inkEditorCanvas {