import { Component, Fragment, ReactNode } from "react"; import { useSettingWithEvent, IMixinSettingProps, Language } from "@Context/Setting"; import { AttrInput } from "@Input/AttrInput/AttrInput"; import { ObjectID } from "@Model/Renderer"; import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; import { ObjectPicker } from "@Input/ObjectPicker/ObjectPicker"; import { AllI18nKeys } from "@Component/Localization/Localization"; import { Message } from "@Input/Message/Message"; import { ColorInput } from "@Input/ColorInput/ColorInput"; import { IParameter, IParameterOption, IParameterOptionItem, IParameterValue, IParamValue, isObjectType, isVectorType } from "@Model/Parameter"; import "./Parameter.scss"; interface IParameterProps
{ option: IParameterOption
; value: IParameterValue
;
key: ObjectID;
change: ) => any;
i18n: , language: Language) => string;
title?: AllI18nKeys;
titleOption?: Record extends Component , value: IParamValue ): ReactNode {
const indexKey = `${this.props.key}-${key}`;
const type = option.type;
const i18nString = this.props.i18n(option, this.props.setting?.language ?? "EN_US");
if (type === "number") {
return );
}}
/>;
}
else if (type === "string") {
return );
}}
/>;
}
else if (type === "boolean") {
return );
}}
/>
}
else if (isObjectType(type)) {
type IObjectParamValue = IParamValue<"G" | "R" | "LG" | "LR">;
const typedValue = value as IObjectParamValue;
return );
}}
cleanValue={() => {
typedValue.picker = undefined as IObjectParamValue["picker"];
this.props.change(key, typedValue as IParamValue );
}}
/>
}
else if (type === "color") {
return );
}}
/>
}
else if (type === "vec") {
type IObjectParamValue = IParamValue<"vec">;
const typedValue = value as IObjectParamValue;
return );
}}
/>
);
}}
/>
);
}}
/>