From 5d77395163bd6a13e64a4a67d7cb804f8dfc31e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=A5=E5=A4=AA?= <812026078@qq.com> Date: Tue, 11 Jun 2024 07:25:01 +0000 Subject: [PATCH] =?UTF-8?q?!2810=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BF=AE=E6=94=B9=E5=9C=BA=E6=99=AF=E5=A4=AA=E9=98=B3?= =?UTF-8?q?=E5=85=89=20sourceAngle=20=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UI/Components/INumericInput.tsx | 1 + src/UI/Components/RightPanel/RightPanel.less | 24 +++++ src/UI/Components/RightPanel/ScenePanel.tsx | 2 +- src/UI/Components/RightPanel/SunLightGui.tsx | 91 +++++++++++++++++++ src/UI/Components/RightPanel/SunLightStore.ts | 1 + 5 files changed, 118 insertions(+), 1 deletion(-) diff --git a/src/UI/Components/INumericInput.tsx b/src/UI/Components/INumericInput.tsx index b6b8748ff..7734dac44 100644 --- a/src/UI/Components/INumericInput.tsx +++ b/src/UI/Components/INumericInput.tsx @@ -83,6 +83,7 @@ export class INumericInput extends React.Component return; } this._Value = parseFloat(FixedNotZero(num, this._Float)); + this.props.onValueChange(num, value, e); this._isPopoverOpen = false; }} onFocus={(e) => diff --git a/src/UI/Components/RightPanel/RightPanel.less b/src/UI/Components/RightPanel/RightPanel.less index bd9d2392f..75896ad27 100644 --- a/src/UI/Components/RightPanel/RightPanel.less +++ b/src/UI/Components/RightPanel/RightPanel.less @@ -193,6 +193,30 @@ } } + .sun-light-angle { + display: flex; + + .bp3-numeric-input { + .bp3-button-group { + display: none; + } + } + + input { + margin-left: none; + } + + .bp3-popover-wrapper { + display: flex; + align-items: center; + + button { + position: relative; + left: 151px; + } + } + } + .bp3-button-group.bp3-vertical.bp3-fixed { margin-top: 1px; } diff --git a/src/UI/Components/RightPanel/ScenePanel.tsx b/src/UI/Components/RightPanel/ScenePanel.tsx index 51e615a35..a95a826d2 100644 --- a/src/UI/Components/RightPanel/ScenePanel.tsx +++ b/src/UI/Components/RightPanel/ScenePanel.tsx @@ -103,7 +103,7 @@ export class ScenePanel extends React.Component<{ store?: RightPanelStore; }, {} alignIndicator={Alignment.RIGHT} />
-
+
+ { + const KEY = '修改太阳光源角度'; + if (CommandState.CommandIng) + { + if (app.Database.hm.UndoData.CommandName !== KEY) + { + await app.Editor.ModalManage.EndExecingCmd(); + if (CommandState.CommandIng) + { + AppToaster.show({ + message: "命令正在执行中!无法修改太阳光源角度!", + timeout: 5000, + intent: Intent.DANGER + }); + return; + } + commandMachine.CommandStart(KEY); + } + } + else + { + commandMachine.CommandStart(KEY); + } + app.Database.SunLight.LightSourceAngle = val; + this.store.sunLightSourceAngle = val; + this.SyncSunLight(); + }; + SetSunLightPosition = (rotate: number, elevation: number): void => { let pos: Vector3; @@ -384,6 +414,67 @@ export default class SunLightGui extends Component
+ +
+ + + { + if (num < 0 || num > 5) return; + this.SetSunLightSourceAngle(num); + app.Viewer.UpdateRender(); + }} + onBlur={() => + { + const KEY = '修改太阳光源角度'; + if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY) + commandMachine.CommandEnd(); + }} + /> + + { + await this.SetSunLightSourceAngle(val); + app.Viewer.UpdateRender(); + }} + onRelease={() => + { + const KEY = '修改太阳光源角度'; + if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY) + commandMachine.CommandEnd(); + }} + /> + +
+