!1130 优化:抽屉深度

pull/1130/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 6e8c7e68b3
commit 6e3b3271eb

@ -46,12 +46,7 @@ export class DrawDrawrer implements Command
store.totalDepth = safeEval(FixedNotZero(size.y, 2));
if (store.m_Option.isAuto)
{
let totalDepth = store.m_Option.drawerTotalDepth || store.totalDepth;
let val = Math.floor((totalDepth - store.m_Option.offset) / 50) * 50;
store.m_Option.depth = val;
store.UIOption.depth = val.toString();
}
store.SetDrawerDepth();
app.Editor.ModalManage.RenderModal(DoorModal, { store, type: BoardModalType.Ct });
let res = await app.Editor.ModalManage.Wait();
@ -264,12 +259,11 @@ export class DrawDrawrer implements Command
templateSpace.HParam.expr = isLock ? spaceParse.Size.z - option.topOffset - option.bottomOffset : "_DIV";
templateSpace.PYParam.expr = "MBH";
let depth = (option.drawerTotalDepth > 0 && option.depth > option.drawerTotalDepth) ? option.drawerTotalDepth : option.depth;
let depth = option.depth;
templateSpace.GetParam("BH").value = option.thickness;
this.AppendTemplateParam("DWDEEPTH", depth, "抽屉深度", templateSpace);
templateSpace.GetParam("DWDEEPTH").expr = `(_W>0&&_W<=${depth})?_W:${depth}`;
this.AppendTemplateParam("MBH", option.offset, "抽屉内缩", templateSpace);
@ -338,7 +332,7 @@ export class DrawDrawrer implements Command
colTemp.LParam.expr = lValue;
}
colTemp.WParam.expr = "_W-_MBH";
colTemp.WParam.expr = "_W-_MBH-5";
colTemp.HParam.expr = "_H";
colTemp.PXParam.expr = "_POS";
colTemp.GetParam("BH").value = 18;
@ -468,7 +462,11 @@ export class DrawDrawrer implements Command
}
rowTemplate.LParam.expr = "_L";
rowTemplate.WParam.expr = (opt.isAuto && opt.drawerTotalDepth === 0) ? "floor((_W-5)/50)*50" : "floor((__DWDEEPTH-__MBH)/50)*50";
//输入的深度也按50倍数 6.30
let wExpr = opt.isAuto ? "floor(_W/50)*50" : "floor(__DWDEEPTH/50)*50";
if (opt.drawerTotalDepth > 0)
wExpr = `${wExpr}>${opt.drawerTotalDepth}?${opt.drawerTotalDepth}:${wExpr}`;
rowTemplate.WParam.expr = wExpr;
rowTemplate.PZParam.expr = "_POS";
let bhPar = rowTemplate.GetParam("BH");

