!662 优化抽屉上下留空参数的更新机制

pull/662/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent 9f72e623c2
commit 2a111f980d

@ -46,9 +46,9 @@ export class DrawDoorTool
for (let info of doorInfos)
{
if (info.tempInfo.temp.id)
if (info.tempInfo && info.tempInfo.temp.id)
tempIds.add(info.tempInfo.temp.id);
if (info.tempInfo.handleTemp.id)
if (info.tempInfo && info.tempInfo.handleTemp.id)
tempIds.add(info.tempInfo.handleTemp.id);
let key = (row - info.row - 1).toString() + "-" + info.col.toString();

@ -20,7 +20,6 @@ import { TemplateSizeBoard } from "../../DatabaseServices/Template/ProgramTempat
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { BoardModalType } from "../../UI/Components/Board/BoardModal";
import { INeedUpdateParams } from "../../UI/Components/Template/TemplateComponent";
export class DrawDrawrer implements Command
{
@ -96,6 +95,11 @@ export class DrawDrawrer implements Command
for (let id of [...tempIds])
{
let temp = await GetOnlineTemplate(id);
if (!temp)
{
console.warn(temp.Name, temp.Id, "这个抽屉不能用");
continue;
}
let ens = temp.Db.ModelSpace.Entitys;
if (surroundOption)
for (let en of ens)
@ -143,7 +147,18 @@ export class DrawDrawrer implements Command
let depthTemp = GetDeepestTemplate(tbrs);
let templateSpace = this.GetRootTemplate(spaceParse, store.m_Option, store.currentRotationExpr);
//根空间
let rootSpaceTemplate = this.GetTotalSpaceTemplate(spaceParse);
let isLockHeigt = store.IsLockDrawerHeight;
let xlkSpace = this.GetLkSpace(store.m_Option.isLockBottomOffset || !isLockHeigt || !store.m_Option.isLockTopOffset, store.m_Option.bottomOffset, false);
rootSpaceTemplate.Children.push(xlkSpace.Id);
//抽屉根空间
let templateSpace = this.GetRootTemplate(spaceParse, store, isLockHeigt);
rootSpaceTemplate.Children.push(templateSpace.Id);
let slkSpace = this.GetLkSpace(store.m_Option.isLockTopOffset || !isLockHeigt, store.m_Option.topOffset, true);
rootSpaceTemplate.Children.push(slkSpace.Id);
for (let i = 0; i < col; i++)
{
@ -171,8 +186,8 @@ export class DrawDrawrer implements Command
}
}
if (depthTemp)
depthTemp.Children.push(templateSpace.Id);
await templateSpace.UpdateTemplateTree();
depthTemp.Children.push(rootSpaceTemplate.Id);
await rootSpaceTemplate.UpdateTemplateTree();
}
}
private AppendTemplateParam(name: string, value: number, des: string, temp: TemplateRecord)
@ -183,17 +198,19 @@ export class DrawDrawrer implements Command
par.description = des;
temp.Params.push(par);
}
private GetRootTemplate(spaceParse: ISpaceParse, option: IDrawerConfigOption, roInfos: INeedUpdateParams[])
private GetRootTemplate(spaceParse: ISpaceParse, store: DrawerStore, isLock: boolean)
{
const roInfos = store.currentRotationExpr;
const option = store.m_Option;
let templateSpace = new TemplateRecord().InitBaseParams();
templateSpace.Name = "根空间";
templateSpace.Name = "抽屉根空间";
templateSpace.SplitType = TemplateSplitType.X;
for (let info of roInfos)
templateSpace.GetParam(info.name).expr = info.expr;
templateSpace.HParam.expr = `H-SLK-XLK`;
templateSpace.PZParam.expr = "XLK";
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;
@ -202,9 +219,6 @@ export class DrawDrawrer implements Command
this.AppendTemplateParam("DWDEEPTH", depth, "抽屉深度", templateSpace);
this.AppendTemplateParam("MBH", option.offset, "抽屉内缩", templateSpace);
this.AppendTemplateParam("SLK", option.topOffset, "上留空", templateSpace);
this.AppendTemplateParam("XLK", option.bottomOffset, "下留空", templateSpace);
this.AppendTemplateParam("SYS", option.topExt, "上延伸", templateSpace);
this.AppendTemplateParam("XYS", option.bottomExt, "下延伸", templateSpace);
this.AppendTemplateParam("YYS", option.rightExt, "右延伸", templateSpace);
@ -224,18 +238,9 @@ export class DrawDrawrer implements Command
this.AppendTemplateParam("YJ", option.horSpacing, "拉手右距", templateSpace);
this.AppendTemplateParam("ZJ", option.horSpacing, "拉手左距", templateSpace);
if (spaceParse instanceof ClampSpaceParse)
{
let positioning = new PositioningClampSpace();
positioning.FromSpaceParse(spaceParse);
templateSpace.Positioning = positioning;
}
else
{
templateSpace.LParam.expr = spaceParse.Size.x;
templateSpace.WParam.expr = spaceParse.Size.y;
templateSpace.HParam.expr = spaceParse.Size.z;
}
templateSpace.LParam.expr = "_L";
templateSpace.WParam.expr = "_W";
templateSpace.PZParam.expr = "_POS";
app.Database.TemplateTable.Append(templateSpace);
return templateSpace;
@ -433,4 +438,35 @@ export class DrawDrawrer implements Command
verTemp.PZParam.expr = "-_XLK";
return verTemp;
}
private GetTotalSpaceTemplate(spaceParse: ISpaceParse)
{
let templateSpace = new TemplateRecord().InitBaseParams();
templateSpace.Name = "抽屉总空间";
templateSpace.SplitType = TemplateSplitType.Z;
app.Database.TemplateTable.Append(templateSpace);
if (spaceParse instanceof ClampSpaceParse)
{
let positioning = new PositioningClampSpace();
positioning.FromSpaceParse(spaceParse);
templateSpace.Positioning = positioning;
}
else
{
templateSpace.LParam.expr = spaceParse.Size.x;
templateSpace.WParam.expr = spaceParse.Size.y;
templateSpace.HParam.expr = spaceParse.Size.z;
}
return templateSpace;
}
/**获取上下留空空间模板 */
private GetLkSpace(isLock: boolean, height: number, isSLK: boolean)
{
let templateSpace = new TemplateRecord().InitBaseParams();
templateSpace.Name = isSLK ? "上留空空间" : "下留空空间";
templateSpace.HParam.expr = isLock ? height : `_DIV`;
templateSpace.LParam.expr = "_L";
templateSpace.WParam.expr = "_W";
app.Database.TemplateTable.Append(templateSpace);
return templateSpace;
}
}

