Skip to content

Commit

Permalink
fix: zoom history in 2D
Browse files Browse the repository at this point in the history
close #1371
  • Loading branch information
hamed-musallam committed Mar 2, 2022
1 parent 61bd971 commit c2c989a
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/component/reducer/actions/ToolsActions.ts
Expand Up @@ -221,7 +221,7 @@ function handleBrushEnd(draft: Draft<State>, action) {
break;
}
if (brushHistory) {
brushHistory.push({ xDomain: domainX, yDomain: domainY });
brushHistory.push({ xDomain: draft.xDomain, yDomain: draft.yDomain });
}
} else {
draft.xDomain = domainX;
Expand Down Expand Up @@ -312,25 +312,10 @@ function zoomOut(draft: Draft<State>, action) {
}
} else {
const { xDomain, yDomain, yDomains } = draft.originDomain;

switch (trackID) {
case LAYOUT.TOP_1D: {
const activeSpectrum =
draft.tabActiveSpectrum[draft.activeTab.split(',')[0]];
draft.xDomain = xDomain;
if (activeSpectrum?.id) {
draft.yDomains[activeSpectrum.id] = yDomains[activeSpectrum.id];
}
break;
}
case LAYOUT.LEFT_1D: {
const activeSpectrum =
draft.tabActiveSpectrum[draft.activeTab.split(',')[1]];
draft.yDomain = yDomain;
if (activeSpectrum?.id) {
draft.yDomains[activeSpectrum.id] = yDomains[activeSpectrum.id];
}
break;
}
case LAYOUT.TOP_1D:
case LAYOUT.LEFT_1D:
case LAYOUT.CENTER_2D: {
const zoomValue = zoomHistory.pop();
draft.xDomain = zoomValue ? zoomValue.xDomain : xDomain;
Expand Down

0 comments on commit c2c989a

Please sign in to comment.