diff --git a/src/Add-on/ToggleUI.ts b/src/Add-on/ToggleUI.ts index d1b46a252..4c12a0909 100644 --- a/src/Add-on/ToggleUI.ts +++ b/src/Add-on/ToggleUI.ts @@ -5,7 +5,10 @@ export class Command_ToggleUI async exec() { let store = DownPanelStore.GetInstance() as DownPanelStore; - store.isTopToolBarShow = !store.isTopToolBarShow; + if (store.isSmallScreen) + store.isTopToolBarShowMin = !store.isTopToolBarShowMin; + else + store.isTopToolBarShow = !store.isTopToolBarShow; store.Upload(); } } diff --git a/src/UI/Components/CameraControlButton/CameraControlBtn.tsx b/src/UI/Components/CameraControlButton/CameraControlBtn.tsx index a653a810a..a79edc233 100644 --- a/src/UI/Components/CameraControlButton/CameraControlBtn.tsx +++ b/src/UI/Components/CameraControlButton/CameraControlBtn.tsx @@ -266,7 +266,7 @@ export class CameraControlBtn extends React.Component<{}, {}> > { downStore.toggleTopToolBarShow(); @@ -274,7 +274,7 @@ export class CameraControlBtn extends React.Component<{}, {}> /> { downStore.toggleLeftToolBarShow(); @@ -282,7 +282,7 @@ export class CameraControlBtn extends React.Component<{}, {}> /> { downStore.toggleBottomToolBarShow(); diff --git a/src/UI/Components/Panel.tsx b/src/UI/Components/Panel.tsx index f49e54530..4f35af6fa 100644 --- a/src/UI/Components/Panel.tsx +++ b/src/UI/Components/Panel.tsx @@ -104,7 +104,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}> render() { return ( -
+
{/* */} @@ -228,7 +228,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}> //底部状态栏 @inject("store") @observer -export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}> +export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}> { rStore: RightPanelStore = RightPanelStore.GetInstance(); private downStore = DownPanelStore.GetInstance() as DownPanelStore; @@ -376,7 +376,7 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}> }; return (
alignIndicator={Alignment.RIGHT} /> { diff --git a/src/UI/Components/TopToolBar/TopToolBar.tsx b/src/UI/Components/TopToolBar/TopToolBar.tsx index 45299f858..750705db6 100644 --- a/src/UI/Components/TopToolBar/TopToolBar.tsx +++ b/src/UI/Components/TopToolBar/TopToolBar.tsx @@ -221,7 +221,7 @@ export class TopToolBar extends React.Component<{}, {}> let topStore = DownPanelStore.GetInstance() as DownPanelStore; return ( -
+
{ this.posEl.innerText = PointToString(app.Editor.MouseCtrl._CurMousePointWCS); @@ -184,6 +194,17 @@ export class DownPanelStore }); } + private OnWindowsResize = () => + { + if (this.isSmallScreen && window.innerWidth >= 850) + { + this.isSmallScreen = false; + if (this.isLeftToolBarShowMin !== this.isLeftToolBarShow) + this.showType ^= ToolBarType.lefttoolbar; + window.removeEventListener("resize", this.OnWindowsResize); + } + }; + private static _SingleInstance: DownPanelStore; static GetInstance(): DownPanelStore { @@ -202,6 +223,9 @@ export class DownPanelStore isLeftToolBarShow: this.isLeftToolBarShow, isTopToolBarShow: this.isTopToolBarShow, isBottomToolBarShow: this.isBottomToolBarShow, + isLeftToolBarShowMin: this.isLeftToolBarShowMin, + isTopToolBarShowMin: this.isTopToolBarShowMin, + isBottomToolBarShowMin: this.isBottomToolBarShowMin, isF3Checked: this.isF3Checked, isF11Checked: this.isF11Checked, snapData: this.snapData.map(d => d.enable), @@ -264,11 +288,13 @@ export class DownPanelStore this.usePass = config.usePass; this.useOrtho = config.useOrtho; - let isshow: boolean; - if (window.innerWidth < 850) isshow = false; - this.isLeftToolBarShow = isshow ?? config.isLeftToolBarShow ?? true; - this.isTopToolBarShow = isshow ?? config.isTopToolBarShow ?? true; - this.isBottomToolBarShow = isshow ?? config.isBottomToolBarShow ?? true; + this.isLeftToolBarShow = config.isLeftToolBarShow ?? true; + this.isTopToolBarShow = config.isTopToolBarShow ?? true; + this.isBottomToolBarShow = config.isBottomToolBarShow ?? true; + + this.isLeftToolBarShowMin = config.isLeftToolBarShowMin ?? false; + this.isTopToolBarShowMin = config.isTopToolBarShowMin ?? false; + this.isBottomToolBarShowMin = config.isBottomToolBarShowMin ?? false; this.isF3Checked = config.isF3Checked; this.isF11Checked = config.isF11Checked; @@ -284,13 +310,16 @@ export class DownPanelStore this.lightsData[i].enable = config.lightsData[i]; } this.SetSnapMode(); - this.showType = !this.isLeftToolBarShow ? this.showType ^ ToolBarType.lefttoolbar : this.showType | ToolBarType.lefttoolbar; + this.showType = (this.isSmallScreen ? !this.isLeftToolBarShowMin : !this.isLeftToolBarShow) ? this.showType ^ ToolBarType.lefttoolbar : this.showType | ToolBarType.lefttoolbar; } toggleLeftToolBarShow() { this.showType ^= ToolBarType.lefttoolbar; - this.isLeftToolBarShow = !this.isLeftToolBarShow; + if (this.isSmallScreen) + this.isLeftToolBarShowMin = !this.isLeftToolBarShowMin; + else + this.isLeftToolBarShow = !this.isLeftToolBarShow; this.Upload(); } toggleTopToolBarShow() @@ -299,7 +328,10 @@ export class DownPanelStore } toggleBottomToolBarShow() { - this.isBottomToolBarShow = !this.isBottomToolBarShow; + if (this.isSmallScreen) + this.isBottomToolBarShowMin = !this.isBottomToolBarShowMin; + else + this.isBottomToolBarShow = !this.isBottomToolBarShow; this.Upload(); }