@ -326,7 +326,7 @@ export const DefaultDoorOption = {
Object.freeze(DefaultDoorOption);
export const DefaultDrawerOption: IDrawerConfigOption = {
version: 1,
version: 2,
col: 1,
row: 1,
isAllSelect: true,
@ -355,6 +355,8 @@ export const DefaultDrawerOption: IDrawerConfigOption = {
drawerTotalDepth: 0,
trackDepth: 0,
isAutoSelectTrack: true,
isLockTopOffset: false,
isLockBottomOffset: false,
};
Object.freeze(DefaultDrawerOption);

@ -40,7 +40,7 @@ interface ISetBlockOption
uiOption?: Object;
className?: string;
isInline?: boolean;
onChange?: Function;
onChange?: (e, ...arg) => void;
disabled?: boolean;
children?: React.ReactNode;
}
@ -82,6 +82,9 @@ export class SetBoardDataItem extends React.Component<ISetItemOption, {}>
<ToasterInput
{...props}
/>
{
props.children
}
</div>
);
}
@ -93,18 +96,11 @@ export const SetBoardDataBlock = observer(
{
props.pars.map(([k, v]) =>
<SetBoardDataItem
type={props.type}
key={k}
optKey={k}
option={props.option}
uiOption={props.uiOption}
title={v}
isDisabled={props.disabled}
onChange={(e, oldValue) =>
{
if (props.onChange)
props.onChange(k, oldValue);
}}
{...props}
/>
)
}

@ -1,4 +1,4 @@
import { Checkbox, Divider, H5, H6, Radio, RadioGroup, Intent } from '@blueprintjs/core';
import { Checkbox, Divider, H5, H6, Radio, RadioGroup, Intent, Button } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import * as React from 'react';
import { CheckObjectType } from '../../../../Common/CheckoutVaildValue';
@ -12,7 +12,7 @@ import { DrawerStore } from '../../../Store/DoorDrawerStore/DrawerStore';
import { log } from '../../../../Common/Utils';
@observer
export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }>
export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore; }>
{
private uiOption;
private isDoor: boolean = true;
@ -52,7 +52,7 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
}
this.handleDrawerDepth();
store.CalcInfos(true);
}
};
private handleDrawerDepth = () =>
{
const store = this.props.store;
@ -63,7 +63,7 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
store.m_Option.depth = val;
this.uiOption.depth = val.toString();
}
}
};
private toggleSelected = () =>
{
const option = this.props.store.m_Option;
@ -73,16 +73,18 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
{
info.isSelect = option.isAllSelect;
}
}
private handleTBOffset = (par: string, oldValue: string | number) =>
};
private handleTBOffset = (e, oldValue: string | number, par: string) =>
{
const store = this.props.store;
if (store.restHeight)
const store = this.props.store as DrawerStore;
const option = store.m_Option;
if (store.restHeight && store.IsLockDrawerHeight)
{
let val = store.restHeight - store.m_Option[par];
let val = store.restHeight - option[par];
if (val < 0)
{
store.m_Option[par] = Number(oldValue) || 0;
option[par] = Number(oldValue) || 0;
AppToaster.show({
message: "上下留空过大,值无效,请修正",
timeout: 1500,
@ -93,19 +95,19 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
}
if (par === "topOffset")
{
store.m_Option.bottomOffset = val;
option.bottomOffset = val;
this.uiOption.bottomOffset = val.toString();
}
else
{
store.m_Option.topOffset = val;
option.topOffset = val;
this.uiOption.topOffset = val.toString();
}
store.CalcInfos(true);
}
else
{
if (store.m_Option.topOffset + store.m_Option.bottomOffset < store.totalHeight)
if (option.topOffset + option.bottomOffset < store.totalHeight)
store.CalcInfos(true);
else
{
@ -115,10 +117,53 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
timeout: 1500,
intent: Intent.DANGER
});
store.m_Option[par] = Number(oldValue) || 0;
option[par] = Number(oldValue) || 0;
}
}
let isLockHeight = store.IsLockDrawerHeight;
if (par === "topOffset")
{
if (!option.isLockTopOffset && (!option.isLockBottomOffset || !isLockHeight))
option.isLockTopOffset = true;
}
else
{
if (!option.isLockBottomOffset && (!option.isLockTopOffset || !isLockHeight))
option.isLockBottomOffset = true;
}
};
private toggleLockLiuKong = (isTop: boolean) =>
{
const store = this.props.store as DrawerStore;
let isLockHeight = store.IsLockDrawerHeight;
if (isTop)
{
if (isLockHeight && store.m_Option.isLockBottomOffset && !store.m_Option.isLockTopOffset)
{
AppToaster.show({
message: "上下留空和抽屉空间无法全部锁定",
timeout: 2000,
intent: Intent.DANGER,
});
return;
}
store.m_Option.isLockTopOffset = !store.m_Option.isLockTopOffset;
}
else
{
if (isLockHeight && store.m_Option.isLockTopOffset && !store.m_Option.isLockBottomOffset)
{
AppToaster.show({
message: "上下留空和抽屉空间无法全部锁定",
timeout: 2000,
intent: Intent.DANGER,
});
return;
}
store.m_Option.isLockBottomOffset = !store.m_Option.isLockBottomOffset;
}
};
UNSAFE_componentWillMount()
{
this.uiOption = this.props.store.UIOption;
@ -172,14 +217,46 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
/>
</div>
<Divider />
<SetBoardDataBlock
<div className="flexWrap">
<SetBoardDataItem
className="tb-offset"
inline
type={CheckObjectType.Do}
className="flexWrap"
pars={[["topOffset", "上留空"], ["bottomOffset", "下留空"]]}
optKey="topOffset"
option={store.m_Option}
uiOption={this.uiOption}
onChange={this.handleTBOffset}
title="上留空"
>
{
store instanceof DrawerStore &&
<Button
icon={store.m_Option.isLockTopOffset ? "lock" : "unlock"}
minimal
onClick={() => this.toggleLockLiuKong(true)}
/>
}
</SetBoardDataItem>
<SetBoardDataItem
className="tb-offset"
inline
type={CheckObjectType.Do}
optKey="bottomOffset"
option={store.m_Option}
uiOption={this.uiOption}
onChange={this.handleTBOffset}
title="下留空"
>
{
store instanceof DrawerStore &&
<Button
icon={store.m_Option.isLockBottomOffset ? "lock" : "unlock"}
minimal
onClick={() => this.toggleLockLiuKong(false)}
/>
}
</SetBoardDataItem>
</div>
<Divider />
<div>
<div>
@ -431,6 +508,6 @@ export class DoorConfigModal extends React.Component<{ store?: DoorDrawerStore }
</> : null
}
</>
)
);
}
}

