Skip to content

Commit

Permalink
[Editor] Change the cursors for highlighting (bug 1876588)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Jan 26, 2024
1 parent 4ec4348 commit 13afb81
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
2 changes: 2 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,8 @@ function buildComponents(defines, dir) {
"web/images/altText_*.svg",
"web/images/editor-toolbar-*.svg",
"web/images/toolbarButton-menuArrow.svg",
"web/images/cursor-*.svg",
"web/images/toolbarButton-editorHighlight.svg",
];

return merge([
Expand Down
12 changes: 10 additions & 2 deletions src/display/editor/annotation_editor_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class AnnotationEditorLayer {
"pointerdown",
this.#boundTextLayerPointerDown
);
this.#textLayer.div.classList.add("drawing");
this.#textLayer.div.classList.add("highlighting");
}
}

Expand All @@ -345,7 +345,7 @@ class AnnotationEditorLayer {
"pointerdown",
this.#boundTextLayerPointerDown
);
this.#textLayer.div.classList.remove("drawing");
this.#textLayer.div.classList.remove("highlighting");
}
}

Expand All @@ -359,11 +359,19 @@ class AnnotationEditorLayer {
// Do nothing on right click.
return;
}
this.#textLayer.div.classList.add("free");
HighlightEditor.startHighlighting(
this,
this.#uiManager.direction === "ltr",
event
);
this.#textLayer.div.addEventListener(
"pointerup",
() => {
this.#textLayer.div.classList.remove("free");
},
{ once: true }
);
event.preventDefault();
}
}
Expand Down
18 changes: 18 additions & 0 deletions web/annotation_editor_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@
/*#else*/
--editorInk-editing-cursor: url(images/cursor-editorInk.svg) 0 16, pointer;
/*#endif*/
--editorHighlight-editing-cursor: url(images/cursor-editorTextHighlight.svg)
23 23,
text;
--editorFreeHighlight-editing-cursor: url(images/toolbarButton-editorHighlight.svg)
0 16,
pointer;
}

.textLayer.highlighting {
cursor: var(--editorFreeHighlight-editing-cursor);

&:not(.free) span {
cursor: var(--editorHighlight-editing-cursor);
}

&.free span {
cursor: var(--editorFreeHighlight-editing-cursor);
}
}

@media (min-resolution: 1.1dppx) {
Expand Down
4 changes: 4 additions & 0 deletions web/images/cursor-editorTextHighlight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion web/text_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
z-index: 2;
caret-color: CanvasText;

&.drawing {
&.highlighting {
touch-action: none;
}

Expand Down

0 comments on commit 13afb81

Please sign in to comment.