diff --git a/src/UI/Components/Asset.tsx b/src/UI/Components/Asset.tsx index 2e8061825..d476b6174 100644 --- a/src/UI/Components/Asset.tsx +++ b/src/UI/Components/Asset.tsx @@ -73,6 +73,7 @@ export enum CurDefMtlType Draw = 1, Wall = 2, Floor = 3, + CeilingFace = 4 //吊顶底面 } /** @@ -85,6 +86,8 @@ export class Asset extends React.Component _DivColorRef = React.createRef(); _CurWallMtlIconMarginBottom: number = 2; _CurFloorMtlIconMarginBottom: number = 2; + _CurCeilingFaceMtlIconMarginBottom: number = 2; + _CurCeilingFaceMtlIconMarginLeft: number = -17; _NameEl: HTMLDivElement; _RemoveCall: Function[] = []; _RenderIng = false; @@ -303,6 +306,11 @@ export class Asset extends React.Component app.Database.MaterialTable.CurBoardMtl = material.Id; break; } + case CurDefMtlType.CeilingFace: + { + app.Database.MaterialTable.CurBulkCeilingFaceMaterial = material.Id; + break; + } } }, "设置默认材质"); }; @@ -354,28 +362,46 @@ export class Asset extends React.Component }; /** - *多个重叠时改变marginBottom + * 图标多个重叠时改变marginBottom */ _GetIconMarginBottom() { - if (app.Database.MaterialTable.CurBoardMtl === app.Database.MaterialTable.CurWallMtl) + let curBoardMtl = app.Database.MaterialTable.CurBoardMtl; + let curWallMtl = app.Database.MaterialTable.CurWallMtl; + let curFloorMtl = app.Database.MaterialTable.CurFloorMtl; + let curBulkCeilingFaceMaterial = app.Database.MaterialTable.CurBulkCeilingFaceMaterial; + + let layers = [0, 0, 0, 0]; //都是第一层 + let mtls = [curBoardMtl, curWallMtl, curFloorMtl, curBulkCeilingFaceMaterial]; + + for (let i = 0; i < mtls.length; i++) { - this._CurWallMtlIconMarginBottom = 21; - if (app.Database.MaterialTable.CurBoardMtl === app.Database.MaterialTable.CurFloorMtl) - this._CurFloorMtlIconMarginBottom = 40; - else - this._CurFloorMtlIconMarginBottom = 2; + for (let j = 0; j < i; j++) + { + if (i !== j && mtls[i] && mtls[j] && mtls[i] === mtls[j]) + layers[i] = layers[i] + 1; + } } - else if (app.Database.MaterialTable.CurBoardMtl === app.Database.MaterialTable.CurFloorMtl - || app.Database.MaterialTable.CurWallMtl === app.Database.MaterialTable.CurFloorMtl) + + this._CurWallMtlIconMarginBottom = 2 + layers[1] * 19; + this._CurFloorMtlIconMarginBottom = 2 + layers[2] * 19; + + // --------- + // --------- | X| + // | X| | X| + // | X| | X| + // | X X| | X| + // --------- --------- + //默认吊顶图标在第4层时 大图标不用改变位置 小图标放置左边 + if (layers[3] === 3 && !userConfig.isLargeIcon) { - this._CurWallMtlIconMarginBottom = 2; - this._CurFloorMtlIconMarginBottom = 21; + this._CurCeilingFaceMtlIconMarginBottom = 2; + this._CurCeilingFaceMtlIconMarginLeft = -34; } else { - this._CurWallMtlIconMarginBottom = 2; - this._CurFloorMtlIconMarginBottom = 2; + this._CurCeilingFaceMtlIconMarginBottom = 2 + layers[3] * 19; + this._CurCeilingFaceMtlIconMarginLeft = -17; } } @@ -408,9 +434,10 @@ export class Asset extends React.Component React.createElement(MenuItem, { onClick: this._HandleApply, text: "应用到当前选择实体" }), React.createElement(MenuItem, { onClick: this._HighLightEntity, text: "显示应用当前材质的实体" }), React.createElement(MenuItem, { onClick: this._ApplyUseCurBrsGoodInfo, text: "一键更新板件板材" }), - React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Draw), text: "设置为默认板块材质" }), - React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Wall), text: "设置为默认墙体材质" }), - React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Floor), text: "设置为默认地面材质" }), + React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Draw), text: "设置为板块默认材质" }), + React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Wall), text: "设置为墙体默认材质" }), + React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.Floor), text: "设置为地面默认材质" }), + React.createElement(MenuItem, { onClick: () => this._SetCurDefMtl(CurDefMtlType.CeilingFace), text: "设置为吊顶底面默认材质" }), React.createElement(MenuItem, { onClick: this._HandleCollection, text: "收藏" }), this.props.material === app.Database.DefaultMaterial ? "" : React.createElement(MenuItem, { onClick: this._HandleDelete, text: "删除" }), ); @@ -448,6 +475,13 @@ export class Asset extends React.Component style={{ marginBottom: this._CurFloorMtlIconMarginBottom }} /> } + { + this.props.material.objectId === app.Database.MaterialTable.CurBulkCeilingFaceMaterial && + }