@ -24,8 +24,8 @@ const getCalcStyles = (info: IDoorInfo, store: DoorDrawerStore): React.CSSProper
height: info.divHeight + "px",
marginRight: info.col === store.m_Option.col - 1 ? "0" : "2px",
marginBottom: info.row === store.m_Option.row - 1 ? "0" : "2px",
}
}
};
};
//预览图门板比较大时渲染
@observer
@ -62,7 +62,7 @@ export class DoorPreviewLgItem extends React.Component<IDoorPreviewItemProps, {}
checked={info.isDrawVer}
onChange={() =>
{
info.isDrawVer = !info.isDrawVer
info.isDrawVer = !info.isDrawVer;
}}
/>
}
@ -119,7 +119,7 @@ export class DoorPreviewLgItem extends React.Component<IDoorPreviewItemProps, {}
}}
onChange={() =>
{
info.isDrawLayer = !info.isDrawLayer
info.isDrawLayer = !info.isDrawLayer;
}}
/>
}
@ -191,14 +191,14 @@ export class DoorPreviewLgItem extends React.Component<IDoorPreviewItemProps, {}
{
if (d.name && d.id)
{
return <li>{d.name}</li>
return <li>{d.name}</li>;
}
})
}
</ul>
</div>
</div>
)
);
}
}
@ -276,13 +276,13 @@ export class DoorPreviewSmItem extends React.Component<IDoorPreviewItemProps, {}
{
if (d.name && d.id)
{
return <li>{d.name}</li>
return <li>{d.name}</li>;
}
})
}
</ul>
</div>
)
);
}
}
@ -311,7 +311,7 @@ export class DoorPreviewItem extends React.Component<IDoorPreviewItemProps, {}>{
(e.parentElement.firstElementChild as HTMLDivElement).onclick = () =>
{
this.isOpen = false;
}
};
e.tabIndex = -1;
e.focus();
e.addEventListener('keydown', this.handleKeydown);
@ -344,7 +344,7 @@ export class DoorPreviewItem extends React.Component<IDoorPreviewItemProps, {}>{
>
</Popover>
</div>
)
);
}
private RenderRadiusOption(isDoor: boolean, info: IDoorInfo, store: DoorDrawerStore)
@ -362,7 +362,7 @@ export class DoorPreviewItem extends React.Component<IDoorPreviewItemProps, {}>{
<Radio label="上开门" value={DoorOpenDir.Top} />
<Radio label="下开门" value={DoorOpenDir.Bottom} />
<Radio label="无类型" value={DoorOpenDir.None} />
</RadioGroup>)
</RadioGroup>);
}
private RenderInputAndLock(info: IDoorInfo, store: DoorDrawerStore, isDoor: boolean): React.ReactNode
{
@ -443,7 +443,7 @@ export class DoorPreviewItem extends React.Component<IDoorPreviewItemProps, {}>{
info.isSelect = !info.isSelect;
observable(this.props.store.currentTempProp).replace(toJS(info.tempInfo.temp.props));
}, 200);
}
};
private handleKeydown = (ev: KeyboardEvent) =>
{
if (ev.keyCode === KeyBoard.Escape)
@ -451,5 +451,5 @@ export class DoorPreviewItem extends React.Component<IDoorPreviewItemProps, {}>{
this.isOpen = false;
ev.stopPropagation();
}
}
};
}

