[Editor] Fix few keyboard shortcuts on mac

This commit is contained in:
Calixte Denizet 2022-07-24 16:52:18 +02:00
parent 9cc5260b68
commit 85f3e23e7f
2 changed files with 9 additions and 4 deletions

View File

@ -16,7 +16,7 @@
// eslint-disable-next-line max-len
/** @typedef {import("./annotation_editor_layer.js").AnnotationEditorLayer} AnnotationEditorLayer */
import { bindEvents, ColorManager } from "./tools.js";
import { bindEvents, ColorManager, KeyboardManager } from "./tools.js";
import { shadow, unreachable } from "../../shared/util.js";
/**
@ -249,12 +249,17 @@ class AnnotationEditor {
* @param {PointerEvent} event
*/
pointerdown(event) {
if (event.button !== 0) {
const isMac = KeyboardManager.platform.isMac;
if (event.button !== 0 || (event.ctrlKey && isMac)) {
// Avoid to focus this editor because of a non-left click.
event.preventDefault();
}
if (event.ctrlKey || event.shiftKey) {
if (
(event.ctrlKey && !isMac) ||
event.shiftKey ||
(event.metaKey && isMac)
) {
this.parent.toggleSelected(this);
} else {
this.parent.setSelected(this);

View File

@ -433,7 +433,7 @@ class AnnotationEditorUIManager {
],
AnnotationEditorUIManager.prototype.delete,
],
[["Escape"], AnnotationEditorUIManager.prototype.unselectAll],
[["Escape", "mac+Escape"], AnnotationEditorUIManager.prototype.unselectAll],
]);
constructor(container, eventBus) {