Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/component/context/KeyModifierContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ function getModifiersKey(event: EventModifierKeys) {
return toModifiersKey(keyModifiers);
}

export function useIsPrimaryKeyActivated() {
const { primaryKeyIdentifier } = useMapKeyModifiers();
return primaryKeyIdentifier === 'shift[false]_ctrl[false]_alt[false]';
}

export function useMapKeyModifiers() {
const {
current: {
Expand Down
5 changes: 3 additions & 2 deletions src/component/toolbar/nmr_toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Toolbar, TooltipHelpContent } from 'react-science/ui';
import { isQuadrants2DSpectrum } from '../../data/data2d/Spectrum2D/isSpectrum2D.js';
import { useChartData } from '../context/ChartContext.js';
import { useDispatch } from '../context/DispatchContext.js';
import { useIsPrimaryKeyActivated } from '../context/KeyModifierContext.tsx';
import { useLoader } from '../context/LoaderContext.js';
import { usePreferences } from '../context/PreferencesContext.js';
import type { ToolbarPopoverMenuItem } from '../elements/ToolbarPopoverItem.js';
Expand Down Expand Up @@ -99,6 +100,7 @@ export default function NMRToolbar() {
const isButtonVisible = useCheckToolsVisibility();
const dispatch = useDispatch();
const spectrum = useSpectrum();
const isPrimaryKeyActivated = useIsPrimaryKeyActivated();

const {
isRealSpectrumShown,
Expand Down Expand Up @@ -234,8 +236,7 @@ export default function NMRToolbar() {
{ title: 'Horizontal', shortcuts: ['f'] },
{ title: 'Horizontal and Vertical', shortcuts: ['f', 'f'] },
],
description:
'Zoom out by double-clicking the left mouse button, and fully zoom out horizontally by pressing the key "f". Alternatively, press the key "ff" to fit the spectra horizontally and vertically.',
description: `Zoom out by ${isPrimaryKeyActivated ? 'Shift + ' : ''}double-clicking the left mouse button, and fully zoom out horizontally by pressing the key "f". Alternatively, press the key "ff" to fit the spectra horizontally and vertically.`,
link: 'https://docs.nmrium.org/help/zoom-and-scale',
},
onClick: handleFullZoomOut,
Expand Down
Loading