diff --git a/source/Panel/RangeDetails/RangeDetails.tsx b/source/Panel/RangeDetails/RangeDetails.tsx index 0188e79..ff9adb3 100644 --- a/source/Panel/RangeDetails/RangeDetails.tsx +++ b/source/Panel/RangeDetails/RangeDetails.tsx @@ -13,50 +13,24 @@ import "./RangeDetails.scss"; @useStatusWithEvent("rangeAttrChange", "focusObjectChange", "rangeLabelChange") class RangeDetails extends Component { - private renderAttrInput( - id: ObjectID, key: AllI18nKeys, val: string | number | undefined, - change: (val: string, status: Status) => any, - step?: number, max?: number, min?: number - ) { - const handelFunc = (e: string) => { - if (this.props.status) { - change(e, this.props.status); - } - } - if (step) { - return - } else { - return - } - } - private renderFrom(range: Range) { return <> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Display.Name", range.displayName, - (val, status) => { - status.changeRangeAttrib(range.id, "displayName", val); - } - )} + { + this.props.status?.changeRangeAttrib(range.id, "displayName", val); + }} + /> { - if (this.props.status) { - this.props.status.changeRangeAttrib(range.id, "color", color); - } + this.props.status?.changeRangeAttrib(range.id, "color", color); }} /> @@ -64,32 +38,17 @@ class RangeDetails extends Component { keyI18n="Common.Attr.Key.Label" labels={range.allLabels()} labelAdd={(label) => { - if (this.props.status) { - this.props.status.addRangeLabel(range.id, label); - } + this.props.status?.addRangeLabel(range.id, label); }} labelDelete={(label) => { - if (this.props.status) { - this.props.status.deleteRangeLabel(range.id, label); - } + this.props.status?.deleteRangeLabel(range.id, label); }} /> { - if (this.props.status) { - this.props.status.changeRangeAttrib(range.id, "display", val); - } - }} - /> - - { - if (this.props.status) { - this.props.status.changeRangeAttrib(range.id, "update", val); - } + this.props.status?.changeRangeAttrib(range.id, "display", val); }} /> @@ -106,53 +65,59 @@ class RangeDetails extends Component { - {this.renderAttrInput( - range.id, "Common.Attr.Key.Position.X", - range.position[0], (val, status) => { + { range.position[0] = (val as any) / 1; - status.changeRangeAttrib(range.id, "position", range.position); - }, .1 - )} + this.props.status?.changeRangeAttrib(range.id, "position", range.position); + }} + /> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Position.Y", - range.position[1],(val, status) => { + { range.position[1] = (val as any) / 1; - status.changeRangeAttrib(range.id, "position", range.position); - }, .1 - )} + this.props.status?.changeRangeAttrib(range.id, "position", range.position); + }} + /> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Position.Z", - range.position[2], (val, status) => { + { range.position[2] = (val as any) / 1; - status.changeRangeAttrib(range.id, "position", range.position); - }, .1 - )} + this.props.status?.changeRangeAttrib(range.id, "position", range.position); + }} + /> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Radius.X", - range.radius[0], (val, status) => { + { range.radius[0] = (val as any) / 1; - status.changeRangeAttrib(range.id, "radius", range.radius); - }, .1, undefined, 0 - )} + this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); + }} + /> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Radius.Y", - range.radius[1], (val, status) => { + { range.radius[1] = (val as any) / 1; - status.changeRangeAttrib(range.id, "radius", range.radius); - }, .1, undefined, 0 - )} + this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); + }} + /> - {this.renderAttrInput( - range.id, "Common.Attr.Key.Radius.Z", - range.radius[2], (val, status) => { + { range.radius[2] = (val as any) / 1; - status.changeRangeAttrib(range.id, "radius", range.radius); - }, .1, undefined, 0 - )} + this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); + }} + /> }