@ -33,6 +33,7 @@ export interface ISetItemOption
update?(); /*组件更新完成c触发*/
mounted?(); /**组件挂载完成触发 */
isUpper?: boolean;
tip?: string;
}
interface ISetBlockOption
{
@ -77,7 +78,7 @@ export class SetBoardDataItem extends React.Component<ISetItemOption, {}>
{
const props = this.props;
return (
<div className={props.className + " br-set " + (props.inline ? "inline" : "")}>
<div title={this.props.tip ?? ""} className={props.className + " br-set " + (props.inline ? "inline" : "")}>
<span>
{props.title}:
</span>

@ -22,11 +22,7 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore;
const store = this.props.store;
if (store instanceof DrawerStore)
{
store.m_Option.drawerTotalDepth = safeEval(store.UIOption.drawerTotalDepth, { W: store.totalDepth, H: store.totalHeight, L: store.totalWidth });
let totalDepth = store.m_Option.drawerTotalDepth || store.totalDepth;
let val = Math.floor((totalDepth - store.m_Option.offset) / 50) * 50;
store.m_Option.depth = val;
this.uiOption.depth = val.toString();
store.SetDrawerDepth();
}
};
UNSAFE_componentWillMount()
@ -103,6 +99,7 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore;
option={store.m_Option}
uiOption={this.uiOption}
title="抽屉总深"
tip="最大深度"
onChange={() =>
{
this.handleDrawerDepth();

@ -14,10 +14,11 @@ import { DisableChangeParName } from '../../../Store/DoorInterface';
import { ModalHeader, ModalFooter } from './../../Modal/ModalContainer';
import { AutoCutCheckbox } from '../BoardCommon';
const DoorHelpUrl = "https://cfcad.cn/help/#/ThreeDDrawing/DOOR";
const DrawerHelpUrl = "https://cfcad.cn/help/#/ThreeDDrawing/DRAWER";
@inject("store")
@observer
export class DoorModal extends React.Component<{ store?: DoorDrawerStore, type: BoardModalType; }, {}>
export class DoorModal extends React.Component<{ store: DoorDrawerStore, type: BoardModalType; }, {}>
{
private startSelect = observable.box(false);
UNSAFE_componentWillMount()
@ -40,6 +41,7 @@ export class DoorModal extends React.Component<{ store?: DoorDrawerStore, type:
title={store.title + "设计"}
icon="remove-column-left"
close={() => store.OnOk(ModalState.Cancel)}
helpUrl={isDoor ? DoorHelpUrl : DrawerHelpUrl}
/>
<div
className={Classes.DIALOG_BODY + " door"}

@ -25,6 +25,7 @@ interface IModalProps
footerStyle?: React.CSSProperties;
containerEl?: (el) => void;
logo?: boolean;
helpUrl?: string;
}
export class CommonModal extends Component<IModalProps>{
@ -37,6 +38,7 @@ export class CommonModal extends Component<IModalProps>{
icon={this.props.icon}
close={this.props.close}
logo={this.props.logo}
helpUrl={this.props.helpUrl}
/>
<ModalBody className={this.props.bodyClass || ""} bodyStyle={this.props.bodyStyle}>
{
@ -93,6 +95,7 @@ interface IModalHeaderProps
isMaxBtn?: boolean;
isPinBtn?: boolean;
logo?: boolean;
helpUrl?: string;
}
@observer
@ -143,23 +146,31 @@ export class ModalHeader extends Component<IModalHeaderProps>
}
<h4 className="bp3-heading">{this.props.title}</h4>
{
isMaxBtn ?
<Button
minimal
icon={this.isMax ? "minimize" : "maximize"}
onClick={this.ChangeModalSize}
/> : null
this.props.helpUrl &&
<Button
minimal
icon="help"
onClick={() => window.open(this.props.helpUrl)}
/>
}
{
isPinBtn ?
<Button
ref={el => this.pinBtnEl = el}
minimal
className="bp3-dialog-pin-button"
icon={this.isPin ? "unpin" : "pin"}
title={`${this.isPin ? "开启" : "禁止"}自动隐藏`}
onClick={this.onPinBtnClick}
/> : null
isMaxBtn &&
<Button
minimal
icon={this.isMax ? "minimize" : "maximize"}
onClick={this.ChangeModalSize}
/>
}
{
isPinBtn &&
<Button
ref={el => this.pinBtnEl = el}
minimal
className="bp3-dialog-pin-button"
icon={this.isPin ? "unpin" : "pin"}
title={`${this.isPin ? "开启" : "禁止"}自动隐藏`}
onClick={this.onPinBtnClick}
/>
}
<Button
aria-label="Close"

@ -4,6 +4,7 @@ import { DoorDrawerStore } from "./DoorDrawerStore";
import { DefaultDrawerOption } from "../../../Editor/DefaultConfig";
import { IConfigOption } from "../../Components/Board/UserConfig";
import { FixErrorDataConfig } from "../BoardStore";
import { safeEval } from "../../../Common/eval";
export class DrawerStore extends DoorDrawerStore
{
title = "抽屉";
@ -70,4 +71,15 @@ export class DrawerStore extends DoorDrawerStore
this.UpdateDoorDrawerVersionInfo(cof);
}
}
SetDrawerDepth()
{
if (this.m_Option.isAuto)
{
this.m_Option.drawerTotalDepth = safeEval(this.UIOption.drawerTotalDepth, { W: this.totalDepth, H: this.totalHeight, L: this.totalWidth });
let totalDepth = this.m_Option.drawerTotalDepth || this.totalDepth;
let val = Math.floor((totalDepth - this.m_Option.offset) / 50) * 50;
this.m_Option.depth = val;
this.UIOption.depth = val.toString();
}
}
}

Loading…
Cancel
Save