!1901 修复:显示隐藏顶部工具栏命令和按钮功能冲突

pull/1889/MERGE
黄诗津 2 years ago committed by ChenX
parent c17d8519af
commit f0aac27d0e

@ -1,11 +1,11 @@
import { DownPanelStore } from "../UI/Store/DownPanelStore";
export class Command_ToggleUI
{
async exec()
{
let els = ["#TopPanel", "#TopToolBar"].map(e => document.querySelector(e) as HTMLElement);
for (let el of els)
el.style.display = el.style.display === "none" ? "block" : "none";
let store = DownPanelStore.GetInstance() as DownPanelStore;
store.isTopToolBarShow = !store.isTopToolBarShow;
store.Upload();
}
}

@ -30,13 +30,15 @@ export class ToolsBlock extends React.Component<ToolsBlockProps, {}>
@observable listSmall: ICommandIconInfo[] = this.props.list.slice(35); //顶端工具栏每部分最多显示个数
@observable windowWidth = window.innerWidth;
private blocksData = ToolsBlockStore.GetInstance().blocksData as TopToolBarBlockData;
private _DisposeAOP: Function;
componentDidMount()
{
window.addEventListener('resize', this.calSmallIconList, false);
this.calSmallIconList();
if (this.isExtendShow)
this.divEl.focus();
end(app.Editor.MouseCtrl, app.Editor.MouseCtrl.onMouseDown, (e: MouseEvent) =>
this._DisposeAOP = end(app.Editor.MouseCtrl, app.Editor.MouseCtrl.onMouseDown, (e: MouseEvent) =>
{
if (this.isExtendShow) this.isExtendShow = false;
});
@ -44,6 +46,11 @@ export class ToolsBlock extends React.Component<ToolsBlockProps, {}>
componentWillUnmount()
{
window.removeEventListener("resize", this.calSmallIconList, false);
if (this._DisposeAOP)
{
this._DisposeAOP();
this._DisposeAOP = undefined;
}
}
componentDidUpdate()
{

@ -1,6 +1,7 @@
import { action, autorun, observable, reaction } from 'mobx';
import { Vector3 } from 'three';
import * as xaop from 'xaop';
import { Command_ToggleUI } from '../../Add-on/ToggleUI';
import { app } from '../../ApplicationServices/Application';
import { appCache } from '../../Common/AppCache';
import { ConfigUrls } from '../../Common/HostUrl';
@ -285,8 +286,7 @@ export class DownPanelStore
}
toggleTopToolBarShow()
{
this.isTopToolBarShow = !this.isTopToolBarShow;
this.Upload();
new Command_ToggleUI().exec();
}
toggleBottomToolBarShow()
{

Loading…
Cancel
Save