keyframeSvgPoint.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import * as React from "react";
  2. import { Vector2 } from 'babylonjs/Maths/math.vector';
  3. import { AnchorSvgPoint } from './anchorSvgPoint';
  4. export interface IKeyframeSvgPoint {
  5. keyframePoint: Vector2;
  6. rightControlPoint: Vector2 | null;
  7. leftControlPoint: Vector2 | null;
  8. id: string;
  9. }
  10. interface IKeyframeSvgPointProps {
  11. keyframePoint: Vector2;
  12. leftControlPoint: Vector2 | null;
  13. rightControlPoint: Vector2 | null;
  14. id: string;
  15. }
  16. export class KeyframeSvgPoint extends React.Component<IKeyframeSvgPointProps>{
  17. constructor(props: IKeyframeSvgPointProps) {
  18. super(props);
  19. }
  20. render() {
  21. return (
  22. <>
  23. <svg className="draggable" x={this.props.keyframePoint.x} y={this.props.keyframePoint.y} style={{overflow:'visible'}}>
  24. <circle data-id={this.props.id} className="draggable" cx="0" cy="0" r="2" stroke="none" strokeWidth="0" fill="red" />
  25. </svg>
  26. { this.props.leftControlPoint && <AnchorSvgPoint type="left" index={this.props.id} control={this.props.leftControlPoint} anchor={this.props.keyframePoint} active={false}/>}
  27. { this.props.rightControlPoint && <AnchorSvgPoint type="right" index={this.props.id} control={this.props.rightControlPoint} anchor={this.props.keyframePoint} active={false}/>}
  28. </>
  29. )
  30. }
  31. }