!2014 修复:灯光配置输入框限制,部分情况报错问题

pull/2017/head
林三 2 years ago committed by ChenX
parent 6f33999c4a
commit d0f5750df3

@ -364,7 +364,7 @@ export class LightConfigModel extends React.Component<{ store: LightStore; confi
let min: number = 0;
let isFloat: boolean = false; //stepsize 是否为0.1
let scale: number = 1;
let noLim: boolean = false;
let noLim: boolean = false;//不限制最大值?
switch (k)
{
case "Intensity":
@ -611,37 +611,44 @@ export class InputAndSlider extends React.Component<{ pars: string[], store: Lig
{
e.stopPropagation();
}}
onValueChange={(num, value, e) =>
onValueChange={(numberValue, strValue, e) =>
{
let min = this.props.min * this.props.scale;
let max = this.props.noLim ? 1e7 : this.props.max * this.props.scale;
// 处理小数点 Data赋值不上传
if (num >= this.props.min && num < this.props.max && value === num + ".")
if (numberValue >= min && numberValue < max && strValue === numberValue + ".")
{
this.props.store.lightData[this.props.pars[0]] = num + ".";
this.props.store.lightData[this.props.pars[0]] = numberValue + ".";
return;
}
if (isNaN(num) || num > (this.props.noLim ? 10e6 : this.props.max)) return;
if (num < this.props.min)
if (isNaN(numberValue) || numberValue > max) return;
if (numberValue < min)
{
this.props.store.lightData[this.props.pars[0]] = num;
this.props.store.lightData[this.props.pars[0]] = numberValue;
this.OldData = this.props.store.lightData[this.props.pars[0]];
return;
}
this.props.isNotModify ? this.SetLightData(FixedNotZero(num, 1)) : this.SetValue(FixedNotZero(num, 1));
if (this.props.isNotModify)
this.SetLightData(FixedNotZero(numberValue, 1));
else
this.SetValue(FixedNotZero(numberValue, 1));
}}
onBlur={(e) =>
{
let min = this.props.min * this.props.scale;
if (e.currentTarget.value[e.currentTarget.value.length - 1] === ".")
{
this.props.store.lightData[this.props.pars[0]] = this.props.store.currentSelectEnt[this.props.pars[0]];
}
if (this.props.store.lightData[this.props.pars[0]] < this.props.min)
if (this.props.store.lightData[this.props.pars[0]] < 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;
}
this.props.isNotModify ? this.SetLightData(FixedNotZero(this.props.min, 1)) : this.SetValue(FixedNotZero(this.props.min, 1));
this.props.isNotModify ? this.SetLightData(FixedNotZero(min, 1)) : this.SetValue(FixedNotZero(min, 1));
}
if (!this.props.isNotModify)
{

Loading…
Cancel
Save