diff --git a/source/Component/CommandBar/CommandBar.tsx b/source/Component/CommandBar/CommandBar.tsx index 05940e9..bc2e4b7 100644 --- a/source/Component/CommandBar/CommandBar.tsx +++ b/source/Component/CommandBar/CommandBar.tsx @@ -1,6 +1,7 @@ import { BackgroundLevel, Theme } from "@Component/Theme/Theme"; import { DirectionalHint, IconButton } from "@fluentui/react"; import { LocalizationTooltipHost } from "../Localization/LocalizationTooltipHost"; +import { useSetting, IMixinSettingProps } from "@Context/Setting"; import { AllI18nKeys } from "../Localization/Localization"; import { Component, ReactNode } from "react"; import "./CommandBar.scss"; @@ -9,13 +10,19 @@ interface ICommandBarProps { width: number; } -class CommandBar extends Component { +@useSetting +class CommandBar extends Component { render(): ReactNode { return { + if (this.props.setting) { + this.props.setting.layout.focus(""); + } + }} >
{this.getRenderButton({ iconName: "Save", i18NKey: "Command.Bar.Save.Info" })} diff --git a/source/Component/Container/Container.scss b/source/Component/Container/Container.scss index fd7064d..dbfe659 100644 --- a/source/Component/Container/Container.scss +++ b/source/Component/Container/Container.scss @@ -98,23 +98,33 @@ div.app-container { width: 100%; height: 100%; box-sizing: border-box; + padding: 10px; + overflow: scroll; + -ms-overflow-style: none; border: .8px solid rgba($color: #000000, $alpha: 0); } + + div.app-panel::-webkit-scrollbar { + width : 8px; /*高宽分别对应横竖滚动条的尺寸*/ + height: 0; + } + + div.app-panel::-webkit-scrollbar-thumb { + /*滚动条里面小方块*/ + border-radius: 8px; + } + + div.app-panel::-webkit-scrollbar-track { + /*滚动条里面轨道*/ + border-radius: 8px; + background-color: rgba($color: #000000, $alpha: 0); + } div.app-panel.active { border: .8px solid blue !important; } } -div.app-panel { - overflow: scroll; - -ms-overflow-style: none; -} -div.app-panel::-webkit-scrollbar { - width: 0 !important; - height: 0 !important; -} - div.dark.app-container.end-containe { border: .8px solid $lt-bg-color-lvl3-dark; @@ -132,6 +142,10 @@ div.dark.app-container.end-containe { transition: none; } } + + div.app-panel::-webkit-scrollbar-thumb { + background-color: $lt-bg-color-lvl1-dark; + } } div.light.app-container.end-containe { @@ -150,4 +164,8 @@ div.light.app-container.end-containe { transition: none; } } + + div.app-panel::-webkit-scrollbar-thumb { + background-color: $lt-bg-color-lvl1-light; + } } \ No newline at end of file diff --git a/source/Component/Container/Container.tsx b/source/Component/Container/Container.tsx index 8daa18a..9372e70 100644 --- a/source/Component/Container/Container.tsx +++ b/source/Component/Container/Container.tsx @@ -1,7 +1,11 @@ +import { Localization } from "@Component/Localization/Localization"; import { Theme, BackgroundLevel, FontLevel } from "@Component/Theme/Theme"; import { Themes } from "@Context/Setting"; +import { DirectionalHint } from "@fluentui/react"; import { ILayout, LayoutDirection } from "@Model/Layout"; import { Component, ReactNode, MouseEvent } from "react"; +import { getPanelById, getPanelInfoById } from "../../Panel/Panel"; +import { LocalizationTooltipHost } from "../Localization/LocalizationTooltipHost"; import "./Container.scss"; interface IContainerProps extends ILayout { @@ -13,10 +17,6 @@ interface IContainerProps extends ILayout { onFocusTab?: (id: string) => any; } -function getPanelById(id: string) { - return {id} -} - class Container extends Component { private focusEdgeId: number | undefined; @@ -49,21 +49,41 @@ class Container extends Component { return <> {showBar ? -
{ +
{ + this.props.onFocusTab ? this.props.onFocusTab("") : undefined + }}>{ panles.map((panelId: string) => { const classList: string[] = ["app-tab-header-item"]; if (panelId === this.props.focusId) classList.push("active"); if (panelId === showPanelId) classList.push("tab"); + const panelInfo = getPanelInfoById(showPanelId as any); - return
this.props.onFocusTab ? this.props.onFocusTab(panelId) : undefined} > -
-
{panelId}
-
+
{ + e.stopPropagation(); + this.props.onFocusTab ? this.props.onFocusTab(panelId) : undefined; + }} + > +
+
+ { + panelInfo ? + : + + } + +
+
+ }) }
: null } @@ -72,7 +92,7 @@ class Container extends Component { className={"app-panel" + (hasActivePanel ? " active" : "")} draggable={false} > - {getPanelById(showPanelId)} + {getPanelById(showPanelId as any)}
} diff --git a/source/Component/HeaderBar/HeaderBar.tsx b/source/Component/HeaderBar/HeaderBar.tsx index f7c8717..9453c85 100644 --- a/source/Component/HeaderBar/HeaderBar.tsx +++ b/source/Component/HeaderBar/HeaderBar.tsx @@ -100,6 +100,11 @@ class HeaderBar extends Component< backgroundLevel={BackgroundLevel.Level1} fontLevel={FontLevel.Level3} style={{ height: this.props.height }} + onClick={() => { + if (this.props.setting) { + this.props.setting.layout.focus(""); + } + }} >
diff --git a/source/Localization/EN-US.ts b/source/Localization/EN-US.ts index 8c15d38..1ca2c40 100644 --- a/source/Localization/EN-US.ts +++ b/source/Localization/EN-US.ts @@ -19,5 +19,8 @@ const EN_US = { "Command.Bar.Add.Tag.Info": "Add label object", "Command.Bar.Camera.Info": "Renderer settings", "Command.Bar.Setting.Info": "Global Settings", + "Panel.Title.Notfound": "{id}", + "Panel.Info.Notfound": "This panel with id {id} can not found!", + } export default EN_US; \ No newline at end of file diff --git a/source/Localization/ZH-CN.ts b/source/Localization/ZH-CN.ts index dd94e48..f7688a7 100644 --- a/source/Localization/ZH-CN.ts +++ b/source/Localization/ZH-CN.ts @@ -19,5 +19,7 @@ const ZH_CN = { "Command.Bar.Add.Tag.Info": "添加标签对象", "Command.Bar.Camera.Info": "渲染器设置", "Command.Bar.Setting.Info": "全局设置", + "Panel.Title.Notfound": "找不到面板: {id}", + "Panel.Info.Notfound": "这个编号为 {id} 的面板无法找到!", } export default ZH_CN; \ No newline at end of file diff --git a/source/Model/Layout.ts b/source/Model/Layout.ts index 8f6b100..72002a0 100644 --- a/source/Model/Layout.ts +++ b/source/Model/Layout.ts @@ -74,6 +74,11 @@ class Layout extends Emitter { } public focus = (panelId: string) => { + if (panelId === "") { + this.focusId = panelId; + this.emit("switchTab", this); + } + this.map((layout) => { if (layout.panles && layout.panles.length > 0) { let index = -1; diff --git a/source/Panel/Panel.tsx b/source/Panel/Panel.tsx new file mode 100644 index 0000000..de02066 --- /dev/null +++ b/source/Panel/Panel.tsx @@ -0,0 +1,30 @@ +import { ReactNode } from "react"; +import { Theme } from "@Component/Theme/Theme"; +import { Localization } from "@Component/Localization/Localization"; + +interface IPanelInfo { + nameKey: string; + introKay: string; + option?: Record; +} + +type PanelId = "" +| "RenderView" // 主渲染器 +; + +const PanelInfoMap = new Map(); +PanelInfoMap.set("RenderView", { nameKey: "", introKay: "" }); + +function getPanelById(panelId: PanelId): ReactNode { + return + + +} + +function getPanelInfoById(panelId: PanelId): IPanelInfo | undefined { + return PanelInfoMap.get(panelId); +} + +export { PanelId, getPanelById, getPanelInfoById} \ No newline at end of file diff --git a/source/Panel/RenderView/RenderView.scss b/source/Panel/RenderView/RenderView.scss new file mode 100644 index 0000000..e69de29 diff --git a/source/Panel/RenderView/RenderView.tsx b/source/Panel/RenderView/RenderView.tsx new file mode 100644 index 0000000..e69de29