TimeSeries: Support Ctrl key for marking annotations (#38034)

This commit is contained in:
Villena Guillaume 2021-08-18 23:38:02 +02:00 committed by GitHub
parent c5f8d98709
commit 646d95b8fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ export const AnnotationEditorPlugin: React.FC<AnnotationEditorPluginProps> = ({
mousedown: (u, targ, handler) => (e) => { mousedown: (u, targ, handler) => (e) => {
if (e.button === 0) { if (e.button === 0) {
handler(e); handler(e);
if (e.metaKey) { if (e.metaKey || e.ctrlKey) {
isClick = true; isClick = true;
annotating = true; annotating = true;
} }
@ -95,7 +95,7 @@ export const AnnotationEditorPlugin: React.FC<AnnotationEditorPluginProps> = ({
if (e.button === 0) { if (e.button === 0) {
handler(e); handler(e);
// handle cmd+drag // handle cmd+drag
if (e.metaKey) { if (e.metaKey || e.ctrlKey) {
isClick = false; isClick = false;
annotating = true; annotating = true;
} }
@ -105,7 +105,7 @@ export const AnnotationEditorPlugin: React.FC<AnnotationEditorPluginProps> = ({
}, },
mouseup: (u, targ, handler) => (e) => { mouseup: (u, targ, handler) => (e) => {
// handle cmd+click // handle cmd+click
if (isClick && u.cursor.left && e.button === 0 && e.metaKey) { if (isClick && u.cursor.left && e.button === 0 && (e.metaKey || e.ctrlKey)) {
u.setSelect({ left: u.cursor.left, width: 0, top: 0, height: 0 }); u.setSelect({ left: u.cursor.left, width: 0, top: 0, height: 0 });
annotating = true; annotating = true;
} }