@ -174,4 +174,10 @@
text-align: center
}
}
.tb-offset {
&>span {
line-height: 30px;
}
}
}

@ -69,7 +69,7 @@ export class ToasterInput extends React.Component<IToasterInputProps, {}>
}
//值有效才运行change函数
if (this.hideErrorMsg && this.props.onChange)
this.props.onChange(e, oldValue);
this.props.onChange(e, oldValue, this.props.optKey);
};
handleClick = e =>
{

@ -299,12 +299,16 @@ export class LayerBoardStore extends BoardStore
if (this.uiLayerNailOption)
Object.assign(this.uiLayerNailOption, DataAdapter.ConvertUIData(this.layerNailOption));
if (cof.option["version"] === undefined)
if (this.m_Option.version === undefined)
{
this.m_Option.version = 1;
if (this.m_Option.calcHeight === "L")
{
this.m_Option.calcHeight = "W";
this.UIOption.calcHeight = "W";
}
}
}
HasInvailValue()
{
return super.HasInvailValue() || !Object.keys(this.layerNailOption).every(k =>

@ -5,7 +5,6 @@ import { IConfigOption } from "../../Components/Board/UserConfig";
import { BoardStore } from "../BoardStore";
import { IDoorAndDrawerConfigOption, IDrawerInfo, ISelectTempInfo } from "../DoorInterface";
import { INeedUpdateParams } from "../../Components/Template/TemplateComponent";
import { Vector3 } from "three";
import { AppToaster } from "../../Components/Toaster";
import { Intent } from "@blueprintjs/core";
@ -36,6 +35,16 @@ export class DoorDrawerStore extends BoardStore
name: "RY", value: "", description: ""
}, { name: "RZ", value: "", description: "" }];
@observable selectTemplateInfo: ISelectTempInfo;
get IsLockDrawerHeight()
{
for (let info of this.doorDrawersInfo)
{
if (info.col === 0)
if (!info.isLockHeight)
return false;
}
return true;
}
InitInfos() { }
/**更新预览图大小,空间信息大小,平均门板长宽 */
@ -111,6 +120,7 @@ export class DoorDrawerStore extends BoardStore
this.doorWidth = this.spaceWidth / col;
this.doorHeight = this.spaceHeight / row;
}
protected HandleTopBottomOffset() { }
/**计算锁定后尺寸信息*/
CalcInfos(isUpdateSpace: boolean = false)
{
@ -183,11 +193,9 @@ export class DoorDrawerStore extends BoardStore
//高全部锁定,剩余高度减去上留空后给下留空
if (row === lockHeightInfos.length)
{
retHeight = this.totalHeight - setHeight - this.m_Option.topSpace - this.m_Option.bottomSpace - (this.m_Option.midSpace) * this.m_Option.row - 1 + this.m_Option.bottomExt;
this.m_Option.bottomOffset = retHeight - this.m_Option.topOffset;
this.UIOption["bottomOffset"] = (retHeight - this.m_Option.topOffset).toString();
retHeight = this.totalHeight - setHeight;
this.restHeight = retHeight;
this.UpdateSpace();
this.HandleTopBottomOffset();
}
else
this.restHeight = undefined;
@ -234,14 +242,22 @@ export class DoorDrawerStore extends BoardStore
CheckLockSize(isWidth: boolean)
{
let size = 0;
let refSize = isWidth ? this.spaceWidth : this.spaceHeight;
let refSize = isWidth ? this.spaceWidth : (this.totalHeight - this.m_Option.topOffset - this.m_Option.bottomOffset);
for (let info of this.doorDrawersInfo)
{
let refRet = isWidth ?
(info.row === 0 && info.isLockWidth) : (info.col === 0 && info.isLockHeight)
(info.row === 0 && info.isLockWidth) : (info.col === 0 && info.isLockHeight);
if (refRet)
size += isWidth ? info.width : info.height;
}
if (size > refSize)
{
AppToaster.show({
message: "输入尺寸大于空间尺寸",
timeout: 2000,
intent: Intent.DANGER,
});
}
return size <= refSize;
}
@ -264,7 +280,7 @@ export class DoorDrawerStore extends BoardStore
message: "宽度锁定失败,锁定宽度太大",
timeout: 1500,
intent: Intent.DANGER
})
});
return;
}
}
@ -274,23 +290,24 @@ export class DoorDrawerStore extends BoardStore
else
{
let allHeight = 0;
let isAllLock = true;
if (!info.isLockHeight)
for (let inf of this.doorDrawersInfo)
{
if (inf.col && !inf.isLockHeight)
isAllLock = false;
if (inf.col === 0 && (inf === info || inf.isLockHeight))
allHeight += inf.height;
if (allHeight > this.totalHeight)
if (allHeight > this.totalHeight - this.m_Option.topOffset - this.m_Option.bottomOffset)
{
AppToaster.show({
message: "高度锁定失败,锁定高度太大",
timeout: 1500,
intent: Intent.DANGER
})
});
return;
}
}
info.isLockHeight = !info.isLockHeight;
}
this.CalcInfos();
@ -322,12 +339,26 @@ export class DoorDrawerStore extends BoardStore
}
if (cof.doorsInfo && cof.doorsInfo.length > 0)
{
for (let info of cof.doorsInfo)
{
if (info.version === undefined)
{
info.version = 1;
if (!info.tempInfo)
info.tempInfo = {
temp: { id: "", name: "" },
handleTemp: { id: "", name: "" },
};
}
}
observable(this.doorDrawersInfo).replace(cof.doorsInfo);
this.CalcInfos(true);
}
else
this.InitInfos();
}
HasInvailValue()
{
return CheckoutValid.HasInvailValue(this.UIOption, CheckObjectType.Do)
return CheckoutValid.HasInvailValue(this.UIOption, CheckObjectType.Do);
}
}

