From 192a441c1d80b04d4c92bd805a313dd61ab65246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Sat, 5 Aug 2023 07:46:09 +0000 Subject: [PATCH] =?UTF-8?q?!2335=20=E6=96=B0=E5=A2=9E:=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E6=A0=8F=E5=A2=9E=E5=8A=A0=E6=9D=90=E8=B4=A8=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=90=8A=E9=A1=B6=E5=9C=B0=E9=9D=A2=E9=BB=98=E8=AE=A4=E6=9D=90?= =?UTF-8?q?=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UI/Components/Asset.tsx | 66 ++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 16 deletions(-) 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 && + }