!1980 修复:修改灯光属性部分情况报错

pull/1987/head
林三 2 years ago committed by ChenX
parent 12a26a7f96
commit cc5f945d5c

@ -7,6 +7,7 @@ import { Color, MathUtils } from "three";
import { begin } from "xaop";
import { Entitys2Data } from "../../../Add-on/ExportData";
import { app } from "../../../ApplicationServices/Application";
import { CoolDownTime } from "../../../Common/CoolDownTime";
import { ResourcesCDN_HOST } from "../../../Common/HostUrl";
import { KeyBoard } from "../../../Common/KeyEnum";
import { UpdateDraw } from "../../../Common/Status";
@ -32,7 +33,7 @@ export class LightConfigModel extends React.Component<{ store: LightStore; confi
@observable _Target: string = this.props.lightType === BoardModalType.PointLight ? "" : (this.props.store.currentSelectEnt as SpotLight | RectAreaLight).Target.sub(this.props.store.currentSelectEnt.Position).normalize().ceil().toArray().toString();
@observable _Position: string = this.props.store.currentSelectEnt.Position.ceil().toArray().toString();
private removeFuncs: Function[] = []; //移除注入
private coolTime = new CoolDownTime;
componentDidMount()
{
if (this.props.isNotModify)
@ -102,7 +103,10 @@ export class LightConfigModel extends React.Component<{ store: LightStore; confi
private SyncLight()
{
if (userConfig.synchronousEnable)
this.coolTime.Debounce(() =>
{
app.WebSocket.Send(JSON.stringify(Entitys2Data([this.props.store.currentSelectEnt])));
}, 10);
}
render()
@ -333,8 +337,7 @@ export class LightConfigModel extends React.Component<{ store: LightStore; confi
commandMachine.CommandStart(KEY);
}
this.props.store.currentSelectEnt.Temperature = val;
if (userConfig.synchronousEnable)
app.WebSocket.Send(JSON.stringify(Entitys2Data([this.props.store.currentSelectEnt])));
this.SyncLight();
}
else
{
@ -450,6 +453,17 @@ export class LightConfigModel extends React.Component<{ store: LightStore; confi
export class InputAndSlider extends React.Component<{ pars: string[], store: LightStore; max: number; isFloat: boolean; min: number; noLim: boolean; isNotModify: boolean; }, {}>
{
OldData: number = 0;
private coolTime = new CoolDownTime;
private SyncLight()
{
if (userConfig.synchronousEnable)
this.coolTime.Debounce(() =>
{
app.WebSocket.Send(JSON.stringify(Entitys2Data([this.props.store.currentSelectEnt])));
}, 10);
}
async SetValue(value: string)
{
@ -505,8 +519,7 @@ export class InputAndSlider extends React.Component<{ pars: string[], store: Lig
this.props.store.currentSelectEnt[this.props.pars[0]] = parseFloat(value);
break;
}
if (userConfig.synchronousEnable)
app.WebSocket.Send(JSON.stringify(Entitys2Data([this.props.store.currentSelectEnt])));
this.SyncLight();
app.Editor.UpdateScreen();
}
@ -587,7 +600,7 @@ export class InputAndSlider extends React.Component<{ pars: string[], store: Lig
}
if (this.props.store.lightData[this.props.pars[0]] < this.props.min)
{
if (this.OldData = this.props.store.currentSelectEnt[this.props.pars[0]])
if (this.OldData === this.props.store.currentSelectEnt[this.props.pars[0]])
{
this.props.store.lightData[this.props.pars[0]] = this.props.store.currentSelectEnt[this.props.pars[0]];
return;
@ -614,10 +627,17 @@ export class InputAndSlider extends React.Component<{ pars: string[], store: Lig
stepSize={this.props.isFloat ? 0.1 : 1}
value={parseFloat(this.props.store.lightData[this.props.pars[0]]) >= this.props.max ? this.props.max : parseFloat(this.props.store.lightData[this.props.pars[0]])}
onChange={(e) =>
{
let coolTime = new CoolDownTime;
coolTime.Debounce(() =>
{
this.props.isNotModify ? this.SetLightData((FixedNotZero(e, this.props.isFloat ? 1 : 0))) : this.SetValue((FixedNotZero(e, this.props.isFloat ? 1 : 0)));
}, 0);
}}
onRelease={() =>
{
let coolTime = new CoolDownTime;
coolTime.Debounce(() =>
{
if (!this.props.isNotModify)
{
@ -627,6 +647,7 @@ export class InputAndSlider extends React.Component<{ pars: string[], store: Lig
commandMachine.CommandEnd();
}
}
}, 50);
}}
/>
</div>

Loading…
Cancel
Save