Skip to content

Commit

Permalink
fix: pressing 's' when having one spectrum affects the other vertical…
Browse files Browse the repository at this point in the history
… alignment options

when we have only one spectrum and pressing 's' should not affect the vertical alignment 'bottom' or 'center'
  • Loading branch information
hamed-musallam committed Jun 10, 2022
1 parent 72599ea commit 6b2792c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/component/reducer/actions/PreferencesActions.ts
Expand Up @@ -20,14 +20,16 @@ function changeSpectrumVerticalAlignment(
draft: Draft<State>,
options: AlignmentOptions,
) {
function stack(Spectra: Datum1D[] = []) {
draft.verticalAlign.align = 'stack';
const visibleSpectra = Spectra.filter((datum) => datum.display.isVisible);
draft.verticalAlign.verticalShift = Math.abs(
Math.floor(
(draft.height - draft.margin.bottom) / (visibleSpectra.length + 2),
),
);
function stack(spectra: Datum1D[] = []) {
if (spectra.length > 1) {
draft.verticalAlign.align = 'stack';
const visibleSpectra = spectra.filter((datum) => datum.display.isVisible);
draft.verticalAlign.verticalShift = Math.abs(
Math.floor(
(draft.height - draft.margin.bottom) / (visibleSpectra.length + 2),
),
);
}
}

function center() {
Expand Down

0 comments on commit 6b2792c

Please sign in to comment.