-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from Original-Recipe/feat-topViewVisibleOptimize
feat: Select the top view frame to display logic optimization
- Loading branch information
Showing
11 changed files
with
175 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/lb-components/src/store/toolConfig/baseToolConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StateCreator } from 'zustand'; | ||
import { BaseStore } from './types'; | ||
|
||
const baseToolStateCreator: StateCreator<BaseStore> = (set, get) => ({ | ||
onlyLoadFirstData: false, | ||
setOnlyLoadFirstData: (onlyLoadFirstData) => set((state) => ({ onlyLoadFirstData })), | ||
}); | ||
|
||
export default baseToolStateCreator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { create } from 'zustand'; | ||
import { ToolConfigStore } from './types'; | ||
import baseToolStateCreator from './baseToolConfig'; | ||
import pointCloudToolStateCreator from './pointCloudToolConfig'; | ||
|
||
interface toolConfigStore { | ||
onlyLoadFirstData: boolean; | ||
setOnlyLoadFirstData: (onlyLoadFirstData: boolean) => void; | ||
} | ||
|
||
const useToolConfigStore = create<toolConfigStore>((set) => ({ | ||
onlyLoadFirstData: false, | ||
setOnlyLoadFirstData: (onlyLoadFirstData) => set((state) => ({ onlyLoadFirstData })), | ||
const useToolConfigStore = create<ToolConfigStore>((set, get, api) => ({ | ||
...baseToolStateCreator(set, get, api), | ||
...pointCloudToolStateCreator(set, get, api), | ||
})); | ||
|
||
export default useToolConfigStore; |
10 changes: 10 additions & 0 deletions
10
packages/lb-components/src/store/toolConfig/pointCloudToolConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { StateCreator } from 'zustand'; | ||
import { PointCloudToolConfigStore } from './types'; | ||
|
||
const pointCloudToolStateCreator: StateCreator<PointCloudToolConfigStore> = (set, get) => ({ | ||
selectBoxVisibleSwitch: false, | ||
setSelectBoxVisibleSwitch: (selectBoxVisibleSwitch: boolean) => | ||
set(() => ({ selectBoxVisibleSwitch })), | ||
}); | ||
|
||
export default pointCloudToolStateCreator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Define basic generic types that will be used by all state modules | ||
export interface BaseStore { | ||
onlyLoadFirstData: boolean; | ||
setOnlyLoadFirstData: (onlyLoadFirstData: boolean) => void; | ||
} | ||
|
||
// Define point cloud type: PointCloudToolConfig Store | ||
export interface PointCloudToolConfigStore { | ||
selectBoxVisibleSwitch: boolean; | ||
setSelectBoxVisibleSwitch: (selectBoxVisibleSwitch: boolean) => void; | ||
} | ||
|
||
// Import all types into toolConfig Store through inheritance | ||
export interface ToolConfigStore extends BaseStore, PointCloudToolConfigStore {} |
15 changes: 15 additions & 0 deletions
15
...ainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.switchBox{ | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 12px 20px; | ||
} | ||
|
||
.switchLeft{ | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.switchTitle{ | ||
margin-right: 8px; | ||
} |
37 changes: 37 additions & 0 deletions
37
.../views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useEffect } from 'react'; | ||
import { Switch, Tooltip } from 'antd'; | ||
import useToolConfigStore from '@/store/toolConfig'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { QuestionCircleOutlined } from '@ant-design/icons'; | ||
import styles from './index.module.scss'; | ||
|
||
const selectBoxVisibleSwitch: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const { selectBoxVisibleSwitch, setSelectBoxVisibleSwitch } = useToolConfigStore(); | ||
|
||
useEffect(() => { | ||
// After the page rendering is completed, the default value for selectBoxVisibleSwitch is set to false | ||
setSelectBoxVisibleSwitch(false); | ||
}, []); | ||
|
||
const onChange = (value: boolean) => { | ||
setSelectBoxVisibleSwitch(value); | ||
}; | ||
|
||
return ( | ||
<div className={styles.switchBox}> | ||
<div className={styles.switchLeft}> | ||
<div className={styles.switchTitle}>{t('SelectBoxToDisplayIndependently')}</div> | ||
<Tooltip | ||
placement='top' | ||
title={<div style={{ width: '210px' }}>{t('SelectBoxSwitchTips')}</div>} | ||
> | ||
<QuestionCircleOutlined /> | ||
</Tooltip> | ||
</div> | ||
<Switch defaultChecked={false} checked={selectBoxVisibleSwitch} onChange={onChange} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default selectBoxVisibleSwitch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters