!631 修复工具栏切换显示的遗漏

pull/631/MERGE
肖诗雅 5 years ago committed by ChenX
parent 61a9e07805
commit e8bad0e442

@ -116,7 +116,7 @@ export class Command_AutoDimBrs implements Command
propsStore.AddEnToMap(a);
}
let downStore = DownPanelStore.GetInstance() as DownPanelStore;
downStore.showToolBar = ToolBarType.both;
downStore.showType |= ToolBarType.properties;
}
/**

@ -152,7 +152,7 @@ export class Text extends Entity
UpdateDrawObjectMaterial(type: RenderType, en: Object3D)
{
if (en)
this.AsyncUpdateDrawObject(en);
this.AsyncUpdateDrawObject(en, type);
}
GetGripPoints(): Array<Vector3>
{

@ -253,8 +253,8 @@ export const DefaultBoardFindOption: IBoardFindOption = {
highDrill: [],
upDownDrill: [true, true],
isClose: false,
isRemoveModeling: false,
isRemoveSpecialShape: false,
// isRemoveModeling: false,
// isRemoveSpecialShape: false,
};
Object.freeze(DefaultBoardFindOption);

@ -174,7 +174,6 @@ export class CameraControlBtn extends React.Component<{}, {}>
RenderControlsMenu = () =>
{
let downStore = DownPanelStore.GetInstance() as DownPanelStore;
let toolbarIsShow = (downStore.showToolBar === ToolBarType.toolbar) || (downStore.showToolBar === ToolBarType.both);
return (
<Menu
className="controlsMenu-fixed"
@ -193,13 +192,10 @@ export class CameraControlBtn extends React.Component<{}, {}>
{
<MenuItem
text="工具条"
icon={toolbarIsShow ? "tick" : "blank"}
icon={downStore.isToolBarShow ? "tick" : "blank"}
onClick={() =>
{
downStore.showToolBar = toolbarIsShow ?
(downStore.showToolBar === ToolBarType.both ? ToolBarType.properties : ToolBarType.none)
: (downStore.showToolBar === ToolBarType.properties ? ToolBarType.both : ToolBarType.toolbar);
toolbarIsShow = !toolbarIsShow;
downStore.toggleToolBarShow();
this.HideMenu();
}}
/>

@ -193,11 +193,11 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}>
alignIndicator={Alignment.RIGHT}
/>
<Switch
checked={this.props.store.showToolBar}
checked={this.props.store.isToolBarShow}
label="工具栏"
onChange={(e) =>
{
this.props.store.showToolBar = e.currentTarget.checked;
this.props.store.toggleToolBarShow();
e.currentTarget.blur();
}}
style={switchStyle}

@ -2,10 +2,11 @@ import React from "react";
import { Button } from "@blueprintjs/core";
import { RightPanelStore } from "../../Store/RightPanelStore/RightPanelStore";
import { DownPanelStore, ToolBarType } from "../../Store/DownPanelStore";
import { end } from "xaop";
import { PropertiesStore } from "../ToolBar/PropertiesStore";
export class RightPanelButton extends React.Component<{ store: RightPanelStore; }, { classname: string; }>
{
btnEl: Button;
constructor(props)
{
super(props);
@ -31,7 +32,6 @@ export class RightPanelButton extends React.Component<{ store: RightPanelStore;
<div>
<Button
className={this.state.classname}
ref={el => this.btnEl = el}
small={true}
onClick={this.handleClick}
icon="eject"
@ -43,7 +43,6 @@ export class RightPanelButton extends React.Component<{ store: RightPanelStore;
export class PropertiesPanelButton extends React.Component<{ store: DownPanelStore; }, { classname: string; }>
{
btnEl: Button;
constructor(props)
{
super(props);
@ -51,20 +50,26 @@ export class PropertiesPanelButton extends React.Component<{ store: DownPanelSto
classname: "",
};
this.handleClick = this.handleClick.bind(this);
let propsStore = PropertiesStore.GetInstance();
end(propsStore, propsStore.Exit, () =>
{
this.setState({ classname: "" });
});
}
handleClick()
{
const store = this.props.store;
if (store.showToolBar === ToolBarType.both || store.showToolBar === ToolBarType.properties)
if (store.showType === ToolBarType.both || store.showType === ToolBarType.properties)
{
this.setState({ classname: "" });
store.showToolBar = store.showToolBar === ToolBarType.both ? ToolBarType.toolbar : ToolBarType.none;
store.showType ^= ToolBarType.properties;
}
else
{
this.setState({ classname: "iconTransBtn" });
store.showToolBar = store.showToolBar === ToolBarType.toolbar ? ToolBarType.both : ToolBarType.properties;
store.showType |= ToolBarType.properties;
}
}
@ -74,7 +79,6 @@ export class PropertiesPanelButton extends React.Component<{ store: DownPanelSto
<div>
<Button
className={this.state.classname}
ref={el => this.btnEl = el}
small={true}
onClick={this.handleClick}
icon="eject"

@ -24,14 +24,11 @@ export interface PropertiesPanelProps
@observer
export class PropertiesPanel extends React.Component<PropertiesPanelProps, {}>
{
componentWillUnmount()
{
this.props.store.Exit();
}
Exit()
{
let downStore = DownPanelStore.GetInstance() as DownPanelStore;
downStore.showToolBar = ToolBarType.toolbar;
downStore.showType ^= ToolBarType.properties;
this.props.store.Exit();
}
HandleSelectOnChange(e: React.ChangeEvent<HTMLSelectElement>)
{

@ -35,12 +35,12 @@ export class ToolbarContainer extends React.Component<{}, {}> {
let pStore = PropertiesStore.GetInstance() as PropertiesStore;
return (
<div className="toolbar" style={{
display: downStore.showToolBar !== ToolBarType.none ? "flex" : "none"
display: downStore.showType !== ToolBarType.none ? "flex" : "none"
}}>
{
downStore.showToolBar === ToolBarType.properties ?
downStore.showType === ToolBarType.properties ?
<PropertiesPanel store={pStore} />
: downStore.showToolBar === ToolBarType.toolbar ?
: downStore.showType === ToolBarType.toolbar ?
<ToolBar iconList={iconList} /> :
<>
<ToolBar iconList={iconList} />

@ -16,7 +16,7 @@ function PointToString(pt: Vector3): string
export enum ToolBarType
{
both = 3,//同时显示工具和特性
both = ~(~0 << 2),//同时显示工具和特性
toolbar = 1,//显示工具
properties = 2,//显示特性
none = 0,//不显示
@ -28,12 +28,13 @@ export enum ToolBarType
export class DownPanelStore extends Singleton
{
@observable useDynInput: boolean = true;
@observable showToolBar: ToolBarType = 1;
@observable showType: ToolBarType = 1;
@observable useDynSnap: boolean = true;
@observable usePass: boolean = true;
@observable useOrtho: boolean = false;
@observable fontName: string = "songti";
@observable progress = 1;
@observable isToolBarShow: boolean = true;
posEl: HTMLSpanElement;
private constructor()
{
@ -50,4 +51,9 @@ export class DownPanelStore extends Singleton
app.Viewer.UsePass = this.usePass;
});
}
toggleToolBarShow()
{
this.showType = this.isToolBarShow ? this.showType ^ ToolBarType.toolbar : this.showType | ToolBarType.toolbar;
this.isToolBarShow = !this.isToolBarShow;
}
}

Loading…
Cancel
Save