diff --git a/apps/fxc-front/src/app/components/ui/main-menu.ts b/apps/fxc-front/src/app/components/ui/main-menu.ts index 7eda1a3e..8e8638d4 100644 --- a/apps/fxc-front/src/app/components/ui/main-menu.ts +++ b/apps/fxc-front/src/app/components/ui/main-menu.ts @@ -7,7 +7,7 @@ import { when } from 'lit/directives/when.js'; import { UnsubscribeHandle } from 'micro-typed-events'; import { connect } from 'pwa-helpers'; import { requestCurrentPosition } from '../../logic/geolocation'; -import { ParamNames, addUrlParamValues, pushCurrentState } from '../../logic/history'; +import { addUrlParamValues, getSearchParams, ParamNames, pushCurrentState } from '../../logic/history'; import * as msg from '../../logic/messages'; import { uploadTracks } from '../../logic/track'; import { DistanceUnit, formatUnit } from '../../logic/units'; @@ -526,6 +526,9 @@ export class ViewItems extends connect(store)(LitElement) { private async handleSwitch() { store.dispatch(setApiLoading(true)); await maybeHideSidePane(); + if (sel.view2d(store.getState())){ + window.open(`/3d?${getSearchParams().toString()}`); + } } protected createRenderRoot(): HTMLElement { diff --git a/apps/fxc-front/src/app/redux/selectors.ts b/apps/fxc-front/src/app/redux/selectors.ts index 76b5ed3c..e2f15fc0 100644 --- a/apps/fxc-front/src/app/redux/selectors.ts +++ b/apps/fxc-front/src/app/redux/selectors.ts @@ -16,6 +16,8 @@ export const currentTrack = (state: RootState): RuntimeTrack | undefined => export const currentTrackId = (state: RootState): string | undefined => state.track.currentTrackId; export const numTracks = trackAdapterSelector.selectTotal; +export const view2d = (state: RootState):boolean => !state.app.view3d; + export const groupIds = (state: RootState): Set => new Set(state.track.tracks.ids.map((trackId) => extractGroupId(String(trackId))));