trigonometryNodePropertyComponent.tsx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import * as React from "react";
  2. import { LineContainerComponent } from '../../sharedComponents/lineContainerComponent';
  3. import { OptionsLineComponent } from '../../sharedComponents/optionsLineComponent';
  4. import { TrigonometryBlockOperations, TrigonometryBlock } from 'babylonjs/Materials/Node/Blocks/trigonometryBlock';
  5. import { IPropertyComponentProps } from './propertyComponentProps';
  6. import { GeneralPropertyTabComponent } from './genericNodePropertyComponent';
  7. export class TrigonometryPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  8. constructor(props: IPropertyComponentProps) {
  9. super(props)
  10. }
  11. render() {
  12. let trigonometryBlock = this.props.block as TrigonometryBlock;
  13. var operationOptions: {label: string, value: TrigonometryBlockOperations}[] = [
  14. {label: "Cos", value: TrigonometryBlockOperations.Cos},
  15. {label: "Sin", value: TrigonometryBlockOperations.Sin},
  16. {label: "Abs", value: TrigonometryBlockOperations.Abs},
  17. {label: "Exp", value: TrigonometryBlockOperations.Exp},
  18. {label: "Exp2", value: TrigonometryBlockOperations.Exp2},
  19. {label: "Round", value: TrigonometryBlockOperations.Round},
  20. {label: "Ceiling", value: TrigonometryBlockOperations.Ceiling},
  21. {label: "Floor", value: TrigonometryBlockOperations.Floor},
  22. {label: "ArcCos", value: TrigonometryBlockOperations.ArcCos},
  23. {label: "ArcSin", value: TrigonometryBlockOperations.ArcSin},
  24. {label: "ArcTan", value: TrigonometryBlockOperations.ArcTan},
  25. {label: "Tan", value: TrigonometryBlockOperations.Tan},
  26. {label: "Log", value: TrigonometryBlockOperations.Log},
  27. {label: "Fract", value: TrigonometryBlockOperations.Fract},
  28. {label: "Sign", value: TrigonometryBlockOperations.Sign},
  29. {label: "Radians to degrees", value: TrigonometryBlockOperations.Degrees},
  30. {label: "Degrees to radians", value: TrigonometryBlockOperations.Radians}
  31. ];
  32. operationOptions.sort((a, b) => {
  33. return a.label.localeCompare(b.label);
  34. })
  35. return (
  36. <div>
  37. <GeneralPropertyTabComponent globalState={this.props.globalState} block={this.props.block}/>
  38. <LineContainerComponent title="PROPERTIES">
  39. <OptionsLineComponent label="Operation" options={operationOptions} target={trigonometryBlock} propertyName="operation" onSelect={(value: any) => {
  40. this.props.globalState.onUpdateRequiredObservable.notifyObservers();
  41. this.props.globalState.onRebuildRequiredObservable.notifyObservers();
  42. this.forceUpdate();
  43. }} />
  44. </LineContainerComponent>
  45. </div>
  46. );
  47. }
  48. }