Skip to content

Commit

Permalink
fix: twice click to maximize panel
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Dec 11, 2023
1 parent 36071e0 commit 9887316
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/state/userInterface/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { generalActionError } from "../actions";
import { userInterface } from "..";
import { selectors } from "../atlasSelection"
import * as actions from "./actions"
import { isNullish } from "src/util/fn";

@Injectable()
export class Effects{
Expand Down Expand Up @@ -70,18 +71,23 @@ export class Effects{
)
),
switchMap(([ { targetIndex }, panelMode ]) => {
const newMode: userInterface.PanelMode = panelMode === "FOUR_PANEL"
let newMode: userInterface.PanelMode
if (isNullish(panelMode)) {
newMode = "PIP_PANEL"
} else {
newMode = panelMode === "FOUR_PANEL"
? "PIP_PANEL"
: "FOUR_PANEL"
}
const newOrder = newMode === "FOUR_PANEL"
? "0123"
: "0123".split("").map(v => ((Number(v) + targetIndex) % 4).toString()).join("")
return of(
userInterface.actions.setPanelMode({
panelMode: newMode
}),
userInterface.actions.setPanelOrder({
order: newOrder
}),
userInterface.actions.setPanelMode({
panelMode: newMode
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class PerspectiveViewSlider {
),
]).pipe(
map(([ mode, order ]) => {
// TODO order can potentially be nullish
if (!([EnumPanelMode.PIP_PANEL, EnumPanelMode.SINGLE_PANEL].includes(mode as EnumPanelMode))) {
return null
}
Expand Down

0 comments on commit 9887316

Please sign in to comment.