Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 309d0f9

Browse files
authored
fix: LEAP-246: Replace overlaping MIG hotkeys (#1666)
1 parent 8eaa8c7 commit 309d0f9

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/core/Hotkey.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ import { createElement, Fragment } from 'react';
55
import { Tooltip } from '../common/Tooltip/Tooltip';
66
import Hint from '../components/Hint/Hint';
77
import { Block, Elem } from '../utils/bem';
8-
import { FF_LSDV_1148, isFF } from '../utils/feature-flags';
8+
import { FF_LSDV_1148, FF_MULTI_OBJECT_HOTKEYS, isFF } from '../utils/feature-flags';
99
import { isDefined, isMacOS } from '../utils/utilities';
1010
import defaultKeymap from './settings/keymap.json';
1111

12+
if (!isFF(FF_MULTI_OBJECT_HOTKEYS)) {
13+
const prev = (defaultKeymap as Keymap)['image:prev'];
14+
const next = (defaultKeymap as Keymap)['image:next'];
15+
16+
if (prev) {
17+
prev.key = prev.mac = 'ctrl+a';
18+
}
19+
if (next) {
20+
next.key = next.mac = 'ctrl+d';
21+
}
22+
}
23+
1224
// Validate keymap integrity
1325
const allowedKeympaKeys = ['key', 'mac', 'description', 'modifier', 'modifierDescription'];
1426

src/core/settings/keymap.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@
168168
"description": "Previous Page"
169169
},
170170
"image:prev": {
171-
"key": "ctrl+a",
171+
"key": "ctrl+left",
172+
"mac": "command+left",
172173
"description": "Previous Image"
173174
},
174175
"image:next": {
175-
"key": "ctrl+d",
176+
"key": "ctrl+right",
177+
"mac": "command+right",
176178
"description": "Next Image"
177179
}
178180
}

src/utils/feature-flags.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ export const FF_ZOOM_OPTIM = 'fflag_fix_front_leap_32_zoom_perf_190923_short';
333333

334334
export const FF_SAFE_TEXT = 'fflag_fix_leap_466_text_sanitization';
335335

336+
export const FF_MULTI_OBJECT_HOTKEYS = 'fflag_fix_leap_246_multi_object_hotkeys_160124_short';
337+
336338
Object.assign(window, {
337339
APP_SETTINGS: {
338340
...(window.APP_SETTINGS ?? {}),

0 commit comments

Comments
 (0)