import { Component, ReactNode } from "react"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { AttrInput } from "@Input/AttrInput/AttrInput"; import { Message } from "@Input/Message/Message"; import { Range } from "@Model/Range"; import { ObjectID } from "@Model/Model"; import { ColorInput } from "@Input/ColorInput/ColorInput"; import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; import { LabelPicker } from "@Input/LabelPicker/LabelPicker"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; import { Parameter } from "@Input/Parameter/Parameter"; import "./RangeDetails.scss"; @useStatusWithEvent("rangeAttrChange", "focusObjectChange", "rangeLabelChange") class RangeDetails extends Component { private renderFrom(range: Range) { return <> { this.props.status?.changeRangeAttrib(range.id, "displayName", val); }} /> { this.props.status?.changeRangeAttrib(range.id, "color", color); }} /> { this.props.status?.addRangeLabel(range.id, label); }} labelDelete={(label) => { this.props.status?.deleteRangeLabel(range.id, label); }} /> { this.props.status?.changeRangeAttrib(range.id, "display", val); }} /> { if (this.props.status) { const status = this.props.status; status.popup.showPopup(ConfirmPopup, { infoI18n: "Popup.Delete.Objects.Confirm", titleI18N: "Popup.Action.Objects.Confirm.Title", yesI18n: "Popup.Action.Objects.Confirm.Delete", red: "yes", yes: () => { status.model.deleteObject([range]); status.setFocusObject(new Set()); } }) } }} /> key !== "color") } change={(key, value) => { range.renderParameter[key as any] = value; this.props.status?.changeRangeAttrib( range.id, "renderParameter", range.renderParameter ); }} /> { range.position[0] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "position", range.position); }} /> { range.position[1] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "position", range.position); }} /> { range.position[2] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "position", range.position); }} /> { range.radius[0] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); }} /> { range.radius[1] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); }} /> { range.radius[2] = (val as any) / 1; this.props.status?.changeRangeAttrib(range.id, "radius", range.radius); }} /> } public render(): ReactNode { if (this.props.status) { if (this.props.status.focusObject.size <= 0) { return ; } if (this.props.status.focusObject.size > 1) { return ; } let id: ObjectID = ""; 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 ; } } return ; } } export { RangeDetails };