@ -41,6 +41,7 @@ export class DoorStore extends DoorDrawerStore
{
if (isReset)
this.doorDrawersInfo.push({
version: 1,
row: i,
col: j,
openDir: (j & 1) === 1 || j === col - 1 ? DoorOpenDir.Right : DoorOpenDir.Left,
@ -119,4 +120,10 @@ export class DoorStore extends DoorDrawerStore
super.InitOption();
this.InitInfos();
}
protected HandleTopBottomOffset()
{
this.m_Option.bottomOffset = this.restHeight - this.m_Option.topOffset;
this.UIOption["bottomOffset"] = (this.restHeight - this.m_Option.topOffset).toString();
this.UpdateSpace();
}
}

@ -1,13 +1,15 @@
import { observable } from "mobx";
import { FixedNotZero } from "../../../Common/Utils";
import { DoorPosType, HandleHorPos, HandleVePos, IDrawerConfigOption } from "../DoorInterface";
import { IDrawerConfigOption, IDrawerInfo } from "../DoorInterface";
import { DoorDrawerStore } from "./DoorDrawerStore";
import { DefaultDrawerOption } from "../../../Editor/DefaultConfig";
import { IConfigOption } from "../../Components/Board/UserConfig";
import { AppToaster } from "../../Components/Toaster";
import { Intent } from "@blueprintjs/core";
export class DrawerStore extends DoorDrawerStore
{
title = "抽屉";
@observable m_Option: IDrawerConfigOption = Object.assign({}, DefaultDrawerOption);
InitInfos()
{
this.UpdateSpace();
@ -28,6 +30,7 @@ export class DrawerStore extends DoorDrawerStore
for (let j = 0; j < col; j++)
{
this.doorDrawersInfo.push({
version: 1,
row: i,
col: j,
divWidth: rectWidth,
@ -40,7 +43,7 @@ export class DrawerStore extends DoorDrawerStore
isLockHeight: false,
isSelect: this.m_Option.isAllSelect,
tempInfo: { temp: { id: "", name: "" }, handleTemp: { id: "", name: "" } }
})
});
}
}
}
@ -50,4 +53,76 @@ export class DrawerStore extends DoorDrawerStore
super.InitOption();
this.InitInfos();
}
UpdateOption(cof: IConfigOption)
{
let opt = cof.option as IDrawerConfigOption;
if (opt && (opt.version === undefined || opt.version < 2))
{
opt.version = 2;
opt.isLockTopOffset = false;
opt.isLockBottomOffset = false;
}
super.UpdateOption(cof);
}
ChangeLockStatus(info: IDrawerInfo, isWidth: boolean)
{
if (!isWidth)
{
let lockHeightCount = 0;
for (let info of this.doorDrawersInfo)
{
if (info.col === 0 && info.isLockHeight)
lockHeightCount++;
}
if (lockHeightCount + 1 === this.m_Option.row && this.m_Option.isLockTopOffset && this.m_Option.isLockBottomOffset)
{
AppToaster.show({
message: "上下留空空间已锁定",
timeout: 2000,
intent: Intent.DANGER,
});
return;
}
}
super.ChangeLockStatus(info, isWidth);
}
protected HandleTopBottomOffset()
{
if (this.IsLockDrawerHeight)
{
if (this.m_Option.isLockBottomOffset)
{
this.m_Option.topOffset = this.restHeight - this.m_Option.bottomOffset;
this.UIOption["topOffset"] = (this.restHeight - this.m_Option.bottomOffset).toString();
}
else if (this.m_Option.isLockTopOffset)
{
this.m_Option.bottomOffset = this.restHeight - this.m_Option.topOffset;
this.UIOption["bottomOffset"] = (this.restHeight - this.m_Option.topOffset).toString();
}
else
{
this.m_Option.isLockBottomOffset = true;
this.m_Option.bottomOffset = this.restHeight - this.m_Option.topOffset;
this.UIOption["bottomOffset"] = (this.restHeight - this.m_Option.topOffset).toString();
}
this.UpdateSpace();
}
}
CheckLockSize(isWidth: boolean)
{
if (!isWidth && this.m_Option.isLockBottomOffset && this.m_Option.isLockTopOffset && this.IsLockDrawerHeight)
{
AppToaster.show({
message: "上下留空已经锁定",
timeout: 2000,
intent: Intent.DANGER,
});
return false;
}
return super.CheckLockSize(isWidth);
}
}

@ -57,6 +57,8 @@ export interface IDrawerConfigOption extends IDoorAndDrawerConfigOption
drawerTotalDepth: number; //抽屉总深
trackDepth: number; //轨道深度
isAutoSelectTrack: boolean;
isLockTopOffset: boolean;
isLockBottomOffset: boolean;
}
//门板位置类型
@ -89,7 +91,7 @@ export enum DoorOpenDir
}
//抽屉门板信息
export interface IDrawerInfo
export interface IDrawerInfo extends IBaseOption
{
row: number,
col: number,

Loading…
Cancel
Save