|
|
|
@ -7,7 +7,7 @@ import { t } from "../i18n"; |
|
|
|
import { calculateScrollCenter } from "../scene"; |
|
|
|
import { calculateScrollCenter } from "../scene"; |
|
|
|
import { SCROLLBAR_WIDTH, SCROLLBAR_MARGIN } from "../scene/scrollbars"; |
|
|
|
import { SCROLLBAR_WIDTH, SCROLLBAR_MARGIN } from "../scene/scrollbars"; |
|
|
|
|
|
|
|
|
|
|
|
import { MobileShapeActions } from "./Actions"; |
|
|
|
import { ExitViewModeButton, MobileShapeActions } from "./Actions"; |
|
|
|
import { MobileToolBar } from "./MobileToolBar"; |
|
|
|
import { MobileToolBar } from "./MobileToolBar"; |
|
|
|
import { FixedSideContainer } from "./FixedSideContainer"; |
|
|
|
import { FixedSideContainer } from "./FixedSideContainer"; |
|
|
|
|
|
|
|
|
|
|
|
@ -65,8 +65,18 @@ export const MobileMenu = ({ |
|
|
|
DefaultSidebarTriggerTunnel, |
|
|
|
DefaultSidebarTriggerTunnel, |
|
|
|
} = useTunnels(); |
|
|
|
} = useTunnels(); |
|
|
|
const renderAppTopBar = () => { |
|
|
|
const renderAppTopBar = () => { |
|
|
|
const topRightUI = renderTopRightUI?.(true, appState) ?? ( |
|
|
|
if (appState.openDialog?.name === "elementLinkSelector") { |
|
|
|
<DefaultSidebarTriggerTunnel.Out /> |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const topRightUI = ( |
|
|
|
|
|
|
|
<div className="excalidraw-ui-top-right"> |
|
|
|
|
|
|
|
{renderTopRightUI?.(true, appState) ?? |
|
|
|
|
|
|
|
(!appState.viewModeEnabled && <DefaultSidebarTriggerTunnel.Out />)} |
|
|
|
|
|
|
|
{appState.viewModeEnabled && ( |
|
|
|
|
|
|
|
<ExitViewModeButton actionManager={actionManager} /> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const topLeftUI = ( |
|
|
|
const topLeftUI = ( |
|
|
|
@ -76,13 +86,6 @@ export const MobileMenu = ({ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
appState.viewModeEnabled || |
|
|
|
|
|
|
|
appState.openDialog?.name === "elementLinkSelector" |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
return <div className="App-toolbar-content">{topLeftUI}</div>; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="App-toolbar-content" |
|
|
|
className="App-toolbar-content" |
|
|
|
@ -117,41 +120,43 @@ export const MobileMenu = ({ |
|
|
|
{renderWelcomeScreen && <WelcomeScreenCenterTunnel.Out />} |
|
|
|
{renderWelcomeScreen && <WelcomeScreenCenterTunnel.Out />} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
{!appState.viewModeEnabled && ( |
|
|
|
className="App-bottom-bar" |
|
|
|
<div |
|
|
|
style={{ |
|
|
|
className="App-bottom-bar" |
|
|
|
marginBottom: SCROLLBAR_WIDTH + SCROLLBAR_MARGIN, |
|
|
|
style={{ |
|
|
|
}} |
|
|
|
marginBottom: SCROLLBAR_WIDTH + SCROLLBAR_MARGIN, |
|
|
|
> |
|
|
|
}} |
|
|
|
<MobileShapeActions |
|
|
|
> |
|
|
|
appState={appState} |
|
|
|
<MobileShapeActions |
|
|
|
elementsMap={app.scene.getNonDeletedElementsMap()} |
|
|
|
appState={appState} |
|
|
|
renderAction={actionManager.renderAction} |
|
|
|
elementsMap={app.scene.getNonDeletedElementsMap()} |
|
|
|
app={app} |
|
|
|
renderAction={actionManager.renderAction} |
|
|
|
setAppState={setAppState} |
|
|
|
app={app} |
|
|
|
/> |
|
|
|
setAppState={setAppState} |
|
|
|
|
|
|
|
/> |
|
|
|
<Island className="App-toolbar"> |
|
|
|
|
|
|
|
{!appState.viewModeEnabled && |
|
|
|
<Island className="App-toolbar"> |
|
|
|
appState.openDialog?.name !== "elementLinkSelector" && |
|
|
|
{!appState.viewModeEnabled && |
|
|
|
renderToolbar()} |
|
|
|
appState.openDialog?.name !== "elementLinkSelector" && |
|
|
|
{appState.scrolledOutside && |
|
|
|
renderToolbar()} |
|
|
|
!appState.openMenu && |
|
|
|
{appState.scrolledOutside && |
|
|
|
!appState.openSidebar && ( |
|
|
|
!appState.openMenu && |
|
|
|
<button |
|
|
|
!appState.openSidebar && ( |
|
|
|
type="button" |
|
|
|
<button |
|
|
|
className="scroll-back-to-content" |
|
|
|
type="button" |
|
|
|
onClick={() => { |
|
|
|
className="scroll-back-to-content" |
|
|
|
setAppState((appState) => ({ |
|
|
|
onClick={() => { |
|
|
|
...calculateScrollCenter(elements, appState), |
|
|
|
setAppState((appState) => ({ |
|
|
|
})); |
|
|
|
...calculateScrollCenter(elements, appState), |
|
|
|
}} |
|
|
|
})); |
|
|
|
> |
|
|
|
}} |
|
|
|
{t("buttons.scrollBackToContent")} |
|
|
|
> |
|
|
|
</button> |
|
|
|
{t("buttons.scrollBackToContent")} |
|
|
|
)} |
|
|
|
</button> |
|
|
|
</Island> |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</Island> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
<FixedSideContainer side="top" className="App-top-bar"> |
|
|
|
<FixedSideContainer side="top" className="App-top-bar"> |
|
|
|
{renderAppTopBar()} |
|
|
|
{renderAppTopBar()} |
|
|
|
|