!1810 修复:右侧栏曝光输入框输入问题

pull/1819/head
林三 3 years ago committed by ChenX
parent 5c0c9e1407
commit d7eb7f9553

@ -1,4 +1,5 @@
import { Checkbox, FormGroup, Intent, Label, NumericInput, Slider } from "@blueprintjs/core"; import { Checkbox, FormGroup, Intent, Label, NumericInput, Slider } from "@blueprintjs/core";
import { observable } from "mobx";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import React from "react"; import React from "react";
import { Entitys2Data } from "../../../Add-on/ExportData"; import { Entitys2Data } from "../../../Add-on/ExportData";
@ -10,9 +11,14 @@ import { userConfig } from "../../../Editor/UserConfig";
import { LightStore } from "../../Store/RightPanelStore/LightStore"; import { LightStore } from "../../Store/RightPanelStore/LightStore";
import { AppToaster } from "../Toaster"; import { AppToaster } from "../Toaster";
//天光曝光
const AMEXP_MIN = - 3;
const AMEXP_MAX = 6;
@observer @observer
export class ExposureUI extends React.Component<{ store: LightStore; }, {}> export class ExposureUI extends React.Component<{ store: LightStore; }, {}>
{ {
@observable _InputExposureCompensation: string = this.props.store.hemisphereLightData.ExposureCompensation;
async SetExposureCompensation(val: number) async SetExposureCompensation(val: number)
{ {
const KEY = '修改曝光补偿'; const KEY = '修改曝光补偿';
@ -43,6 +49,7 @@ export class ExposureUI extends React.Component<{ store: LightStore; }, {}>
} }
render() render()
{ {
let expValue = this.props.store.hemisphereLightData.ExposureCompensation;
return ( return (
<div id='ExposureUI'> <div id='ExposureUI'>
<Checkbox <Checkbox
@ -85,14 +92,29 @@ export class ExposureUI extends React.Component<{ store: LightStore; }, {}>
<Label>:</Label> <Label>:</Label>
<NumericInput <NumericInput
buttonPosition={"none"} buttonPosition={"none"}
min={-3} min={AMEXP_MIN}
max={6} max={AMEXP_MAX}
stepSize={0.1} stepSize={0.1}
value={(FixedNotZero(this.props.store.hemisphereLightData.ExposureCompensation, 1))} value={this._InputExposureCompensation}
onValueChange={async (e) => onValueChange={async (num, value, e) =>
{ {
if (isNaN(e) || e < -3 || e > 6) return; if (value === "" || "-0.".includes(value) && value !== "0")
this.SetExposureCompensation(e); {
this._InputExposureCompensation = value;
return;
}
if (isNaN(num) || num < AMEXP_MIN || num > AMEXP_MAX) return;
if (num >= AMEXP_MIN && num < AMEXP_MAX && value === num + ".")
{
if (num === AMEXP_MIN) return; //MIN = -3 ,防止输入出现如( -3.)
this._InputExposureCompensation = value;
return;
}
this._InputExposureCompensation = FixedNotZero(num, 1);
if (this._InputExposureCompensation === expValue) return; //等于原始值
this.SetExposureCompensation(num);
const KEY = '修改曝光补偿'; const KEY = '修改曝光补偿';
if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY) if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY)
{ {
@ -107,16 +129,19 @@ export class ExposureUI extends React.Component<{ store: LightStore; }, {}>
{ {
e.stopPropagation(); e.stopPropagation();
}} }}
onBlur={(e) => { e.currentTarget.value = expValue; }}
/> />
<Slider <Slider
showTrackFill={false} showTrackFill={false}
min={-3} min={AMEXP_MIN}
max={6} max={AMEXP_MAX}
stepSize={0.1} stepSize={0.1}
value={parseFloat(this.props.store.hemisphereLightData.ExposureCompensation)} value={parseFloat(expValue)}
labelValues={[AMEXP_MIN, AMEXP_MAX]}
onChange={(val) => onChange={(val) =>
{ {
this.SetExposureCompensation(val); this.SetExposureCompensation(val);
this._InputExposureCompensation = FixedNotZero(val, 1);
}} }}
onRelease={() => onRelease={() =>
{ {

@ -81,9 +81,9 @@
} }
} }
.bp3-slider-axis .bp3-slider-axis .bp3-slider-label
{ {
display: none; margin-top: 3px;
} }
} }
} }

Loading…
Cancel
Save