graphActionsBar.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import * as React from 'react';
  2. import { IconButtonLineComponent } from '../../../lines/iconButtonLineComponent';
  3. interface IGraphActionsBarProps {
  4. addKeyframe: () => void;
  5. removeKeyframe: () => void;
  6. handleValueChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
  7. handleFrameChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
  8. flatTangent: () => void;
  9. brokeTangents: () => void;
  10. setLerpMode: () => void;
  11. brokenMode: boolean;
  12. lerpMode: boolean;
  13. currentValue: number;
  14. currentFrame: number;
  15. title: string;
  16. close: (event: any) => void;
  17. enabled: boolean;
  18. }
  19. export class GraphActionsBar extends React.Component<IGraphActionsBarProps> {
  20. constructor(props: IGraphActionsBarProps) {
  21. super(props);
  22. }
  23. render() {
  24. return (
  25. <div className='actions-wrapper'>
  26. <div className='title-container'>
  27. <div className='icon babylon-logo'></div>
  28. <div className='title'>{this.props.title}</div>
  29. </div>
  30. <div
  31. className='buttons-container'
  32. style={{ pointerEvents: this.props.enabled ? 'all' : 'none' }}
  33. >
  34. <div className='action-input frame-input'>
  35. <input
  36. type='number'
  37. readOnly
  38. value={this.props.currentFrame}
  39. step='1'
  40. />
  41. </div>
  42. <div className='action-input'>
  43. <input
  44. type='number'
  45. value={this.props.currentValue}
  46. onChange={this.props.handleValueChange}
  47. step='0.1'
  48. />
  49. </div>
  50. <IconButtonLineComponent
  51. tooltip={'Add Keyframe'}
  52. icon='new-key'
  53. onClick={this.props.addKeyframe}
  54. />
  55. <IconButtonLineComponent
  56. tooltip={'Frame selected keyframes'}
  57. icon='frame'
  58. onClick={this.props.removeKeyframe}
  59. />
  60. <IconButtonLineComponent
  61. tooltip={'Flat Tangents'}
  62. icon='flat-tangent'
  63. onClick={this.props.flatTangent}
  64. />
  65. <IconButtonLineComponent
  66. tooltip={
  67. this.props.brokenMode ? 'Broken Mode On' : 'Broken Mode Off'
  68. }
  69. icon={this.props.brokenMode ? 'break-tangent' : 'unify-tangent'}
  70. onClick={this.props.brokeTangents}
  71. />
  72. <IconButtonLineComponent
  73. tooltip={this.props.lerpMode ? 'Lerp On' : 'lerp Off'}
  74. icon='linear-tangent'
  75. onClick={this.props.setLerpMode}
  76. />
  77. </div>
  78. </div>
  79. );
  80. }
  81. }