import { Component, ReactNode } from "react"; import { AttrInput } from "@Component/AttrInput/AttrInput"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { AllI18nKeys } from "@Component/Localization/Localization"; import { Range } from "@Model/Range"; import { ObjectID } from "@Model/Renderer"; import "./RangeDetails.scss"; @useStatusWithEvent("rangeAttrChange", "focusObjectChange") class RangeDetails extends Component { private renderErrorFrom(error: AllI18nKeys) { return <> } private renderFrom(range: Range) { return <> { this.props.status ? this.props.status.changeRangeAttrib(range.id, "displayName", e) : null; }} /> { if (this.props.status) { range.position[0] = (e as any) / 1; this.props.status.changeRangeAttrib(range.id, "position", range.position); } }} /> { if (this.props.status) { range.position[1] = (e as any) / 1; this.props.status.changeRangeAttrib(range.id, "position", range.position); } }} /> { if (this.props.status) { range.position[2] = (e as any) / 1; this.props.status.changeRangeAttrib(range.id, "position", range.position); } }} /> } public render(): ReactNode { if (this.props.status) { if (this.props.status.focusObject.size <= 0) { return this.renderErrorFrom("Panel.Info.Range.Details.Attr.Error.Unspecified"); } if (this.props.status.focusObject.size > 1) { return this.renderErrorFrom("Common.Attr.Key.Error.Multiple"); } let id: ObjectID = 0; this.props.status.focusObject.forEach((cid => id = cid)); let range = this.props.status!.model.getObjectById(id); if (range instanceof Range) { return this.renderFrom(range); } else { return this.renderErrorFrom("Panel.Info.Range.Details.Attr.Error.Not.Range"); } } return this.renderErrorFrom("Panel.Info.Range.Details.Attr.Error.Unspecified"); } } export { RangeDetails };